pytest-filter-subpackage
Pytest plugin for filtering based on sub-packages
What it is and what it does
pytest-filter-subpackage is a pytest plugin that simplifies running tests for specific sub-packages within a larger project. Instead of writing out glob patterns like `**/wcs **/io/fits`, you pass a comma-separated list of sub-package names to the `-P` option, and the plugin translates that into the appropriate test discovery paths. It depends on pytest and packaging.
The plugin is designed for projects with nested package structures where you want to test a particular sub-package and its documentation together. It integrates with pytest's discovery mechanism and is automatically registered when installed. The fact sheet indicates it supports Python 3.8 through 3.12 and is actively maintained.
Use it for:
- Run tests for a single sub-package in a large monorepo without writing complex glob patterns.
- Test both code and narrative documentation for a specific sub-package when used with pytest-doctestplus.
- Quickly validate changes to a particular namespace within a multi-level package structure.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
A pytest plugin that adds a `-P` option to run tests for specific sub-packages by name, filtering test discovery to match named sub-package paths.
Yes, if you work with pytest projects that have nested sub-packages and want a simpler way to filter test runs. The plugin is lightweight, actively maintained, has no known vulnerabilities, and carries a permissive license. Install friction is minimal. It's most valuable in projects where you frequently test individual sub-packages.
Install
pytest-filter-subpackage on PyPI
pip
pip install pytest-filter-subpackageuv
uv add pytest-filter-subpackagepoetry
poetry add pytest-filter-subpackageInstalling pytest-filter-subpackage
Before you install
Low friction install as a pure Python wheel with only pytest and packaging as runtime dependencies. Actively maintained with recent commits and stable status.
License in practice
BSD permissive license allows commercial and private use with minimal restrictions; you must retain the license notice.
Quickstart
pip install pytest-filter-subpackage
# Then run pytest with the -P option:
pytest -P wcs,io.fits
Verify before relying
- Whether the plugin works correctly with pytest-doctestplus as mentioned in the description, or if that integration requires additional setup.
- Whether the -P option supports glob patterns or only exact sub-package name matching.
Package facts
| License | BSD (permissive) |
| Python support | supports the current Python release (>=3.8) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 2 — pytest, packaging |
| Maintenance | actively maintained — 893 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 334,728/month — #7,485 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: pytest_filter_subpackage-0.2.0-py2.py3-none-any.whl
Keywords: pytest, py.test
Tags
More Utilities packages
Converts domain names between Unicode and…
permissive · top 100 on PyPI
charset-normalizerDetects and normalizes text encoding from…
permissive · top 100 on PyPI
setuptoolsSetuptools is a Python build backend and…
permissive · top 100 on PyPI
pluggyPluggy provides a plugin system that lets you…
permissive · top 100 on PyPI
PygmentsPygments is a syntax highlighter that colorizes…
permissive · top 100 on PyPI
sixSix provides utility functions to write Python…
permissive · top 100 on PyPI
pytest-astropyA meta-package that bundles pytest plugins and…
permissive · top 15,000 on PyPI
pytest-ignore-test-resultsA pytest plugin that selectively ignores test…
permissive · top 15,000 on PyPI
pytest-doctestplusA pytest plugin that runs doctests in Python…
permissive · top 15,000 on PyPI
pytest-onlyA pytest plugin that runs only tests marked…
permissive · top 15,000 on PyPI
pytest-snobA pytest plugin that selects and runs only the…
permissive · top 15,000 on PyPI
pytest-remotedataA pytest plugin that lets you mark and…
permissive · top 15,000 on PyPI
pytest-arraydiffA pytest plugin that generates and compares…
permissive · top 15,000 on PyPI
pytest-astropy-headerA pytest plugin that automatically includes…
permissive · top 15,000 on PyPI
pytest-testmonA pytest plugin that automatically identifies…
permissive · top 5,000 on PyPI
pytest-pep8A pytest plugin that integrates PEP8 style…
permissive · top 15,000 on PyPI