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

Fix cases where poetry should fall back to pep517 metadata parsing #2957

Merged
merged 5 commits into from
Sep 27, 2020

Conversation

finswimmer
Copy link
Member

@finswimmer finswimmer commented Sep 24, 2020

#2761 discovered cases where poetry should fall back to pep517 to read metadata.

According to the docs of setup.cfg the version can be specified by linking to an attribute in a module by using attr: somemodule:__version__. At the moment poetry will extract this literally and will try to parse it later, when it cannot fall back to pep517. This PR changes it, by trying to parse the version at the moment of extracting from the setup.cfg. If it failes a ParseVersionError is thrown and poetry will fallback to pep517 parsing.

The second case appears if requirements and name or version (but not both) can be extracted from either setup.py or setup.cfg. name and version are mandatory information. If poetry cannot find any requirements, it cannot differ whether there are no or it was unable to parse it. So poetry should fall back to pep517 whenever any of these values are missing.

Pull Request Check List

Resolves: #2761

  • Added tests for changed code.
  • Updated documentation for changed code.

@finswimmer finswimmer force-pushed the issue-2761-version-setup-cfg branch 2 times, most recently from d5f5cbe to 5af22a5 Compare September 24, 2020 18:31
…wn when reading version from setup.cfg that uses `attr:`
…ion` could not be determined from setup files
…, requires_dist could not be determined from setup files
@finswimmer finswimmer changed the title parse version found in setup.cfg Fix cases where poetry should fall back to pep517 metadata parsing Sep 25, 2020
@finswimmer finswimmer marked this pull request as ready for review September 25, 2020 06:30
@finswimmer finswimmer requested a review from a team September 25, 2020 06:30
@abn
Copy link
Member

abn commented Sep 25, 2020

@finswimmer can we also add a case in the info test suite to ensure that pep517 build was called?

…ggered if mandatory metadata cannot be read from setup-py/setup.cfg
@finswimmer
Copy link
Member Author

@abn Done.

@abn abn added the kind/bug Something isn't working as expected label Sep 27, 2020
@abn abn added this to the 1.1 milestone Sep 27, 2020
@abn abn merged commit 46623d5 into python-poetry:master Sep 27, 2020
@sdispater sdispater mentioned this pull request Sep 30, 2020
Copy link

github-actions bot commented Mar 1, 2024

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 1, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
kind/bug Something isn't working as expected
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Unable to retrieve the package version for git on preview 1.1.0b2
2 participants