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

Adopt nox and hatchling #490

Merged
merged 7 commits into from
Mar 26, 2023
Merged

Conversation

gotmax23
Copy link
Contributor

No description provided.

@gotmax23
Copy link
Contributor Author

df0db32 removes the formatter session from nox for now. Are you okay with enabling black and/or isort like we did for antsibull-docs-parser and re-formatting the project?

@gotmax23 gotmax23 requested a review from felixfontein March 24, 2023 19:19
@felixfontein
Copy link
Collaborator

df0db32 removes the formatter session from nox for now. Are you okay with enabling black and/or isort like we did for antsibull-docs-parser and re-formatting the project?

I think so, but only in a follow-up PR :)

@gotmax23
Copy link
Contributor Author

I added a a changelog fragment for the hatchling change but left out the other non user facing changes.

@gotmax23

This comment was marked as outdated.

pyproject.toml Outdated Show resolved Hide resolved
gotmax23 and others added 6 commits March 25, 2023 16:31
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.
README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
@felixfontein felixfontein merged commit 6dedea5 into ansible-community:main Mar 26, 2023
@felixfontein
Copy link
Collaborator

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()
Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Contributor Author

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

  1. I remember reading somewhere that Ronny was considering splitting out setuptools_scm's backend in a separate package at some point.

Copy link
Collaborator

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 :) .)

Copy link
Collaborator

@felixfontein felixfontein Mar 26, 2023

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.)

Copy link
Member

Choose a reason for hiding this comment

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

  1. 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...

Copy link
Member

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.

Copy link
Member

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.

Copy link
Contributor Author

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.

Copy link
Member

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?

Copy link
Collaborator

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.

Copy link
Contributor Author

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.

Copy link
Member

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.

Copy link
Contributor Author

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

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