Skip to content

Commit

Permalink
build: restore --check-tag flag for check-version pre-push hook
Browse files Browse the repository at this point in the history
build: add gadzooks build-docs hook to rebuild docs if the source changes
  • Loading branch information
Jeremy Silver committed Apr 29, 2024
1 parent ce04be6 commit f6097b0
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 14 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ htmlcov
fancy_dataclass/docs/assets/javascripts
fancy_dataclass/docs/search
fancy_dataclass/docs/sitemap.xml.gz
.doc-checksum
15 changes: 12 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,23 @@ repos:
- id: commitizen
stages: [commit-msg]
- repo: https://github.com/jeremander/gadzooks
rev: v0.2.3
rev: v0.2.4
hooks:
- id: build-docs
args: ['--src-docs', 'docs', '--', 'mkdocs', 'build', '--strict', '--no-directory-urls', '-d', 'fancy_dataclass/docs']
pass_filenames: false
verbose: true
- id: loc-summarize
args: ['fancy_dataclass/*.py']
pass_filenames: false
verbose: true
- id: check-version
args: ['--dist-dir', 'dist', '--changelog', 'docs/CHANGELOG.md', '--changelog-version-regex', '\[{version}\]:\s*\w+']
args: []
pass_filenames: false
verbose: true
stages: [commit]
- id: check-version
args: ['--check-tag', '--dist-dir', 'dist', '--changelog', 'docs/CHANGELOG.md', '--changelog-version-regex', '\[{version}\]:\s*\w+']
pass_filenames: false
verbose: true
stages: [commit, push]
stages: [push]
10 changes: 0 additions & 10 deletions TODO.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,6 @@

# TODO

## v0.4.2

- `mkdocs` output in `package_data`?
- `_docs` subdirectory?
- Pre-commit hook to run `mkdocs build`
- Takes only a second, but could use file hashes to prevent redundant build, e.g. `sha1sum docs/*.md | sha1sum | head -c 40`
- Need some hook (post-tag?) to require the docs be up-to-date
- CHANGELOG
- Check version enforcement when attempting to push new tag

## v0.5.0

- Optional dependencies
Expand Down
3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ dependencies = [

[tool.hatch.envs.doc.scripts]
build = "mkdocs build --clean --strict --no-directory-urls {args}"
# build docs within the package, if not already up-to-date
build-pkg = "gadzooks build-docs --src-docs docs -- mkdocs build --strict --no-directory-urls -d fancy_dataclass/docs"
serve = "mkdocs serve"
deploy = "mkdocs build --site-dir $READTHEDOCS_OUTPUT/html"

Expand All @@ -65,7 +67,6 @@ dependencies = [
run-ruff = "ruff check"
# ensure compatibility with Py3.8 and higher
run-vermin = "vermin {args:.}"
# run-vermin = "vermin {args:-t=3.8- --eval-annotations --no-tips --violations --exclude enum.StrEnum --exclude types.UnionType --exclude tests.test_utils .}"
# type-checking
run-mypy = "mypy --install-types --non-interactive {args:fancy_dataclass tests}"
# print info about lines of code
Expand Down

0 comments on commit f6097b0

Please sign in to comment.