Skip to content

Best way to handle managing multiple environments in the same project #12821

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

Closed
Mathemmagician opened this issue Apr 10, 2025 · 5 comments
Closed
Labels
question Asking for clarification or support

Comments

@Mathemmagician
Copy link

Question

In a research data science team setting, different members might prefer to use their personal environments when doing research, but also at times be able to quickly switch between others'. What is the best way of structuring this in general? I.e. should we create an envs folder with subdirectories for each env? Assuming there is single one 'data-science-repo'

Platform

No response

Version

No response

@Mathemmagician Mathemmagician added the question Asking for clarification or support label Apr 10, 2025
@ivanbelenky
Copy link

I would say that inconsistencies don't look good, but if deemed completely necessary, UV_PROJECT_ENVIRONMENT is your friend. You can probably create a small bash script to switch between venvs in tandem with preserving state using group dependencies in your pyproject.toml.

I would also suggest/emphasize that different dependencies should be based on functionality and not user preference.

@konstin
Copy link
Member

konstin commented Apr 11, 2025

One option is using uv run --with <...> to test the project plus separate dependencies. Another option is manual venv management with uv venv <name> && . name/bin/activate && uv pip install <...>

@Mathemmagician
Copy link
Author

Mathemmagician commented Apr 11, 2025

I should have also mentioned using conda works great in this case, as environments aren't tied to a project (but the repo does have a envs folder with env .yml files). Maybe I should have framed the question as - is there a conda way of using uv?

And again, this is not a production level repository, rather an exploratory research one

@notatallshaw
Copy link
Collaborator

is there a conda way of using uv?

I think you're looking for the highly requested #1495

I'm pretty sure the answer at the moment is not really. At my work I still use conda to set up multiple global environments, and then uv to install Python packages in those conda environments.

@Mathemmagician
Copy link
Author

I think that's it! Thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Asking for clarification or support
Projects
None yet
Development

No branches or pull requests

4 participants