Adding an editable install function for the build-system API #6950
Labels
auto-locked
Outdated issues that have been locked by automation
C: PEP 517 impact
Affected by PEP 517 processing
PEP implementation
Involves some PEP
state: needs discussion
This needs some more discussion
type: feature request
Request for a new feature
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
setup.py bdist_wheel
mechanism for building projects #6334/cc @sdispater (Poetry) @takluyver (Flit) in case you have thoughts on this.
The text was updated successfully, but these errors were encountered: