Closed con-f-use closed 1 month ago
Hi @con-f-use, please note that calling setuptools via python setup.py <...>
is a deprecated method, and that is what pip
seems to be doing (in the logs you can see Running setup.py develop for somepackage
). That is probably because this package is triggering pip
's legacy behaviour (due to the absence of pyproject.toml
).
pythont setup.py develop
has a series of well know limitations (e.g. it cannot support package_dir
properly), and it is unlikely we are going to improve on those (specially because it is already deprecated, so it is offered as it is and it will be removed in the future).
Now you can try to add a pyproject.toml
or call pip
using the --use-pep517
flag to trigger the "new behaviour"[^1] and see if that works for you. Please note however that this "new behaviour" is not fully equivalent/backward compatible to python setup.py <...>
, and the original source code might need to be adapted. (The special implication is the "build isolation" as described in pip
's docs and the need to define the build dependencies in pyproject.toml
).
Note however that the "new" editable installation method also have limitations, see https://setuptools.pypa.io/en/latest/userguide/development_mode.html#limitations. If you browse the discussions in the Python Packaging Discourse, you can probably find long threads about editable installs and how there is no bullet proof solution for all use cases and that so far it is impossible to be 100% with a "final installation" while allowing users to change the implementation dynamically.
[^1]: Note that this behaviour is actually several years old already and it was initially defined in PEP 517 (2015). I am calling it "new behaviour" for lack of better words.
setuptools version
69.2.0
Python version
3.11.8
OS
NixOS 23.11
Description
Given the following
setup.py
:Installing a package with multiple entries in
package_dir
results in all but one entry not being importable. That is because the created.egg-link
contains an invalid entry with a relative path:See the console output below for more information on packaging and file-structure. All the files contain a line
print(f"hello from {__file__}")
. This problem occurs with equivalentsetup.cfg
. This might be a bug in pip rather than setuptools, depending on what delivers the content for the egg-link.Expected behavior
Importing modules works the same with editable installs and regular package installs.
How to Reproduce
wheel
,setuptools
andpip
are installed, and activate the venvpip install --editable ./
app_one
--editable
and observe that it can now be importedOutput
Problem with editable installs
Works with regular installs: