From aa1aa21a0ff4d2688f5fc662d0dc6e791d5630ec Mon Sep 17 00:00:00 2001 From: Sean Mooney Date: Fri, 19 Apr 2024 18:37:45 +0100 Subject: [PATCH] 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 --- .gitignore | 1 + .pre-commit-config.yaml | 23 +++++++++++++++++++++++ tools/twine-check.sh | 5 +++++ 3 files changed, 29 insertions(+) create mode 100644 .pre-commit-config.yaml create mode 100755 tools/twine-check.sh diff --git a/.gitignore b/.gitignore index af205c69..fa102155 100644 --- a/.gitignore +++ b/.gitignore @@ -21,3 +21,4 @@ build AUTHORS ChangeLog +dist diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 00000000..1ffc437a --- /dev/null +++ b/.pre-commit-config.yaml @@ -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] + diff --git a/tools/twine-check.sh b/tools/twine-check.sh new file mode 100755 index 00000000..3221faca --- /dev/null +++ b/tools/twine-check.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# build dist tarball +python setup.py sdist +# check dist tarball +twine check dist/*