add twine check and pre-commit

This change add a minimal pre-commit config to run
a local twine-check hook.

This hook emulates calls tools/twine-check.sh in a venv
which emulates the check made by the test-release-openstack
zuul job.

This can be run locally via "pre-commit run twine-check -a"
or automtically on commit if you install the pre-commit hooks

This change also add sphinx-lint to lint the readme and
catch common RST issues.

Change-Id: I726838714c591cc06d3bd54a47503bc6e659a0bb
This commit is contained in:
Sean Mooney 2024-04-19 18:37:45 +01:00
parent 82c307a034
commit aa1aa21a0f
3 changed files with 29 additions and 0 deletions

1
.gitignore vendored
View File

@ -21,3 +21,4 @@
build build
AUTHORS AUTHORS
ChangeLog ChangeLog
dist

23
.pre-commit-config.yaml Normal file
View File

@ -0,0 +1,23 @@
---
default_language_version:
# force all unspecified python hooks to run python3
python: python3
repos:
- repo: local
hooks:
- id: twine-check
name: twine-check
entry: tools/twine-check.sh
language: python
types: [python]
additional_dependencies: [twine]
args: ['--strict']
exclude: ^$ # don't run on empty files
- repo: https://github.com/sphinx-contrib/sphinx-lint
rev: v0.9.1
hooks:
- id: sphinx-lint
args: [--enable=default-role]
files: ^README.rst
types: [rst]

5
tools/twine-check.sh Executable file
View File

@ -0,0 +1,5 @@
#!/bin/bash
# build dist tarball
python setup.py sdist
# check dist tarball
twine check dist/*