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(changelog): use base version without tag format by default #653

Merged

Conversation

roggervalf
Copy link
Contributor

@roggervalf roggervalf commented Jul 22, 2023

when release notes are generated, tag version is set instead of baser version. Before breaking change we were having base version format "v{version}" that reflects the actual published version. I think tag formatting is used for avoiding multi packages conflicts in the same repo.

@roggervalf
Copy link
Contributor Author

please @bernardcooke53 when you get some chance 👀

@bernardcooke53
Copy link
Contributor

Was just coming back to this @roggervalf - I'm not the biggest fan of having "one special format" but I agree it's better to keep the old behaviour in place. Functionally the code looks good - thank you for the PR 🙏

I don't think "base_version" is a good name for the method though, I think we should call it as_semver_tag as the convention derives from SemVer 1.0.0. It will be usable by template authors so better to be explicit with naming.

@roggervalf
Copy link
Contributor Author

sounds good to me, let me update it

@roggervalf
Copy link
Contributor Author

@bernardcooke53 it should be addressed

@@ -205,6 +205,9 @@ def __repr__(self) -> str:
def as_tag(self) -> str:
return self.tag_format.format(version=str(self))

def as_base_version(self) -> str:
return "v{version}".format(version=str(self))
Copy link
Contributor

Choose a reason for hiding this comment

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

(just an fyi) you can actually just return f"v{self}", f-strings will automatically format selfwithself.str()if it's defined, and if not it will try to format withself.repr()` - from the docs:

Called by str(object) and the built-in functions format() and print() to compute the “informal” or nicely printable string representation of an object. The return value must be a string object.

and from the PEP , f-string call the builtin format method on expressions:

The expression is then formatted using the format protocol, using the format specifier as an argument. The resulting value is used when building the value of the f-string.

Note that format() is not called directly on each value. The actual code uses the equivalent of type(value).format(value, format_spec), or format(value, format_spec). See the documentation of the builtin format() function for more details.

Copy link
Contributor

@bernardcooke53 bernardcooke53 left a comment

Choose a reason for hiding this comment

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

LGTM

@bernardcooke53 bernardcooke53 merged commit 5984c77 into python-semantic-release:master Jul 26, 2023
7 checks passed
@roggervalf roggervalf deleted the fix-base-version branch July 26, 2023 20:40
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.

None yet

2 participants