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

Support PEP 440 #15

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open

Support PEP 440 #15

wants to merge 6 commits into from

Conversation

tzoiker
Copy link

@tzoiker tzoiker commented Nov 3, 2023

  • Added support for PEP 440
  • Added bump_segment config parameter accepting release (default), dev, post:
    • release: bumps patch (as in <major>.<minor>.<patch>) or the lowest
      • 1 -> 1.0.10
      • 1.0 -> 1.0.10
      • 1.0.2 -> 1.0.12
      • 1.0.0.2 -> 1.0.0.12
    • post: bumps post
      • 1.0 -> 1.0.post10
      • 1.0.post2 -> 1.0.post12
    • dev: bumps dev
      • 1.0 -> 1.0.dev10
      • 1.0.dev2 -> 1.0.dev12
  • More tests

Backward compatibility is broken in terms of code, however, in terms of plugin interface it is not.

@coveralls
Copy link
Collaborator

coveralls commented Nov 3, 2023

Coverage Status

coverage: 86.012% (+1.9%) from 84.091%
when pulling 446d184 on tzoiker:feature/pep-440
into 70ac3b4 on Alviner:main.

@mosquito mosquito requested a review from Alviner November 3, 2023 16:24
Copy link
Owner

@Alviner Alviner left a comment

Choose a reason for hiding this comment

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

Seems lgtm to use pep 440. Let's clean it up a bit and will make a new major release.

print(release)
release[-1] += commit_count
else:
segments[bump_segment.value] = segments[bump_segment.value] or 0
Copy link
Owner

Choose a reason for hiding this comment

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

bump_segment is a StrEnum, does it need to get value from it?


def get_version(self) -> Version:
segments = {
Copy link
Owner

Choose a reason for hiding this comment

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

specify please typed dict to avoid using ingore

if commit_count:
bump_segment = self.settings.bump_segment
if bump_segment == VersionSegmentBumpEnum.RELEASE:
print(release)
Copy link
Owner

Choose a reason for hiding this comment

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

It seems redundant

if self.settings.format == GitVersionFormatEnum.SHORT:
segments["commit"] = None

return Version(**segments) # type: ignore
Copy link
Owner

Choose a reason for hiding this comment

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

why ignore here?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants