-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Users can no longer rely on sys.path
side-effects with editable installs
#3894
Comments
(FYI: This issue/concern was identified/raised because the latest pip uses the build-backend hooks rather than setup.py based editable installs more often) |
Hi @wesk, thank you very much for the ticket. If I understood correctly there are 2 aspects in play here:
In recent versions of setuptools we improved the editable installation mode to behave more closely to the way a regular installation would happen. If a folder is not included in the regular installation we do our best to not make it available in the editable installation too. In the end of the day, there is no clear indication here why the My conclusion is that there seems to be no action point on the setuptools side, it is only doing its best to make the editable installation as close as possible to the regular installation (while still allowing the Python files to be modified incrementally). If you would like to retain the "add everything to Otherwise, you can use other |
sys.path
side-effects with editable installs
If manipulating If you use relative imports in the scripts inside the examples folder and advise the users to run
You probably can take advantage of Python automatically inserting the working directory into This documentation has more details on how the different ways of running the Python command will interfere with |
I will go ahead and close this issue for now since behaving more like the regular installation and get rid of accidental behaviour was a goal when implementing PEP 660 in setuptools. |
@abravalheri Firstly, I appreciate the tip regarding |
Hi @brupelo, I am not 100% about which change in If the concern is maximum compatibility with IDE autocompletion, I imagine that the best is to design you project directory structure to be a vanilla |
setuptools version
67.6.1
Python version
3.8
OS
Ubuntu and Mac
Additional environment information
No response
Description
Context: I'm one of the maintainers of Syne Tune: https://github.com/awslabs/syne-tune/
Our repository has a top-level
examples/
folder that has example scripts that demonstrate our library's functionality. We do not include theexamples/
folder in our pip-installable bundle. Today the way we recommend that people run the example scripts is to install Syne Tune in editable mode usingpython -m pip install -e .
. Then just runpython examples/<EXAMPLE_SCRIPT.py>
and it works fine.The problem is that with the release of pip
23.1
two days ago, this install pattern stopped working. This broke my team's CI, see for example:We got import errors like the following:
I opened an issue in the
pip
repository: pypa/pip#11972, and as a temporary mitigation they recommended installing thewheel
package, which succeeds in mitigating the issue, see mitigation PR that we merged: syne-tune/syne-tune#626However, as a better root-cause fix, I'm hoping you can comment on the following pypa/pip#11972 (comment):
What is the most correct / long-term way to fix this issue?
Expected behavior
I expect to be able to:
wheel
)How to Reproduce
Note that the behavior only starts with pip
23.1
, released two days ago. The entry in their CHANGELOG / release notes that describes this behavior change is here:Which is in turn picking up the updated setuptools behavior.
Output
The text was updated successfully, but these errors were encountered: