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

Transition tooling to hatch #32

Merged
merged 6 commits into from
Sep 18, 2024
Merged

Transition tooling to hatch #32

merged 6 commits into from
Sep 18, 2024

Conversation

stumpylog
Copy link
Contributor

@stumpylog stumpylog commented Sep 15, 2024

Description

As an alternative to nox or tox, use hatch to provide both the testing, linting, documentation building, and release building.

  • hatch run lint:check
    • Runs flake8 against the codebase
    • Eventually could be replaced by hach fmt which uses ruff. Wasn't sure if you wanted to keep formatting, etc for ease of merging anything from Whitenoise
  • hatch test
    • Runs the test matrix using the system Python
    • Select a Python version and all Django versions that supports: hatch test --python 3.10
    • Select a Python version and Django version hatch test --python 3.10 --include "django=5.1,4.2"
  • hatch run docs:build - builds the documentation site

Closes #17

Checklist

Please update this checklist as you complete each item:

  • Tests have been developed for bug fixes or new functionality.
  • The changelog has been updated, if necessary.
  • Documentation has been updated, if necessary.
  • GitHub Issues closed by this PR have been linked.

By submitting this pull request I agree that all contributions comply with this project's open source license(s).

@stumpylog stumpylog marked this pull request as ready for review September 15, 2024 21:14
Copy link
Owner

@Archmonger Archmonger left a comment

Choose a reason for hiding this comment

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

Thank you for the PR!

This PR will move forward after resolving a couple of nitpicks.

pyproject.toml Outdated Show resolved Hide resolved
pyproject.toml Outdated Show resolved Hide resolved
pyproject.toml Outdated Show resolved Hide resolved
.pre-commit-config.yaml Outdated Show resolved Hide resolved
- name: Build
run: |
hatch build --clean
# TODO: Update trusted publishing with pypa/gh-action-pypi-publish
Copy link
Owner

@Archmonger Archmonger Sep 15, 2024

Choose a reason for hiding this comment

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

I don't mind making the switch to pypa/gh-action-pypi-publish within this PR, since we're already touching this file anyways

EDIT: Looks like there might be a bit that goes into getting that workflow running - We can skip it for now if it's too involved.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, it would take some work on PyPi (https://docs.pypi.org/trusted-publishers/).

I was thinking to do that in a separate PR, this on was growing enough already! Perhaps doing some updates to create a GitHub release with artifacts, publish, etc, on the creation of a semver tag? Since this uses Keep a Changelog, even that can be pulled out automatically and added to the release

Copy link
Contributor Author

Choose a reason for hiding this comment

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

As an idea of how I suggest updating the actions, I use this flow: https://github.com/stumpylog/gotenberg-client/actions/runs/10653499633

Basically, the checks like tests, documentation and building a wheel/sdist always run, then a release to Github and Pypi run when a tag is created to do those only on a tag. This would also include publishing the versioned documentation.

If that sounds alright, I'm happy to work on it (in a separate PR)

Copy link
Owner

Choose a reason for hiding this comment

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

Unless I'm misunderstanding your comment, that is effectively what is currently being done in this repo but in an event driven fashion rather than polling on each merge.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You still need to manually create the release, attach artifacts and update the change log right? I don't see anything handling that.

My own preference is to simply push a tag and let the jobs handle that based on what was pushed, and only after that double check of testing, building, etc

Copy link
Owner

Choose a reason for hiding this comment

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

Ahhh okay I understand your point - Yeah manually creating the GH releases is unnecessary manual labor. If we can automate that would be fantastic.

Copy link
Owner

@Archmonger Archmonger left a comment

Choose a reason for hiding this comment

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

I'm going to push one more nitpick onto this PR before merging.

Since this PR adds additional tooling to the repository, I'd like that to be documented.

I left stubs in the docs to remind myself to create them with the eventual CI overhaul PR - and it looks like that time is now.

It doesn't need to be anything fancy or detailed, but it needs to give the minimum explanation of

  • Cloning the repo
  • Creating an environment where the tests can run
  • Demonstrate how to use the CLI commands that can execute the tests

For example, I was originally planning on using the code.md and docs.md in one of my other repos as a template, but you're free to structure the docs however you'd like.

@stumpylog
Copy link
Contributor Author

I have taken a stab adding some documentation for both code and documentation, with examples of how to run commands I think will be useful.

@Archmonger
Copy link
Owner

There are several spelling errors in the docs according to the tests.

@stumpylog
Copy link
Contributor Author

Spelling is always my bane... I think its all resolved now. Once this is good, i can squash it all down (or do it when merging)

@Archmonger Archmonger merged commit 17d49f9 into Archmonger:main Sep 18, 2024
10 checks passed
@Archmonger
Copy link
Owner

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.

Replace Tox test suite with an alternative
2 participants