Skip to content

v7.15.0

Latest

Choose a tag to compare

@kdeldycke kdeldycke released this 03 May 15:47
Immutable release. Only release title and notes can be modified.

Note

7.15.0 is available on 🐍 PyPI and 🐙 GitHub.

  • Add opt-in 24-bit true-color rendering to the ANSI Pygments stack. Pass true_color=True to AnsiColorLexer, AnsiFilter, or any session lexer (like get_lexer_by_name("ansi-shell-session", true_color=True)) to preserve SGR 38;2;r;g;b and 48;2;r;g;b sequences as Token.Ansi.FG_{rrggbb} / Token.Ansi.BG_{rrggbb} tokens instead of quantizing them to the 256-color palette. AnsiHtmlFormatter renders those tokens as inline style="color: #rrggbb" / style="background-color: #rrggbb" spans. The default behavior (256-color quantization) is unchanged.
  • New click_extra.theme module centralizes all theme machinery: HelpExtraTheme, default_theme, nocolor_theme, OK, KO, ThemeOption, theme_option decorator, theme_registry, and register_theme(). Every click-extra command now accepts --theme [dark|light]; downstream consumers can extend the choice list via register_theme(). The active theme for a CLI run is stored in ctx.meta[context.THEME] by ThemeOption and retrieved via get_current_theme(), so back-to-back invocations in the same process (Sphinx builds, test runners, REPLs) no longer leak --theme choices into each other. The wrap subcommand reads the theme from the parent group's context rather than carrying its own --theme. Adds a corresponding docs/theme.md user guide. Breaking: downstream code importing theme symbols directly from click_extra.colorize must update to click_extra.theme; the canonical from click_extra import HelpExtraTheme path is unaffected.
  • New click_extra.context module consolidates ExtraContext (moved from click_extra.commands) and a documented registry of every ctx.meta key Click Extra writes or reads: RAW_ARGS, CONF_SOURCE, CONF_FULL, TOOL_CONFIG, VERBOSITY_LEVEL, VERBOSITY, VERBOSE, START_TIME, JOBS, TABLE_FORMAT, SORT_BY, and THEME. The get() and set() helpers replace scattered ctx.meta.get(key, ...) calls throughout the codebase. Replaces the former click_extra.ctx_meta module. Breaking: from click_extra.commands import ExtraContext and from click_extra import ctx_meta must be updated to from click_extra.context import ExtraContext and from click_extra import context respectively; the canonical from click_extra import ExtraContext path is unaffected.
  • Add python:source, python:run, python:render, python:render-myst, and python:render-rst Sphinx directives under a new python domain in click_extra.sphinx. They mirror click:source / click:run for arbitrary Python (no Click CLI required): python:source runs silently and shows source, python:run captures stdout and renders it in a code block (default lexer text, override via :language:), and the render family parses the captured stdout as live document content: generated tables, headings, admonitions, and cross-references become first-class document nodes rather than a code block. python:render uses the host file's parser; python:render-myst forces MyST parsing (so a .rst host can embed MyST-generated content); python:render-rst forces reST parsing (so a .md host can embed reST-generated content). The Python and Click runners hold independent per-document namespaces. The render family replaces the docs_update.py regenerator + marker-region pattern many downstream projects use; the same logic now lives inline in the doc page and runs at build time, so the rendered HTML is always current.
  • Breaking change: the click:* and python:* Sphinx directives are now disabled by default. Both families execute arbitrary Python at build time with full Sphinx-process privileges (filesystem, network, environment secrets), so registering them on every project that imports click_extra.sphinx silently expanded the attack surface of every consumer. To re-enable, add click_extra_enable_exec_directives = True to conf.py. Always-on features (the ANSI-capable Pygments HTML formatter and the GitHub-alerts → MyST/reST converter) are unaffected. Without the flag, click:source, click:run, python:source, python:run, python:render, python:render-myst, and python:render-rst are not registered and any reference to them produces an "Unknown directive" warning at build time.
  • Tighten Click floor from 8.1 to 8.3.1. The relaxation in 7.14.1 went further than needed; 8.3.1 is the minimum that ships the parameter-name fix we depend on.
  • Move --cov and --cov-report=term from pyproject.toml [tool.pytest].addopts into the CI workflow. Removes pytest-cov as an unconditional test-time dependency for downstream packagers.
  • Move tests/test_mkdocs.py into tests/mkdocs/. Downstream packagers can skip it with --ignore=tests/mkdocs without pulling in mkdocs-click.
  • Loosen default_debug_*_version_details regex helpers to also match None for git_long_hash, git_short_hash, and git_date. Lets debug-output tests pass when the source tree has no .git directory (Guix git-fetch, sdist installs).
  • Mark test_ansi_lexers_candidates with the new network marker. Sandboxed builds can exclude it with pytest -m "not network".
  • Make tests/test_table.py tolerate tabulate <0.10: branch the asciidoc fixture on the cell-alignment marker (<8 vs 8<) and skip the colon-grid parametrize case when the format is aliased to grid.

Full changelog: v7.14.1...v7.15.0


🛡️ VirusTotal scans

Binary Detections Analysis
click-extra-7.15.0-linux-arm64.bin 0 / 62 View scan
click-extra-7.15.0-linux-x64.bin 1 / 63 View scan
click-extra-7.15.0-macos-arm64.bin 4 / 61 View scan
click-extra-7.15.0-macos-x64.bin 1 / 62 View scan
click-extra-7.15.0-windows-arm64.exe 1 / 68 View scan
click-extra-7.15.0-windows-x64.exe 20 / 69 View scan