Skip to content

Support PEP 440#15

Open
tzoiker wants to merge 6 commits into
Alviner:mainfrom
tzoiker:feature/pep-440
Open

Support PEP 440#15
tzoiker wants to merge 6 commits into
Alviner:mainfrom
tzoiker:feature/pep-440

Conversation

@tzoiker

@tzoiker tzoiker commented Nov 3, 2023

Copy link
Copy Markdown
  • 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

coveralls commented Nov 3, 2023

Copy link
Copy Markdown
Collaborator

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

@Alviner Alviner left a comment

Copy link
Copy Markdown
Owner

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
Copy Markdown
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?

release += [0] * (3 - len(release))

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

Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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