Replies: 5 comments 26 replies
-
I'll be truly shocked if anyone picks the first option here. If you really think that's the solution you're going to need to back it up :) |
Beta Was this translation helpful? Give feedback.
-
Isn't |
Beta Was this translation helpful? Give feedback.
-
Adding a setting with default being disabled would be fine (option no. 3) IMO. This is the option I am voting for. However, I just had a different thought. I did not follow development for some time (just used it as is, until rename brought me back to this repo) so I did not know that there is not experimental support for tasks. As far as I understand, tasks are not executed directly. However, if there is a way to:
Then special handling of python virtual environments could boil down to something like: [tasks.pyvenv]
description = 'Create and activate virtual env'
# you can specify a multiline script instead of individual commands
run = """
#!/usr/bin/env bash
[ ! -d venv ] && python -m venv .venv
source .venv/bin/activate
"""
export_vars = ["VIRTUAL_ENV", "PATH"]
run_on = ["enter"] Of course, example above does not work now ( Again, I have no idea what the roadmap for tasks feature is, but I have a filling it could be helpful here and leave only bare python version management for |
Beta Was this translation helpful? Give feedback.
-
wow unanimous so far. So I'll go with disabling by default unless some config is set. I think with this in place I think I'm finally ready to label it as non-experimental anymore. Follow-up question though: what setting do you plan to use? |
Beta Was this translation helpful? Give feedback.
-
My 2 cts: I think moving this to Adding By consistency with the environment variable [tools]
python = "3.7"
[python]
virtualenv = ".venv" I think it's more scalable for both other Python specific options or other plugin that will for sure have some specific fine-tuning to add later. It also respects separation of concerns. Note that while part of virtualenv management is about hijacking some environment variables, it's not just that. How can I specify that I want to have system-packages in the venv ? Another special syntax ? The dedicated section allows this:
This would be harder to handle with special env processing. In the case of Python, adding some At last having a dedicated section with explicit options make it possible to have a clear schema for completion or validation. And I didn't raise the fact that it introduce an order and precedence issue: when does the venv get activated: before env, after env processing, at the same time that other variables... ? Note: having the possibility to have [env]
SOME_VAR_THAT_MIGHT_BE_NEEDED_BEFORE_ACTIVATION = "value"
[tool]
python = "3.11"
[python]
virtualenv = ".venv"
[lazyenv] # just for the example, naming TBD
SOME_VAR = "{{ env.VIRTUAL_ENV }}/some/extra/path" |
Beta Was this translation helpful? Give feedback.
-
When I built the venv autoactivate I copied direnv's behavior which creates the venv or runs
poetry install
if it hasn't been done yet. I'm wondering if this is what we want though. Would it be simpler if rtx didn't do this and instead just activated an existing venv?To be clear, I'm proposing removing the "creation" step, not the automatic activation (which I know is well liked). The creation is often the source of problems. Basically removing the
python -m venv
step and showing a warning if it doesn't exist.Perhaps this could go behind a setting like
MISE_PYTHON_VENV_AUTO_CREATE
defaulting to disabled?My thinking here is that because I'm not a python developer I often get the logic around venvs wrong. I'm simply not the best person to lead a project for python DX (just an unfortunate reality). I'm thinking rather than me make mistakes, just have mise do a bit less so I don't get the logic incorrect. I feel like probably 25% of mise issues are venv related. I often will fix it in one place but break it in another.
I'm leaning towards doing this over not doing this, maybe with some sort of tbd deprecation message. I very much welcome input from python users though.
On a related note, I also plan to move this config from the
[tools]
section to the[env]
section like this:My thinking this is more of an "environment" config and mostly unrelated to the tool (they are called "virtual environments" after all). This will also make it possible to use it with the system python which can't work in
[tools]
without significantly changing the meaning of the term "system" in mise.Related issues:
23 votes ·
Beta Was this translation helpful? Give feedback.
All reactions