-
Notifications
You must be signed in to change notification settings - Fork 31
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
Adopt nox and hatchling #490
Conversation
df0db32 removes the |
I think so, but only in a follow-up PR :) |
I added a a changelog fragment for the hatchling change but left out the other non user facing changes. |
This comment was marked as outdated.
This comment was marked as outdated.
The noxfile handles running linters, pytest, integration tests, and release automation. It also intelligently handles other antsibull projects. If antsibull-core or antsibull-changelog isn't checked out locally in the parent directory, pip will install it from the Github tarball. The `OTHER_MODE` environment variable can be set to force either `local` installation, installation from `git`, or installation from `pypi`. This is based on antsibull-docs-parser's noxfile. Co-authored-by: Felix Fontein <[email protected]>
The pythonlinters.yml, pythontest.yml, and reuse.yml jobs are replaced with a significantly simpler nox.yml which runs tests and linters with the appropriate Python versions. nox handles installing the dev versions of antsibull-core and antsibull-changelog, so there's no need to check them out manually.
Install the community.general collection in an isolated environment.
Thanks a lot for doing this @gotmax23! |
install(session, "hatch") | ||
session.run("hatch", "publish", *session.posargs) | ||
session.run("git", "push", "--follow-tags") | ||
version = session.run("hatch", "version", silent=True).strip() |
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.
Consider using https://github.com/ofek/hatch-vcs
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'm weird in that I somewhat like hardcoding the version. I prefer to avoid dependencies on a VCS system that are not actually needed. If I rm -rf .git
, pip install .
should still work. Also, I don't like that hatch-vcs pulls in setuptools_scm which pulls in setuptools1. However, if others are really on board with hatch-vcs, I'd consider it.
Footnotes
-
I remember reading somewhere that Ronny was considering splitting out setuptools_scm's backend in a separate package at some point. ↩
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 also prefer having the version hardcoded. (As long as it's hardcoded in only one place :) .)
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.
(With one place, I mean one place inside the file tree of a commit of the repo. And not in the repo tag/branch names.)
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 remember reading somewhere that Ronny was considering splitting out setuptools_scm's backend in a separate package at some point.
That would be interesting. Though, there's https://github.com/mtkennerly/dunamai for that. I probably need to point Ronny at it...
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.
(With one place, I mean one place inside the file tree of a commit of the repo. And not in the repo tag/branch names.)
@felixfontein note that setutools-scm allows writing the version on disk, into a Python file so the source code can still just import it, or read from the dist metadata.
@gotmax23 I don't think there's a reasonable use-case for rm -rf .git
. And installs from sdist and Git archives come with that version placed in the right file anyway.
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.
pip install .
should still work
It would work, just produce a dummy 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.
@gotmax23 I don't think there's a reasonable use-case for
rm -rf .git
.
Yeah, my point was just that I'd prefer if the Python package metadata for the project didn't depend on git tag 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.
What was the reasoning for choosing nox over tox4?
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 guess that it allows a Python configuration file.
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.
Nox is more flexible and I like its Python-based configuration.
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.
@felixfontein @gotmax23 this is why I said tox v4, not tox v3. The maintainer has recently pointed out to me that tox4 supports Python-based configuration too, via toxfile.py
. Though, it does seem to be incomplete, comparing to nox, now that I look at the docs.
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 could not find any documentation about toxfile.py
No description provided.