NewYour coding agent can read the release notes before it upgrades.Set up the MCP server →
PyPI · #3329 most downloaded on PyPI
Detect test environment - pytest, doctest, unittest, or regular execution
Last release 2 months ago
31 Jul 2026
Ships unpredictably
gaps range from 2 weeks to 2.3 years
Nearly every release is documented
notes for 19 of 19 stable releases
Nothing withdrawn
no release was ever pulled
5 years old
19 releases · first in 2021
One column per quarter.
Console output no longer crashes on a legacy codepage. A Windows console at codepage 1252 hands Python an errors="strict" stream, so writing a non-ASC
errors="strict" stream, so writing a non-ASCII character such as a check mark
raised UnicodeEncodeError: 'charmap' codec can't encode character and the command exited
non-zero after its work had already succeeded. Click does not protect against this, and Rich
raises the same way through its own writer. The new safe_console module degrades at the sink:
a UTF-8 terminal still receives the character, and only a stream that cannot encode it sees
[OK] / [X] / [!]. Every click.echo call site routes through it, and a test fails if a
module reaches for click.echo or builds an unwrapped Console(file=sys.stdout) again.Fixed CI going red under the latest ruff (0.16 widened its default rule set to ~920 rules on a repo with no explicit [tool.ruff.lint].select): pinned
[tool.ruff.lint].select): pinned the curated bitranox rule select instead
of chasing the exploded default set.raise SystemExit(2) in the CLI's error handlers now uses from e so tracebacks show the
original cause (B904).print_info() and the __main__ guard now write via sys.stdout/sys.stderr instead of print,
fixing a latent bug where the guard printed a bytes literal's repr instead of the plain message.[tool.ruff.lint].select (matching bitranox_template_py_cli) plus
pydocstyle Google convention and a tests/*.py per-file-ignore list, replacing the previous
no-select config that inherited ruff's entire default rule set.*,) so ruff's PLR0917 no longer fires;
Click already invokes command callbacks by keyword, so this is not a call-site change.if/return True/False branches in lib_detect_testenv.py to direct
return <condition> expressions (SIM103).import sys/from rich.style import Style statements in cli.py
to the module top (PLC0415).Optional[X] with X | None throughout cli.py (UP045).Added a typed_click.py facade wrapping rich-click's option / version_option decorators behind explicit, fully-known signatures, keeping the CLI strict
typed_click.py facade wrapping rich-click's option / version_option decorators behind explicit, fully-known signatures, keeping the CLI strict-clean under pyright (reportUnknownMemberType). The repo-wide reportUnknownMemberType suppression is retained, but only for the tomli backport (untyped on Python 3.10); the rich-click decorators no longer rely on it.scripts/ package to the external bmk tooling (uvx bmk); removed the obsolete scripts/ directory and [tool.scripts.test] config; added [tool.bashate] settings and the bmk CI workflows.requires-python>=3.10): the bmk build/dev toolchain requires Python 3.10+.Replaced tomllib/tomli with rtoml for TOML parsing in scripts
tomllib/tomli with rtoml for TOML parsing in scriptsactions/cache v4 → v5actions/upload-artifact v5 → v6PYTHONIOENCODING: "utf-8" environment variable to CI workflow for consistent encodingadd_path_to_syspath() function to add paths to sys.path with duplicate prevention
Core Library Features:
add_path_to_syspath() function to add paths to sys.path with duplicate preventionCLI Detection Commands:
check - Check if any test environment is active (pytest, doctest, setup.py test)pytest - Check if pytest is activedoctest - Check if doctest is activesetup - Check if setup.py is active--quiet flag for all detection commands (exit code only, no output)--arg-string option to test custom argument strings--test-only flag for setup command (check only "setup.py test")CLI Utility Commands:
hello - Demo command to print greeting messagefail - Demo command to trigger intentional failure for testing error handlinginfo - Display package metadata and version information3-Level Exit Code System:
Comprehensive Test Suite:
Documentation:
BREAKING CHANGES:
detect_testenv.py to lib_detect_testenv.pyrich-click>=1.9.4 required for CLI functionality
dependencies = ["rich-click>=1.9.4"] - Required for CLI entry pointis_pytest_active(), etc.) without using rich-clickConfiguration:
["logging", "rich", "cli", "terminal", "ansi"] to ["testing", "pytest", "doctest", "unittest", "test-detection", "test-environment"] for accurate PyPI discoverabilityDocumentation:
check command when invoked without argumentsremove dependency cli_exit_tools to avoid circular dependency
2023-07-14:
- remove dependency click
- remove dependency cli_exit_tools to avoid circular dependency
move 3rd_party_stubs outside the src directory
2023-07-14:
- add codeql badge
- move 3rd_party_stubs outside the src directory
- add pypy 3.10 tests
- add python 3.12-dev tests
v2.0.6 2023-07-13: - require minimum python 3.8 - remove python 3.7 tests
2023-07-13:
- require minimum python 3.8
- remove python 3.7 tests
introduce PEP517 packaging standard
2023-07-11:
- introduce PEP517 packaging standard
- introduce pyproject.toml build-system
- remove mypy.ini
- remove pytest.ini
- remove setup.cfg
- remove setup.py
- remove .bettercodehub.yml
- remove .travis.yml
- update black config
2023-06-26: suppress upload of .egg files to pypi.org
2023-06-26: suppress upload of .egg files to pypi.org
v2.0.3 2023-01-13: update github actions : checkout@v3 and setup-python@v4 remove "better code" badges remove python 3.6 tests add python 3.11 tests u
v2.0.3 2023-01-13: update github actions : checkout@v3 and setup-python@v4 remove "better code" badges remove python 3.6 tests add python 3.11 tests update to pypy 3.9 tests
2022-06-02: update to github actions checkout@v3 and setup-python@v3
2022-06-02: update to github actions checkout@v3 and setup-python@v3
2022-06-01: update github actions test matrix
2022-06-01: update github actions test matrix
2022-03-29: remedy mypy Untyped decorator makes function "cli_info" untyped
2022-03-29: remedy mypy Untyped decorator makes function "cli_info" untyped
2022-03-25: fix github actions windows test
2022-03-25: fix github actions windows test
v2.0.0 ------- 2021-11-23: - add "setup.py test" detection
2021-11-23: - add "setup.py test" detection
remove second github action yml
2021-11-22: - remove second github action yml - fix "setup.py test"
2021-11-21: implement github actions
2021-11-21: implement github actions
2021-11-18: v1.0.0 initial release
2021-11-18: v1.0.0 initial release
Your coding agent can read these notes before it upgrades. Set up the MCP server →