Can we reconsider env._.*
?
#1523
Replies: 8 comments 39 replies
-
there is a very long discussion about this here if you haven't seen it where this was debated pretty heavily: #1357 My mind is not fully made up, especially when it comes to the specific syntax, however the old It will make it so you can do something like this: [env]
_.source = {file="get_conda_venv.sh", cache_glob="pyproject.toml"}
MY_VENV = "{{ env.VIRTUALENV }}" where "get_conda_venv.sh" is a bash script that exports the virtualenv env vars, making #1514 an easy thing for a user to resolve on their own without needing to build an entire plugin. This will be a great simplification in the way mise works under the hood. A lot of the logic around caching and how tools set their env vars I've found can use the same logic which will simplify the codebase by reusing the same logic I'd be exposing to users. The more I dive into I don't think that Anyhow, the syntax for "env 2.0" is up for discussion, but whatever we come up with is going to need to be able to do what I did in that code sample above. Other tasks this will resolve: |
Beta Was this translation helpful? Give feedback.
-
There was also discussion regarding this at: #1438 (comment) @jdx This is a great tool, really. Remarkable in many ways. Mise, along with your suggestions to use Fish and Spaceship have revolutionized my cli experience and I've been using Linux for over 20 years now. Thank you for all the time and effort you have put into this. I'm relatively inactive in this project, but have hung around more than my usual and commented more than my usual because of how valuable mise has become in my workflow. But, even in just that relatively small amount of exposure, I've seen this brought up a few times. I really think you may be underestimating how jarring this is to user experience.
I agree wholeheartedly! :)
You mentioned simplification of the implementation in #1438 as well. But it seems to me like the implementation is bleeding too far into the user experience / configuration.
FWIW, this is the first time I've groked that you have configuration scenarios in mind that this |
Beta Was this translation helpful? Give feedback.
-
@jdx I'm going to break out my replies to your last post because I think some things are getting missed due to the large wall of text:
I don't understand your concerns with DX here regarding my proposal. In my proposal, the above works just fine and is the same syntax. But, in my proposal, this also works:
So, I think the simple use case is the same DX. |
Beta Was this translation helpful? Give feedback.
-
@jdx regarding complexity of implementation:
Fair enough. However, for the sake of discussion, I want to be clear that in my proposal there are two types of "dependencies":
Now, regarding Dependencies:
Regarding interpolation, I have a hard time seeing how its difficult to just do the resolution in a loop. If you are not wholly opposed to this idea, I'll put together a Python implementation as an example (and maybe prove myself wrong in the process). |
Beta Was this translation helpful? Give feedback.
-
@jdx regarding
:( The TOML specification requires that each key, including the keys for tables, be unique within its scope. I'm not being pedantic here. TOML was created over the course of years to address problems with existing config formats. It works for really sound foundational reasons. Your proposal violates two of them. This is not intuitive. |
Beta Was this translation helpful? Give feedback.
-
@jdx regarding your final assessment of my proposal
|
Beta Was this translation helpful? Give feedback.
-
For those that don't want to read through all these comments and threads but do care about the conclusion, I think this is it: #1523 (reply in thread) |
Beta Was this translation helpful? Give feedback.
-
I'm coming in late to this discussion and just recently started using Rename For example: [environment]
var.FOO = "FOO"
var.BAR = "BAR"
var.FOOBAR = "{{env.FOO}}{{env.bar}}"
# load .env files
dotenv = [".env"]
# source files (make an array to avoid `[[env.source]]`
source = ["./file-source"]
# etc. The main things I think this helps address are:
Couple downsides I see are:
|
Beta Was this translation helpful? Give feedback.
-
I'm a big fan of mise and have used mise/rtx for about a year. 😀 This post might sound a bit rant-y but it is coming from a place of care and respect for this project and its maintainers.
Recently there was some restructuring of environment variable related config.
env_file
becameenv._.file
and some more configs underenv._.*
are on the way. I think this is a poor design decision and it comes at the same time as the name migration which is more churn for users (though I understand the reasoning for the rename and think that was a good idea).Every time someone sees the underscore for the first time, it will lead to "huh, what does that mean?" and you have to go read the docs to find out (answer: it doesn't really mean anything?). The old/flat structure is just easier to read.
env_file
->env._.file
is a loss of clarity. It takes a term that people are familiar with - "Env file" - and effectively chops it into "Env > file" which is not as self-documenting. Alsoenv_file
matches docker compose syntax which many devs are familiar with.The name
env
naturally makes a mental association with.env
files which are a set of env var values and nothing else. But now this label is turning into "environment variables and also a category of things that dynamically set environment variables and maybe some things that can do anything whatsoever (env._.source
). The website currently puts all this under the heading "Environments" which indicates that this is a cohesive category in someone's mind, but to me it is really unclear what that category actually is. There was some talk of maybe putting python venv config underenv
. python venvs are an entirely different thing than env vars. Let's not invent super abstract categories that don't make sense to the common folk users like me.Fewer top-level sections in the config file is not inherently simpler. I would say TOML is actually designed to encourage flat structure for simplicity rather than deeply nested structure. Just because
env
andenv_file
are similar in purpose, doesn't mean they have to be lumped into a hierarchical structure. Hierarchies add another thing to grok.I suspect that a large majority of mise config files will be very very small - like 1-5 lines. Think about this. The esoteric underscore syntax will look especially unnecessary in these cases. I wonder if we've been too focused on all the extreme complex edge cases because those are the uses that tend to appear in new issues and discussions.
Beta Was this translation helpful? Give feedback.
All reactions