-
Notifications
You must be signed in to change notification settings - Fork 145
feat: use hatchling, drop setuptools #1323
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
base: master
Are you sure you want to change the base?
Conversation
f7a43c1
to
27cb9ad
Compare
0d9175a
to
e7d0b60
Compare
4eed882
to
2063c20
Compare
3785324
to
8a314c4
Compare
8a314c4
to
0294825
Compare
0294825
to
332e4c8
Compare
7a2f2b1
to
28ab5b2
Compare
a5a9aca
to
b4b12ce
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.
Looks pretty good! I spent some time looking into hatchling + versioningit, but haven't fully reviewed everything just yet, so here are some preliminary comments:
dd74f06
to
2db92a2
Compare
"towncrier==23.6.0", | ||
"sphinx-notfound-page==0.8.3", | ||
"sphinxext-opengraph==0.9.1", | ||
"versioningit>=3.3.0", |
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.
"versioningit>=3.3.0", | |
"versioningit~=3.3", |
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.
Versioningit is special. It is a build dependency, so it shouldn't be pinned. this matches what we have in build-requires.
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.
build-requires limits it to <4.0, which is what ~=3.3 also effectively does
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.
oh. I should undo that.
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 might be some merit to specifying an upper bound, since this uses a custom template-fields
function:
Moreover, the basic pyproject.toml interface to versioningit can be considered very stable [...]. Nearly all breaking changes will be to the library or custom method API; if you’ve written any code that uses this part of the API, you are advised to declare the next major version of versioningit as an upper bound on your versioningit dependency.
https://versioningit.readthedocs.io/en/stable/notes.html#backwards-compatibility-policy
# Get the version from the Sphinx config | ||
version = self.env.config.version | ||
self.arguments[0] = version | ||
self.arguments[0] = versioningit.get_next_version( | ||
pathlib.Path(__file__).parent.parent.parent | ||
) |
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.
This seems a bit like a hack, we could integrate this a little better with
...
self.arguments[0] = self.env.config.next_version
...
def setup(app):
app.add_config_value("next_version", None, "env", types=[str])
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.
Now that the version gets inferred and isn't being set manually anymore, I believe all the versiontool.py
stuff from this file and create-release-pr.yaml
(as well as the script itself) can be removed
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.
Yeah. I plan to update all of the release pr stuff separately because of the vnext change that also needs to be implemented
Changelog generation and vnext fixing needs to be committed, then tagged.
But I'll be doing this in another pull.
] | ||
|
||
|
||
[tool.check-manifest] |
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.
We obviously don't have a MANIFEST.in
anymore, but could it be worth considering finding a replacement for check-manifest somehow, that at least checks the sdist against a preset list of files we expect in there?
include = [ | ||
"disnake/", | ||
] |
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.
[tool.versioningit.format] | ||
distance = "{base_version}+{distance}.{vcs}{rev}" | ||
dirty = "{base_version}+d{build_date:%Y%m%d}" | ||
distance-dirty = "{base_version}.a{distance}+{vcs}{rev}.d{build_date:%Y%m%d}" |
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.
These don't quite match, making builds of dirty trees use a slightly different format:
clean: disnake-2.11.0+66.g3fe0fa63-py3-none-any.whl
dirty: disnake-2.11.0a66+g3fe0fa63.d20251017-py3-none-any.whl
(note the +66
vs a66
)
params: Dict[str, Any], | ||
) -> Dict[str, Any]: | ||
"""Implements the ``"basic"`` ``template-fields`` method""" | ||
params = copy.deepcopy(params) |
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.
params = copy.deepcopy(params) |
appears to be unused
[tool.versioningit] | ||
default-version = "0.0.0" | ||
|
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.
[tool.versioningit] | |
default-version = "0.0.0" |
If anything goes catastrophically wrong I'd rather know about it, having a default version set will essentially ignore any errors
} | ||
|
||
if parsed_version.pre: | ||
releaselevel = releaselevels.get(parsed_version.pre[0], "final") |
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.
pre[0]
won't work for rc
versions
if description is not None: | ||
fields.update(description.fields) | ||
fields["branch"] = description.branch | ||
if base_version is not None: | ||
fields["base_version"] = base_version | ||
if next_version is not None: | ||
fields["next_version"] = next_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.
The template only uses {version}
and {version_template}
, are these actually needed here?
try: | ||
fields["normalized_version"] = str(packaging.version.Version(version)) | ||
except ValueError: | ||
fields["normalized_version"] = 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.
+1, see previous comment
closes #664