-
Notifications
You must be signed in to change notification settings - Fork 122
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
♻️ Remove incremental #627
Conversation
a037030
to
dd20edf
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Many thanks for picking up on this.
I just did a quick review before approving the CI run.
I have not yet fully reviewed the automated tests.
RELEASE.rst
Outdated
@@ -19,9 +19,9 @@ The same branch is used for the release candidated and the final release. | |||
In the end, the release branch is merged into the main branch. | |||
|
|||
Update the version to the release candidate with the first being ``rc1`` (as opposed to 0). | |||
In ``src/towncrier/_version.py`` the version is set using ``incremental`` such as:: | |||
In ``pyproject.toml`` the version is set like:: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was hoping that we can set the version in single place, like src/towncrier/_version.py
and the build system can automatically extract the version from there.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The changes in doc
were recycled but now they are no longer relevant. Reverted
docs/conf.py
Outdated
@@ -29,13 +29,13 @@ | |||
# Add any Sphinx extension module names here, as strings. They can be | |||
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom | |||
# ones. | |||
import importlib.metadata as importlib_metadata |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not just use from towncrier import __verison__
or something similar ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The changes in doc
were recycled but now they are no longer relevant. Reverted
src/towncrier/_project.py
Outdated
raise Exception( | ||
f"No __version__ or metadata version info for the '{package}' package." | ||
) | ||
try: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I this change needed ?
I was thinking that this was sorted out in #502
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, I think it's just a merge artifact. Reverted
src/towncrier/_shell.py
Outdated
import click | ||
|
||
from ._version import __version__ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not keep the import ?
It's just that now __version__
will be a simple text.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
|
||
|
||
class TestPackaging(TestCase): | ||
def test_version_warning(self): | ||
def test_version_attr(self): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure why this change is needed.
The previous test look good enough to me. :)
I am misssing something ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The previous test was checking for the presence of an Incremental Version object (which obviously no longer exists in towncrier)
I've replaced it with a test to assert that a DeprecationWarning
is present
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the changes.
They look good.
I left a few minor comments.
In order to merge this, the mypy
checks must pass.
Also the coverage must pass
src/towncrier/_project.py 52 1 18 1 97% 90, 104->exit
version = getattr(module, "__version__", None) | ||
# Incremental has support for package names, try duck-typing it. | ||
with contextlib.suppress(AttributeError): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that we are missing a brach test here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The miss indicator was a bit confusing for me, should be gone now hopefully
version = str(version.base()).strip() | ||
# Incremental uses `X.Y.rcN`. | ||
# Standardize on importlib (and PEP440) use of `X.YrcN`: | ||
return version.replace(".rc", "rc") # type: ignore |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know why coverage is reporting this line as not covered.... we need to check
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was an indentation problem with a test, fixed now
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks, mypy and coverage should be passing now
version = getattr(module, "__version__", None) | ||
# Incremental has support for package names, try duck-typing it. | ||
with contextlib.suppress(AttributeError): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added
|
||
|
||
class TestPackaging(TestCase): | ||
def test_version_warning(self): | ||
def test_version_attr(self): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The previous test was checking for the presence of an Incremental Version object (which obviously no longer exists in towncrier)
I've replaced it with a test to assert that a DeprecationWarning
is present
version = str(version.base()).strip() | ||
# Incremental uses `X.Y.rcN`. | ||
# Standardize on importlib (and PEP440) use of `X.YrcN`: | ||
return version.replace(".rc", "rc") # type: ignore |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was an indentation problem with a test, fixed now
@adiroiban just to know a timeline, is there any ETA on the next release that could include this change? This is just a question, no pressure |
We can do a release. the important part is to have someone who cares for a new release and has some time to test the release |
Thanks for fixing all the checks. As part of this PR we need to update the RELEASE.rst ... if we just merge, the information for RELEASE.rst will no longer be valid I now see that RELEASE.rst changes were removed from this PR My hope was that with this PR we can have
|
I made a few small changes to the PR description... the important one is linking to the issue, so that when we merge this PR, the issue is automatically closed. |
Ok, I'm a bit confused admittedly because in the prior MR it was stated explicitly to keep the version file. Here: #491 (comment) If we still want to move to pyproject.toml I'd prefer to do that in a separate MR. What do you want changed in RELEASE.rst ? Should I update the version as well or is that done by the release manager? |
Right now the content of the RELEASE.rst is Lines 21 to 24 in 4b58be5
I think it should change to Update the version to the release candidate with the first being ``rc1`` (as opposed to 0).
In ``src/towncrier/_version.py`` the version is set using PEP440 a compliant string, such as::
__version__ = "24.7.0rc1" This revert is not quite OK 2cf4e76 Instead of updating the pyproject.toml we update the We no longer want to use But I understand your concern. The question is where to store the version:
Since the version was already stored in In a separate PR we can consider moving it inside |
Ok my bad, I guess it only needed some changes instead of a revert. RELEASE.rst is updated. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Many thanks for the update.
I did a few change to release.rst
There was a section underline mismatch ... so I start doing the edit and then I realized that 19.9.0 is a better example as it shows that we don't add leasing 0 in the version ... but we use ISO date format with leading zero.
I have enabled auto-merge on this. and once this is merge I plan to do a new release. Thanks again. I am very happy to see that we no longer use incremental. |
Description
Fixes #308
This removes the dependency on
incremental
ontowncrier
itself, while keeping support for detectingincremental
version in projects for which towncrier is used to build the release notes.Checklist
src/towncrier/newsfragments/
. Describe yourchange and include important information. Your change will be included in the public release notes.
docs/tutorial.rst
is still up-to-date.docs/cli.rst
reflects those changes.docs/configuration.rst
reflects those changes.