-
-
Notifications
You must be signed in to change notification settings - Fork 3
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
Changes from 1 commit
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
0a66eec
Transitions all possible items to use hatch and modern configuration
stumpylog 633d6d4
Updates for PR comments
stumpylog 6635a45
Removes pre-commit default Python language and adds environment to ru…
stumpylog e899e19
Removes 3.8 from matrices
stumpylog 39fd37b
Adds documentation for how to contribute code or documentation updates
stumpylog 0fcd3ec
Fixes some spelling and adds a few words to the dictionary
stumpylog File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,12 +14,14 @@ jobs: | |
- uses: actions/setup-python@v5 | ||
with: | ||
python-version: 3.x | ||
- run: pip install -r requirements/build-docs.txt | ||
cache: pip | ||
- name: Install dependecies | ||
run: | | ||
pip install --upgrade hatch uv | ||
- name: Publish Develop Docs | ||
run: | | ||
git config user.name github-actions | ||
git config user.email [email protected] | ||
cd docs | ||
mike deploy --push develop | ||
hatch run docs:develop | ||
concurrency: | ||
group: publish-docs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,12 +14,14 @@ jobs: | |
- uses: actions/setup-python@v5 | ||
with: | ||
python-version: 3.x | ||
- run: pip install -r requirements/build-docs.txt | ||
cache: pip | ||
- name: Install dependecies | ||
run: | | ||
pip install --upgrade hatch uv | ||
- name: Publish ${{ github.event.release.name }} Docs | ||
run: | | ||
git config user.name github-actions | ||
git config user.email [email protected] | ||
cd docs | ||
mike deploy --push --update-aliases ${{ github.event.release.name }} latest | ||
hatch run docs:deploy ${{ github.event.release.name }} | ||
concurrency: | ||
group: publish-docs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -73,6 +73,9 @@ coverage.xml | |
*.cover | ||
.hypothesis/ | ||
|
||
# Linter cache | ||
.ruff_cache/ | ||
|
||
# Jupyter Notebook | ||
.ipynb_checkpoints | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,202 @@ | ||
[build-system] | ||
build-backend = "setuptools.build_meta" | ||
requires = ["setuptools"] | ||
build-backend = "hatchling.build" | ||
requires = [ | ||
"hatchling", | ||
] | ||
|
||
[project] | ||
name = "servestatic" | ||
description = "Production-grade static file server for Python web apps." | ||
readme = "README.md" | ||
keywords = [ | ||
"Django", | ||
] | ||
license = "MIT" | ||
authors = [ | ||
{ name = "Mark Bakhit" }, | ||
] | ||
requires-python = ">=3.9" | ||
classifiers = [ | ||
"Development Status :: 5 - Production/Stable", | ||
"Framework :: Django", | ||
"Intended Audience :: Developers", | ||
"License :: OSI Approved :: MIT License", | ||
"Operating System :: OS Independent", | ||
"Programming Language :: Python :: 3 :: Only", | ||
"Programming Language :: Python :: 3.9", | ||
"Programming Language :: Python :: 3.10", | ||
"Programming Language :: Python :: 3.11", | ||
"Programming Language :: Python :: 3.12", | ||
"Topic :: Communications :: File Sharing", | ||
"Topic :: Internet :: WWW/HTTP", | ||
"Topic :: Internet :: WWW/HTTP :: WSGI :: Middleware", | ||
] | ||
dynamic = [ | ||
"version", | ||
] | ||
dependencies = [ | ||
"django", | ||
] | ||
optional-dependencies.brotli = [ | ||
"brotli", | ||
] | ||
urls.Changelog = "https://archmonger.github.io/ServeStatic/latest/changelog/" | ||
urls.Documentation = "https://archmonger.github.io/ServeStatic/" | ||
urls.Homepage = "https://github.com/Archmonger/ServeStatic" | ||
|
||
[tool.hatch.version] | ||
path = "src/servestatic/__init__.py" | ||
|
||
[tool.hatch.build.targets.sdist] | ||
include = [ | ||
"/src", | ||
"/tests", | ||
] | ||
|
||
[tool.hatch.build.targets.wheel] | ||
nclude = [ | ||
"/src", | ||
"/tests", | ||
] | ||
|
||
[tool.hatch.metadata] | ||
license-files = { paths = [ "LICENSE" ] } | ||
|
||
[tool.hatch.envs.default] | ||
installer = "uv" | ||
|
||
# | ||
# Testing | ||
# | ||
[tool.hatch.envs.hatch-test] | ||
extra-dependencies = [ | ||
"pytest-sugar", | ||
"requests", | ||
"brotli", | ||
] | ||
randomize = true | ||
matrix-name-format = "{variable}-{value}" | ||
|
||
# Django 3.2 LTS | ||
[[tool.hatch.envs.hatch-test.matrix]] | ||
python = [ "3.8", "3.9", "3.10"] | ||
Archmonger marked this conversation as resolved.
Show resolved
Hide resolved
|
||
django = [ "3.2" ] | ||
|
||
# Django 4.0 | ||
[[tool.hatch.envs.hatch-test.matrix]] | ||
python = [ "3.8", "3.9", "3.10" ] | ||
django = [ "4.0" ] | ||
|
||
# Django 4.1 | ||
[[tool.hatch.envs.hatch-test.matrix]] | ||
python = [ "3.8", "3.9", "3.10", "3.11"] | ||
django = [ "4.1" ] | ||
|
||
# Django 4.2 | ||
[[tool.hatch.envs.hatch-test.matrix]] | ||
python = [ "3.8", "3.9", "3.10", "3.11", "3.12"] | ||
django = [ "4.2" ] | ||
|
||
# Django 5.0 | ||
[[tool.hatch.envs.hatch-test.matrix]] | ||
python = [ "3.10", "3.11", "3.12"] | ||
django = [ "5.0" ] | ||
|
||
# Django 5.1 | ||
[[tool.hatch.envs.hatch-test.matrix]] | ||
python = [ "3.10", "3.11", "3.12"] | ||
django = [ "5.1" ] | ||
|
||
[tool.hatch.envs.hatch-test.overrides] | ||
matrix.django.dependencies = [ | ||
{ if = [ "3.2" ], value = "Django~=3.2" }, | ||
{ if = [ "4.0" ], value = "Django~=4.0" }, | ||
{ if = [ "4.1" ], value = "Django~=4.1" }, | ||
{ if = [ "4.2" ], value = "Django~=4.2" }, | ||
{ if = [ "5.0" ], value = "Django~=5.0" }, | ||
{ if = [ "5.1" ], value = "Django~=5.1" }, | ||
Archmonger marked this conversation as resolved.
Show resolved
Hide resolved
|
||
] | ||
|
||
# | ||
# Documentation | ||
# | ||
[tool.hatch.envs.docs] | ||
template = "docs" | ||
detached = true | ||
dependencies = [ | ||
"mkdocs", | ||
"mkdocs-git-revision-date-localized-plugin", | ||
"mkdocs-material", | ||
"mkdocs-include-markdown-plugin", | ||
"linkcheckmd", | ||
"mkdocs-spellcheck[all]", | ||
"mkdocs-git-authors-plugin", | ||
"mkdocs-minify-plugin", | ||
"mike", | ||
] | ||
|
||
[tool.hatch.envs.docs.scripts] | ||
linkcheck = [ | ||
"linkcheckMarkdown docs/ -v -r", | ||
"linkcheckMarkdown README.md -v -r", | ||
"linkcheckMarkdown CHANGELOG.md -v -r", | ||
] | ||
build = [ "cd docs && mkdocs build --strict" ] | ||
deploy = [ | ||
"cd docs && mike deploy --push --update-aliases {args} latest", | ||
] | ||
develop = [ | ||
"cd docs && mike deploy --push develop", | ||
] | ||
Archmonger marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
# | ||
# Linting | ||
# | ||
[tool.hatch.envs.lint] | ||
template = "lint" | ||
detached = true | ||
dependencies = [ | ||
"isort", | ||
"flake8", | ||
"flake8-bugbear", | ||
"flake8-comprehensions", | ||
"flake8-logging", | ||
"flake8-tidy-imports" | ||
] | ||
|
||
[tool.hatch.envs.lint.scripts] | ||
check = [ | ||
"flake8 .", | ||
Archmonger marked this conversation as resolved.
Show resolved
Hide resolved
|
||
] | ||
|
||
# | ||
# Tools | ||
# | ||
|
||
[tool.black] | ||
target-version = ['py39'] | ||
target-version = [ 'py39' ] | ||
|
||
[tool.pytest.ini_options] | ||
addopts = """\ | ||
--strict-config | ||
--strict-markers | ||
""" | ||
|
||
[tool.coverage.run] | ||
branch = true | ||
parallel = true | ||
source = [ | ||
"src/", | ||
"tests/", | ||
] | ||
|
||
[tool.coverage.paths] | ||
source = [ | ||
"src/", | ||
] | ||
|
||
[tool.coverage.report] | ||
show_missing = true | ||
|
||
[tool.rstcheck] | ||
report_level = "ERROR" |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 mind making the switch to
pypa/gh-action-pypi-publish
within this PR, since we're already touching this file anywaysEDIT: 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.
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.
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
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.
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)
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.
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.
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.
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
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.
Ahhh okay I understand your point - Yeah manually creating the GH releases is unnecessary manual labor. If we can automate that would be fantastic.