-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Adding an editable install function for the build-system API #6950
Comments
Given that we can't make a unilateral decision, and this would need input and discussion from a larger audience, it may be more effective to start or find a discussion on discuss.python.org to get feedback. There are several there already, but I couldn't find an authoritative-looking thread where people are following up on the PEP517 note regarding editable installs. |
For future readers: The most relevant discussion I can find is https://discuss.python.org/t/specification-of-editable-installation/1564. |
To reiterate what @chrahunt said, this is a multi project, interoperability specification. Thus, this needs much broader discussion and Packaging category on discuss.python.org is likely the best place for moving this forward. There are a lot of the details here to figure out so, know that it'll take a fair amount of effort and time to get this done. That's just the nature of a packaging ecosystem that's almost completely maintained by folks on a volunteer basis. |
Since there's no action for pip here I will close this issue. Anyone interested should participate in the discussions linked above. |
What's the problem this feature will solve?
Currently, pip does not support editable installs for build systems using pyproject.toml
instead of setup.py.
For example, in a project that uses Poetry, I get an error when I try to install editable.
The
pip install -e <path>
command is useful in cases where I want to make frequent updates to a package while using it from another environment.A proposal
PEP 517 defines a build-system API that provides several hooks, such as
build_wheel()
andbuild_sdist()
, and some additional optional hooks. I propose that specification beexpanded to include an optional function:
The function should create an egg-link file as described in the setuptools docs.
An alternative specification could instead return path to the package source's parent directory, and pip could build the egg-link itself.
A third would be to leave it up to the build system how it wants to implement editable installs, but I'm not sure what that would mean in practice.
Alternative Solutions
Poetry could create a setup.py for use by pip, which users could check into version
control. This means the build backend is once again coupled to setuptools, which is
contrary to the intent of PEP 517.
Another workaround is to activate a virtualenv,
cd
to the Poetry project's directory, and runpoetry install
there. With a virtualenv activated, Poetry will detect the environment bychecking
$VIRTUALENV_ENV
and install into that environment rather than creating a newvirtualenv like it normally would. If a virtualenv's pip is used without activating, it might be detectable using
sys.real_prefix
, but then the user's intent is less clear about whether Poetry should create a new virtualenv.This workaround is non-obvious and would require explanation for each user. It would be
easier if we could just use
pip install -e /path/to/project
like normal.An alternative solution is to just use the regular installation code path but pass
-e
inthe
config_settings
dict. However, if the build system does not support that option, itwould probably fail silently by installing in non-editable mode. It is better to be
informed that the editable build failed, which means there should be an explicit API for
pip to check. If the builder does not provide the
editable_install()
function, pip canraise an exception itself.
Additional context
/cc @sdispater (Poetry) @takluyver (Flit) in case you have thoughts on this.
The text was updated successfully, but these errors were encountered: