pytest-pep723
A pytest plugin that verifies PEP 723 inline script metadata covers all imports.
When you use uv run to dispatch scripts with inline metadata blocks like:
# /// script
# dependencies = [
# "click",
# "numpy",
# ]
# ///
...only the declared dependencies are available at runtime. If you add an
import readcon but forget to add readcon to the deps block, the script
fails at dispatch time. This plugin catches those gaps statically.
Installation
uv add --group dev pytest-pep723
Usage
# Scan all .py files under src/ for PEP 723 scripts
pytest --pep723-check --pep723-paths src/
# Ignore internal/conda-only packages
pytest --pep723-check --pep723-paths src/ --pep723-ignore mypkg --pep723-ignore ira_mod
Or configure in pyproject.toml:
[tool.pytest.ini_options]
pep723_paths =
src/mypkg
pep723_ignore_imports =
mypkg
ira_mod
pep723_extra_mappings =
gi=pygobject
myspecial=my-special-pkg
Then just:
pytest --pep723-check
What it checks
For every .py file under the configured paths that contains a
# /// script block:
- Parses the declared dependencies from inline metadata
- Extracts all
importandfrom X importstatements via AST - Skips stdlib and ignored imports
- Maps import names to PyPI package names (handles
PIL->pillow, etc.) - Reports any import not covered by the declared deps
Features
- Handles multi-line and single-line dependency formats
- Supports all version operators (
>=,~=,[extras], etc.) - Built-in mapping for 20+ packages where import name differs from pip name
- Configurable ignore list for internal packages and conda-only deps
- Custom import-to-package mappings via
pep723_extra_mappings - Registers a
pep723marker for selective test runs
Metadata
Release files for pytest-pep723 0.1.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 |
|---|---|---|---|---|
| pytest_pep723-0.1.0.tar.gz | 72.2 kB | With provenance | Details for pytest_pep723-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pytest_pep723-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for pytest_pep723-0.1.0-py3-none-any.whl |
Total release size: 80.7 kB
Release files / pytest_pep723-0.1.0.tar.gz
| Download URL | pytest_pep723-0.1.0.tar.gz |
|---|---|
| Size | 72.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
563d8268b942002c576ae24f75ce708725d42e5b1dad191c353f5ae120d0fae1
|
|
BLAKE2b-256 checksum How to use checksums |
41dcacdca797b621dd84112666308b304777a0afeb9a72c3da5b4d73ff3021f9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Apr 6, 2026.
Transparency logRelease files / pytest_pep723-0.1.0-py3-none-any.whl
| Download URL | pytest_pep723-0.1.0-py3-none-any.whl |
|---|---|
| Size | 8.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
63b91ddc3704d544a359d7a46131c4c3e8447e8a3ec912715694813b1c2a7c5f
|
|
BLAKE2b-256 checksum How to use checksums |
8bbb337b91e3657295753fd0a40f3446ff59d5a68a3131e6336122ae235c3979
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Apr 6, 2026.
Transparency logSecurity for pytest-pep723 0.1.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.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for pytest_pep723-0.1.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Apr 6, 2026.
Transparency logA 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.