Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add an option to not create the activate* scripts in venvs #10070

Open
gdamjan opened this issue Dec 21, 2024 · 4 comments · May be fixed by #10083
Open

Add an option to not create the activate* scripts in venvs #10070

gdamjan opened this issue Dec 21, 2024 · 4 comments · May be fixed by #10083
Labels
configuration Settings and such

Comments

@gdamjan
Copy link

gdamjan commented Dec 21, 2024

Reason: appeal to authority :D
https://x.com/charliermarsh/status/1837538829579796751
https://x.com/mitsuhiko/status/1837539297622110422
… and there seems to be an agreeing sentiment.

I do think that activating venvs is a bad practice, and confusing too, so what I'd want to do to my personal projects is have a setting in [tool.uv] activate-scripts=true/false in pyproject.toml so that uv venv/sync doesn't create them, and I'd want to train my users to use uv run.

Additionally, I should be able to configure that in ~/.config/uv/uv.toml to force the default for projects that don't specify it in their own pyproject.toml.

@gdamjan gdamjan changed the title Add an option to not create the activate* scripts Add an option to not create the activate* scripts in venvs Dec 21, 2024
@zanieb
Copy link
Member

zanieb commented Dec 21, 2024

Sort of compelling. I'm not sure it's a project setting, i.e., it seems more like a user setting? I'd be confused if some repository I cloned wouldn't let me activate the environment.

@zanieb zanieb added the configuration Settings and such label Dec 21, 2024
@nathanscain
Copy link

nathanscain commented Dec 21, 2024

I like this personally. Took a look through the code and might try to work it in the morning (so long as my 9 month old doesn’t have other plans) Never written more than a small coding challenge in rust, but I’d permanently have this setting on so it feels like a nice quality of life bump which is good motivation to learn. If I do have the time, I’ll probably put up a draft pretty quickly in the morning to make sure I’m not entirely off base.

Does uv have a concept of settings that are global/user only but not local/project? An example doesn’t come to mind right now. Personally, there are quite a few options I’d find odd to be set at the project level that (as far as I can tell) uv would have no problem with you configuring in pyproject.toml. My thought would be to add an override flag to uv venv to flip the scripts back on if a dev really wanted them in a project that choose to disable them by default.

@gdamjan
Copy link
Author

gdamjan commented Dec 21, 2024

I'd be confused if some repository I cloned wouldn't let me activate the environment.

yeah I know, I'd still want to enforce that to my users :D

but I'd be satisfied with just per-user setting.

@nathanscain
Copy link

nathanscain commented Dec 21, 2024

@zanieb Please let me know if I'm off base with the change in that PR. Like I said, first time in a large Rust project so I won't be offended if you tell me I broke something.

Looking at adding activatable (default true) to the installer options for the next step. Would that make sense to you?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
configuration Settings and such
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants