About pyapi-checker
Tool for checking for and acknowledging Python API breaking changes. Inspired by gradle-revapi and built with the aexpy API explorer.
Usage
Once you've installed pyapi-checker in an environment in your project you can interface with the pyapi CLI.
pyapi analyze is the command for checking for API breaks in your project which will produce output like this if you have 2 API breaks for example, and also exit with exit code 1:
Python API breaks found in my-lib:
AddRequiredParameter: Add PositionalOrKeyword parameter (functions.bin.parse.parse): new_param.
MoveParameter: Move parameter (functions.bin.parse.parse): handle_errors: 3 -> 4.
So you would want to include pyapi analyze in your CI process to require developers to acknowledge API breaks when creating PRs on a library.
Accepting Breaks
You can accept a single break via:
pyapi acceptBreak "{break code}" "{justification why this is ok}"
Or accept all breaks via:
pyapi acceptAllBreaks "{justification why this is ok}"
Accepted breaks will populate in the .palantir/pyapi.yml file looking like this:
acceptedBreaks:
version:
projectName:
- code: 'break code'
justification: justification
Version overrides
Sometimes the previous release will have a successfully applied git tag but a failed publish build. In this case pyapi-checker will fail as it cannot resolve the previous API to compare against. To resolve this, you can set a version override that will use a different version instead of the last git tag. To do so, use the
pyapi versionOverride <last-published-version>
command to use the last correctly published version instead. This will create an entry in .palantir/pyapi.yml of the following format:
versionOverrides:
version: <last-published-version>
Configuration
Python Index
After identifying the last published version preceeding your current commit, pyapi-checker downloads the corresponding wheel for your package and version from a Python index. If you do not specify an index then pyapi-checker uses the following in order (if set):
PIP_INDEX_URLUV_DEFAULT_INDEXhttps://pypi.org/simple
To manually set an index you can set the following configuration:
[tool.pyapi-checker]
index = "<your-index-url>"
Implementation
pyapi-checker uses aexpy to power it's API breakage detection. You can check out the list of types of API breaks that aexpy detects here.
Note: aexpy does not consider any breaks to an internal module, function, attribute, etc. a high priority breaking change and thus we will not flag these breaks to you.
Developer Setup
This repo uses hatchw which is a wrapper around Hatch which automatically installs Python (versions 3.9-3.13) (via uv) and Hatch in a repo-specific venv such that this repo uses Hatch in an isolated manner.
hatchw essentially passes all args to Hatch and so with our scripts in the pyproject.toml file the workflows are intended to be the following:
- Run tests:
./hatchw run test - Check formatting/linting/type checking:
./hatchw run check-format - Format/fix linting issues:
./hatchw run format - Build package:
./hatchw run build
If you want to disable any output produced by hatchw itself pass the --hatchw-quiet flag which is not propagated to Hatch.
Metadata
Release files for pyapi-checker 0.13.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pyapi_checker-0.13.0.tar.gz | 22.9 kB | Without provenance | Details for pyapi_checker-0.13.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pyapi_checker-0.13.0-py3-none-any.whl | Python 3 | none | any | Details for pyapi_checker-0.13.0-py3-none-any.whl |
Total release size: 42.9 kB
Release files / pyapi_checker-0.13.0.tar.gz
| Download URL | pyapi_checker-0.13.0.tar.gz |
|---|---|
| Size | 22.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ecd807e956af4c3b1290f8b7f14b846797a75cb6c46c72d780752adf76bf1e1e
|
|
BLAKE2b-256 checksum How to use checksums |
5a8a13e9ed11b01dac27ab4c0825506bc516225f187a26e0fd1847fef2a1061f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
Hatch/1.17.1 {"ci":true,"cpu":"x86_64","distro":{"id":"jammy","libc":{"lib":"glibc","version":"2.35"},"name":"Ubuntu","version":"22.04"},"implementation":{"name":"CPython","version":"3.13.5"},"installer":{"name":"hatch","version":"1.17.1"},"openssl_version":"OpenSSL 3.0.16 11 Feb 2025","python":"3.13.5","system":{"name":"Linux","release":"7.0.0-1014-aws"}} HTTPX2/2.16.0
|
Release files / pyapi_checker-0.13.0-py3-none-any.whl
| Download URL | pyapi_checker-0.13.0-py3-none-any.whl |
|---|---|
| Size | 20.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c1ef74d2938b1d0f1e294c862154da3bdbcad867c6e23ae5454711347b13bcb9
|
|
BLAKE2b-256 checksum How to use checksums |
be98d2f873cff989148493c9afec03cd77a7222e6880800d1c46d5d8c4de8f51
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
Hatch/1.17.1 {"ci":true,"cpu":"x86_64","distro":{"id":"jammy","libc":{"lib":"glibc","version":"2.35"},"name":"Ubuntu","version":"22.04"},"implementation":{"name":"CPython","version":"3.13.5"},"installer":{"name":"hatch","version":"1.17.1"},"openssl_version":"OpenSSL 3.0.16 11 Feb 2025","python":"3.13.5","system":{"name":"Linux","release":"7.0.0-1014-aws"}} HTTPX2/2.16.0
|
Security for pyapi-checker 0.13.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.