-
-
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
[BUG] Setuptools 69.0.3 setup.py develop
generates a .egg-link file with underscores in the name component
#4167
Comments
there is some issue with 69.0.3 and pip and editable installs Python 3.10.9 Directory name: sys_testcases pip list (its not shown as editable) If I change the package name to sys-testcases - it works as expected |
Hi @ichard26, thank you very much for reporting the issue. If I had to guess, I would say this is probably related to the change in #4159, which was motivated by #2522. Probably a previous implementation was optimised to not need a second pass of We could do an extra pass of @jaraco what is your opinion on what is the best approach here? |
We essentially have three options:
No. 1 would lead to the least fallout and is my preferred option, but I have zero stake in this so I'll defer to setuptools and pip developers to decide on the right path forward. |
@jaraco @abravalheri is there any chance you can revert to the previous way of naming |
The pip change is in pypa/pip#12477. The modified egg-link file detection is in src/pip/_internal/utils/egg_link.py. |
My project's constraint autoupdater is affected by this. After bumping setuptools to 69.0.3, subsequent updates with @sbidoul, will the next release of pip include pypa/pip#12477, and will that provide compatibility with setuptools 69.0.3? |
@ablatner yes, it is merged so it will be in the next pip release. |
Apologies for being late to the conversation. It's been a rough couple of months for me personally. I got almost no open source work done during the winter break (where I usually have my most productive period). Here is the design principles I'd like to advocate for:
Yes, probably, and that would honor (3). I think that's what @abravalheri was suggesting. It was unintentional that the name of the metadata path on disk changed. I'm slightly surprised that the test suite didn't manifest failures for this missed expectation. In #4159, I did propose that the behavior could be rolled back if it caused unexpected disruption, which it did, to be followed by a more involved approach. That's still an option. @sbidoul Given the work on pip, what would you like to see from setuptools at this point? |
@jaraco The compatibility work is done in pip indeed. Independently of that, to minimize issues for user who don't have the (yet unreleased) latest pip, I think it would be preferable to preserve the |
This comment was marked as off-topic.
This comment was marked as off-topic.
Now I'm beginning to wonder if the symptom reported by mattip is in fact a completely different issue, as it deals with the name of the wheel (not the egg-link). Therefore, I'm going to explore that concern separately in #4214. |
I've thusfar been unsuccessful in reproducing the issue.
What am I missing to trigger the behavior? |
In your example above pip does a PEP 660 install, so no egg-link is involved. |
Ah, yes. Confirmed. And also confirmed that
|
I've tested with both
Here's what I propose:
|
I had pinned my project to setuptools 69.0.2 until pip was updated to 24.0. |
@ablatner can you provide a reproducer? |
Unfortunately it is in a private corporate repository. Maybe to take a step back, should we expect a difference in package names for the command
|
This seems related: in setuptools 69.5.1, I'm seeing that for a package called I was using ( |
This broke building packages with dashes in their names from source, including this one. As of a recent release of `setuptools`, sdist filenames now are in the format `package_name-<version>.tar.gz` instead of `package-name-<version>.tar.gz` (i.e. underscores in the package name instead of dashes). This is the case even if the package name itself has dashes in it. pypa/setuptools#4214 pypa/setuptools#4167 This change is seemingly deliberate in order to conform to a standard for filenames specifically even though the standard for project names is increasingly to use dashes.
setuptools version
69.0.3
Python version
CPython 3.11.7
OS
Ubuntu 22.04.03 LTS
Additional environment information
No response
Description
Happy New Year! 🎉
I was debugging pip's CI which has been red ever since the release of Setuptools 69.0.3. Most of them are easily fixed by removing the underscore -> dash normalization assumption, however, there is one place where leaving the underscores intact causes issues: legacy editable installs.
As documented in the Setuptools documentation, the distribution name part of egg filenames should be normalized by
safe_name()
:Setuptools does not honour this.1 This is actually fine in most situations as far as I can tell since there are modern ways for pip to discover installed distributions that don't rely on eggs, but
setup.py develop
does not generate this modern metadata. Thus, pip falls back to searchingsys.path
for a.egg-link
file to determine whether a distribution is editably installed. Pip assumes the egg link name will be normalized bysafe_name()
so this logic returns a false negative despiteversion_pkg
being editably installed in fact.If I'm being honest, I have no idea whose problem this is, but this does mean for projects that do not implement PEP 518 and have underscores in their name will not be recognized as editably installed. If this is better transferred to the pip repository, please let me know!
Expected behavior
See above.
How to Reproduce
pip<24
,setuptools==69.0.3
andwheel
.version_pkg
:pip install -e .
in the directorypip freeze
orpip list
and observe that pip doesn't realize it's an editable installversion_pkg
is installed as an editableOutput
Footnotes
Well, if you read the documentation closely, apparently you're supposed to pass the made safe name to
pkg_resources.to_filename()
which would turn the dash back into an underscore but setuptools does not seem to do this anyway /shrug ↩The text was updated successfully, but these errors were encountered: