astral-sh / rye

a Hassle-Free Python Experience
https://rye.astral.sh
MIT License
13.49k stars 460 forks source link

Support for system-site-packages #925

Open Edgeworth opened 5 months ago

Edgeworth commented 5 months ago

In poetry, you can set system-site-packages=true in poetry.toml so virtualenvs are created with access to the system site packages directory. This can be useful if you have a complex package that does not install or work well in virtualenv.

For example, my use case is that I am using tensorflow both in python and via the C API, so to avoid issues I need the tensorflow version and build to be exactly the same between my OS and what python uses.

It looks like uv supports system-site-packages: https://github.com/astral-sh/uv/issues/2038 https://github.com/astral-sh/uv/pull/2101

Is this supported in rye? Maybe I have missed something. Thanks!

ischaojie commented 5 months ago

Rye does not currently support it, but it seems to make sense. Rye may also need to provide a configuration to enable this option?

Edgeworth commented 5 months ago

Thank you for working on this. Looks like in the latest iteration of the above PR, it can be specified via pyproject.toml per project. This definitely works for my use case.