Skip to content
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

Use the project name to look up constraints #9241

Merged

Conversation

uranusjr
Copy link
Member

@uranusjr uranusjr commented Dec 7, 2020

Fix #9232.

User-specified constraints only contain the project name without extras, but a constraint a project A would also apply to A’s extra variants. This introduces a new project_name property on Requirement and Candidate classes for this lookup.

# type: () -> str
"""The normalised name of the project the candidate refers to"""
if self._name is None:
self._name = canonicalize_name(self.dist.project_name)
return self._name

name = project_name
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

D’uh. Seems like Mypy is not smart enough for this.

User-specified constraints only contain the project name without extras,
but a constraint a project A would also apply to A's extra variants.
This introduces a new project_name property on Requirement and Candidate
classes for this lookup.
@uranusjr uranusjr force-pushed the new-resolver-constraint-affects-extra-entry branch from 87adddb to e2fb3e1 Compare December 8, 2020 08:32
Copy link
Member

@pradyunsg pradyunsg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm wondering if we should change "name" to "identifier" or something more general like that, to denote that it's a separate concept.

news/9232.bugfix.rst Outdated Show resolved Hide resolved
@pradyunsg
Copy link
Member

Merging since I'd like to include this in the upcoming bugfix. @pfmoore Holler if there's any concerns. :)

@pradyunsg pradyunsg merged commit 7c00e6f into pypa:master Dec 8, 2020
@pradyunsg pradyunsg added this to the 20.3.2 milestone Dec 8, 2020
@uranusjr
Copy link
Member Author

uranusjr commented Dec 8, 2020

I'm wondering if we should change "name" to "identifier" or something more general like that.

I though the same when I worked on this (maybe we should’ve name the property identifier in the beginning). But that refactoring would be pretty involved, so better not risk breaking 20.3.2 which would further make the resolver adoption plan more complex than it already is.

@mik-laj
Copy link

mik-laj commented Dec 8, 2020

I confirm that this release allows me to install Apache Airflow with extra = [google] but still can't install Airflow with [devel, google]

Here is the installation log: https://pastebin.com/g3bVyfwW
I also have code prepared to test other changes automatically.
https://github.com/mik-laj/airflow-pypi-regession
I can test different versions of PyPI and libraries if it will be helpful for someone.

@pfmoore
Copy link
Member

pfmoore commented Dec 8, 2020

Merging since I'd like to include this in the upcoming bugfix. @pfmoore Holler if there's any concerns. :)

No problem from me - sorry I haven't had time to review.

@uranusjr uranusjr deleted the new-resolver-constraint-affects-extra-entry branch December 9, 2020 03:06
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 5, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Unnecessary downloading of dependencies when they are constrained
4 participants