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(versioning/poetry): improve poetry prerelease version handling #11733

Merged
merged 24 commits into from Oct 22, 2021

Conversation

jvansanten
Copy link
Contributor

@jvansanten jvansanten commented Sep 14, 2021

Changes:

Update the poetry versioning scheme to explicitly parse versions using the same regex and normalization rules as poetry itself, and reemit them in SemVer format before kicking down to the npm versioning scheme. The normalization is applied in reverse before returning.

Context:

Poetry accepts a union of SemVer and PEP440, normalizing certain prerelease tags like alpha -> a, preview -> rc in its internal representation. Since packages published to PyPI use PEP440 versions, this means that a version requirement "^0.8.0-alpha.1" should be updated to "^0.8.0-alpha.2" under the replace rule when a version "0.8.0a2" is published to PyPI. In the previous implementation, PEP440-named releases were simply filtered out.

See also:

Documentation (please check one with an [x])

  • I have updated the documentation, or
  • No documentation update is required

How I've tested my work (please tick one)

I have verified these changes via:

  • Code inspection only, or
  • Newly added/modified unit tests, or
  • No unit tests but ran on a real repository, or
  • Both unit tests + ran on a real repository

Poetry accepts a union of SemVer and PEP440, normalizing certain
prerelease tags like alpha -> a, preview -> rc in its internal
representation.  Since packages published to PyPI use PEP440 versions,
this means that a version requirement "^0.8.0-alpha.1" should be
updated to "^0.8.0-alpha.2" under the `replace` rule when a version
"0.8.0a2" is published to PyPI.

To accomplish this, update the poetry versioning scheme to explicitly
parse versions using the same regex and normalization rules as
poetry itself, and reemit them in SemVer format before kicking down
to the npm versioning scheme. The normalization is applied in
reverse before returning.
@jvansanten jvansanten changed the title Support prerelease packages published to PyPI with Poetry feat: Support prerelease packages published to PyPI with Poetry Sep 14, 2021
@jvansanten jvansanten changed the title feat: Support prerelease packages published to PyPI with Poetry fix: Support prerelease packages published to PyPI with Poetry Sep 14, 2021
@jvansanten jvansanten changed the title fix: Support prerelease packages published to PyPI with Poetry fix(poetry): Support prerelease packages published to PyPI with Poetry Sep 14, 2021
Copy link
Member

@viceice viceice left a comment

Choose a reason for hiding this comment

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

Great work so far ❤️

lib/versioning/poetry/index.spec.ts Outdated Show resolved Hide resolved
lib/versioning/poetry/index.spec.ts Outdated Show resolved Hide resolved
lib/versioning/poetry/index.spec.ts Outdated Show resolved Hide resolved
lib/versioning/poetry/index.spec.ts Outdated Show resolved Hide resolved
lib/versioning/poetry/index.spec.ts Outdated Show resolved Hide resolved
lib/versioning/poetry/index.spec.ts Outdated Show resolved Hide resolved
lib/versioning/poetry/index.spec.ts Outdated Show resolved Hide resolved
lib/versioning/poetry/index.ts Outdated Show resolved Hide resolved
lib/versioning/poetry/index.ts Outdated Show resolved Hide resolved
lib/versioning/poetry/index.ts Outdated Show resolved Hide resolved
@viceice viceice changed the title fix(poetry): Support prerelease packages published to PyPI with Poetry fix(versioning/poetry): improve proetry prerelease version handling Sep 14, 2021
Co-authored-by: Michael Kriese <michael.kriese@visualon.de>
lib/versioning/poetry/readme.md Outdated Show resolved Hide resolved
jvansanten and others added 2 commits September 14, 2021 16:33
Co-authored-by: HonkingGoose <34918129+HonkingGoose@users.noreply.github.com>
lib/versioning/poetry/index.spec.ts Outdated Show resolved Hide resolved
@viceice viceice changed the title fix(versioning/poetry): improve proetry prerelease version handling fix(versioning/poetry): improve poetry prerelease version handling Sep 15, 2021
lib/versioning/poetry/index.spec.ts Outdated Show resolved Hide resolved
lib/versioning/poetry/index.spec.ts Outdated Show resolved Hide resolved
lib/versioning/poetry/index.spec.ts Outdated Show resolved Hide resolved
lib/versioning/poetry/transform.ts Outdated Show resolved Hide resolved
HonkingGoose
HonkingGoose previously approved these changes Sep 15, 2021
Copy link
Collaborator

@HonkingGoose HonkingGoose 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 happy with the docs. I'll leave code review to the maintainers. 😉

@rarkins
Copy link
Collaborator

rarkins commented Sep 16, 2021

@jvansanten I just saw this PR. What a great first-time contribution!

@jvansanten
Copy link
Contributor Author

@jvansanten I just saw this PR. What a great first-time contribution!

Thanks! I just fixed up a few extra nits reported by codecov and type-check.

Older releases of matplotlib (e.g.  0.98.5.1) use PEP440-style
release segments of arbitary length.  There is no clean mapping
from the post-patch segments to SemVer, but this style seems fairly
rare and safe to ignore.
@HonkingGoose
Copy link
Collaborator

HonkingGoose commented Sep 29, 2021

I think we're hitting a merge conflict because the tests now use the Jest table format due to PR: #11931

This reverts commit b585c54 (due
to overeager use of `yarn version` for a local deployment)
@jvansanten
Copy link
Contributor Author

I think we're hitting a merge conflict because the test now use the Jest table format due to PR: #11931

Ugh, okay, will fix up.

@rarkins
Copy link
Collaborator

rarkins commented Oct 22, 2021

Looks like it needs coverage

@rarkins rarkins marked this pull request as draft October 22, 2021 07:27
@jvansanten jvansanten marked this pull request as ready for review October 22, 2021 10:22
@rarkins rarkins requested a review from zharinov October 22, 2021 11:40
lib/versioning/poetry/patterns.ts Outdated Show resolved Hide resolved
lib/versioning/poetry/patterns.ts Outdated Show resolved Hide resolved
rarkins
rarkins previously approved these changes Oct 22, 2021
Copy link
Member

@viceice viceice left a comment

Choose a reason for hiding this comment

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

just a small styling issue

lib/manager/poetry/extract.ts Outdated Show resolved Hide resolved
lib/manager/poetry/extract.ts Outdated Show resolved Hide resolved
@rarkins rarkins merged commit a0b8b52 into renovatebot:main Oct 22, 2021
@renovate-release
Copy link
Collaborator

🎉 This PR is included in version 28.8.4 🎉

The release is available on:

Your semantic-release bot 📦🚀

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 22, 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.

None yet

5 participants