skillfed

pytest-filter-subpackage

Pytest plugin for filtering based on sub-packages

pytest-filter-subpackage v0.2.0 334.7K downloads/30d#7,485 on PyPI5
Permissive license BSD Active released

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-subpackage

uv

uv add pytest-filter-subpackage

poetry

poetry add pytest-filter-subpackage

Installing 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

Development Status :: 5 - Production/StableFramework :: PytestIntended Audience :: DevelopersLicense :: OSI Approved :: BSD LicenseOperating System :: OS IndependentProgramming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9Topic :: Software Development :: TestingTopic :: Utilities

Tags

pytest sub-package filteringpytest plugin selective testingpytest -P optionpytest namespace filteringpytest subpackage runner
pytest-plugintest-filtering

More Utilities packages