Conversation
ce75c66 to
4c9f948
Compare
3c45202 to
4a179b0
Compare
|
@oneingan: this PR is a crucial fix to make the (wrapped) python interpreters (which are the base for everything which comes next) behave more |
|
Great work ! Thanks @qbisi . |
|
Jeah really great work @qbisi! |
|
This broke |
Thats expected behavior. now python3.withPackages (ps : []) should have base_prefix=prefix = ${python3.withPackages (ps : [])} |
|
Hey. So if I understand correctly, this was merged into |
The test fix pr: #457133
Just wait for the last staging-next circle before 25.11 release, likely will begin in a week or two. |
No: |
This commit, together with NixOS#442540, changes the way python environments are built: * When generating wrappers for python executables, we inherit argv[0] from the wrapper. This causes python to initialize its configuration in the environment with all the correct paths. * We also resolve argv[0] to absolute path when invoking python from PATH. This helps set python's prefix correctly on Darwin. The end result is that python environments no longer appear to be venvs, and behave more like a vanilla python installation. In addition it's possible to create a venv using an environment and use packages from both the environment and the venv.
This commit, together with #442540, changes the way python environments are built: * When generating wrappers for python executables, we inherit argv[0] from the wrapper. This causes python to initialize its configuration in the environment with all the correct paths. * We also resolve argv[0] to absolute path when invoking python from PATH. This helps set python's prefix correctly on Darwin. The end result is that python environments no longer appear to be venvs, and behave more like a vanilla python installation. In addition it's possible to create a venv using an environment and use packages from both the environment and the venv. (cherry picked from commit abe61db)
This commit, together with #442540, changes the way python environments are built: * When generating wrappers for python executables, we inherit argv[0] from the wrapper. This causes python to initialize its configuration in the environment with all the correct paths. * We also resolve argv[0] to absolute path when invoking python from PATH. This helps set python's prefix correctly on Darwin. The end result is that python environments no longer appear to be venvs, and behave more like a vanilla python installation. In addition it's possible to create a venv using an environment and use packages from both the environment and the venv. (cherry picked from commit abe61db)
This commit, together with NixOS#442540, changes the way python environments are built: * When generating wrappers for python executables, we inherit argv[0] from the wrapper. This causes python to initialize its configuration in the environment with all the correct paths. * We also resolve argv[0] to absolute path when invoking python from PATH. This helps set python's prefix correctly on Darwin. The end result is that python environments no longer appear to be venvs, and behave more like a vanilla python installation. In addition it's possible to create a venv using an environment and use packages from both the environment and the venv.
This commit, together with NixOS#442540, changes the way python environments are built: * When generating wrappers for python executables, we inherit argv[0] from the wrapper. This causes python to initialize its configuration in the environment with all the correct paths. * We also resolve argv[0] to absolute path when invoking python from PATH. This helps set python's prefix correctly on Darwin. The end result is that python environments no longer appear to be venvs, and behave more like a vanilla python installation. In addition it's possible to create a venv using an environment and use packages from both the environment and the venv. (cherry picked from commit abe61db)
This commit, together with NixOS#442540, changes the way python environments are built: * When generating wrappers for python executables, we inherit argv[0] from the wrapper. This causes python to initialize its configuration in the environment with all the correct paths. * We also resolve argv[0] to absolute path when invoking python from PATH. This helps set python's prefix correctly on Darwin. The end result is that python environments no longer appear to be venvs, and behave more like a vanilla python installation. In addition it's possible to create a venv using an environment and use packages from both the environment and the venv. (cherry picked from commit abe61db)
This pr should fix the problem of not having sitePackages provided by nix python-env when building virtual python environment from it. See https://discourse.nixos.org/t/how-to-build-python-virtualenv-with-packages-provided-by-python3-withpackages/24766.
It is a continuation of #297628 by @cwp. The original pr got reverted for the wrapping/unwrapping behavior.
And it also cause a regression building pypy3.
Related issue
Diff compared to #297628
We still keep sitecustome.py for wrapping possible binary executable linked to python libraries (e.g. netgen in pyton3Packages.netgen-mesher). Avoid hacky wrapping/unwrapping python scripts.
We apply "--inherit-argv0
--resolve-argv0" only when wrapping python executable. The wrapping option "--inherit-argv0--resolve-argv0" might be danguouse and cause different behavior, e.g. the unfixed {pypy2,pypy3}.withPackages won't start with inherited argv0 as the main executable under bin symlink to subdirectory and it will fail to find its library, see Build failure: pypy3 #301498 and pypy: fix installPhase #442224. # (as far as i have tested, we dont need --resolve-argv0)with the third commit now both python-env python-venv resolve sys.base_prefix to the real path, so we can create a python-venv indepependant of how we call the python-env's python. And make sure the python-venv's python exectuable symlinks directly to nix storeThere was an attempt trying to resolve argv0's dirname to its' realpath.Before
After
Packages build and tested (on x86_64-linux and aarch64-darwin)
Things done
passthru.tests.nixpkgs-reviewon this PR. See nixpkgs-review usage../result/bin/.Add a 👍 reaction to pull requests you find important.