This action provides the following functionality for GitHub Actions users that are maintaining Python packages and want to ensure in CI that the packages they build are in good shape and remain so:
Builds your package using PyPA's build (this works with any PEP 517-compatible build backend, including Hatch, Flit, Setuptools, PDM, or Poetry).
Uploads the built wheel and the source distribution (SDist) as GitHub Actions artifacts (not PyPI), so you can download and inspect them from the Summary view of a run.
Lints the wheel contents using check-wheel-contents.
Lints the PyPI README using twine and uploads it as an GitHub Actions artifact for further inspection. To level up your PyPI README game, check out hatch-fancy-pypi-readme!
Prints the tree of both SDist and wheel in the CI output, so you don't have to download the packages, if you just want to check the content list.
Prints and uploads the packaging metadata as a GitHub Actions artifact.
If you package an application as a Python package, this action is useful to double-check you're shipping everything you need, including all templates, translation files, et cetera.
jobs:
check-package:
name: Build & inspect our package.
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: hynek/build-and-inspect-python-package@v1
The action will run setup-python with Python 3.10 on its own.
path
: the location of the Python package to build (optional, default:.
).
-
dist
: the location with the built packages.See for example how argon2-cffi-bindings uses this feature to check the built wheels don't break a dependency.
After a successful run, you'll find multiple artifacts in the run's Summary view:
- Packages: the built packages.
- Package Metadata: the extracted packaging metadata (hint: it's formatted as an email).
- PyPI README: the extracted PyPI README, exactly how it would be used by PyPI as your project's landing page.
PEP 621 calls it
readme
, in classic setuptools it'slong_description
.
Our CI uses all inputs and outputs, if you want to see them in action.
The scripts and documentation in this project are released under the MIT License.