-
-
Notifications
You must be signed in to change notification settings - Fork 14.6k
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
Python: editable installation mode for multiple packages #11957
Comments
I understand the motivation, but don't understand the proposed implementation. The Nix store is conceptually immutable, and both |
I don't understand the purposed implementation neither. @FRidh Do you have any prototype or can you explain how this is supposed to work? If currently don't have a solution I would close the issue and reopen if something is "on the way" (even if it is only conceptually). |
Yeah, this is something I really need a solution for but never actually continued with trying to fix. My idea is to have |
Need to think about this more. |
I used to be adept of develop mode on ubuntu. I overrode the shellHook of a python package (a few months ago) and just now realized it removed the develop mode. |
There is a discussion ongoing about standardization of editable installations across backends. One main idea is to build a tiny wheel that points to your project and install that. In our case, we could easily integrate that by adding a |
Sorry for bumping this thread, but this is the only discussion I could find referencing multiple editable installs of Python packages. Has there been any progress on this issue or is it still only possible to install one package as an editable one? If I'm not mistaken, the installation of editable packages has been standardized by PEP 660. |
Yes, PEP 660 was accepted and is widely implemented, e.g. in pip, poetry, hatch and setuptools. Can we re-open this issue? I've seen a bunch of stuff with hatch and poetry2nix regarding develop/editable mode, but there's no documentation or discoverability. |
By default Python packages are built and installed in the Nix store.
buildPythonPackage
has ashellHook
to install a package in editable mode (pip install -e
orpython setup.py develop
) .This requires invoking
nix-shell
in the root of the package source tree. Ashell.nix
file is required in whichbuildPythonPackage
is called. If the root containssetup.py
an editable install is done, bypassing the different phases.This works fine when developing a single package. However, when you're developing multiple packages that need to be accessible from within a single environment, then you cannot install these packages in editable mode. Therefore, what is needed is a way to create a Python environment in which multiple packages can installed in editable mode
Interface
How to define now whether a package should be installed in editable mode? Without considering implementation details yet I thought of the two following ways:
editable
parameter tobuildPythonPackage
. That way, you have maximum flexibility; you simply override a package and set this flag if you want to have an editable installation.editableLibs
parameter tobuildEnv
. Because you will generally want a Python environment, it might make sense to have it here, as it gives you directly an overview of editable installations. A downside would be that contrary to option 1 this doesn't allow any editable installations of packages when used as library in an application.Implementation
editable
parameter forbuildPythonPackage
During a normal installation this parameter would be ignored; the parameter is only relevant for the
shellHook
. However, theshellHook
is only used whenbuildPythonPackage
is called directly in the Nix expression. Therefore ashellHook
inbuildPythonPackage
is not a solution. Perhaps use theinstallPhase
for installing in editable mode in caseeditable=true
?editableLibs
parameter forbuildEnv
This is perhaps the easiest solution. Add an
editableLibs
parameter which calls for each item in the list a function that installs the respective item in editable mode.Nice to have
Editable installations for all packages, not only for those you have the source locally. Obviously, we would need a place then outside of the store to put the editable sources.
Python to-do list: #1819
The text was updated successfully, but these errors were encountered: