Contributing
Contributions and suggestions for new features are welcome, as are bug reports! Please open an issue to discuss new features or to report bugs.
Local setup
Section titled “Local setup”Requirements:
uv python pin 3.14uv venv .venvsource .venv/bin/activateuv sync --all-groupsprek installWe use prek to manage our git hooks.
It is installed as part of uv sync --all-groups, and it is configured in
prek.toml.
prek install sets up the git hook, so the checks run automatically whenever you commit.
To run every hook against the whole repo without committing, use:
prek run -aprek.toml contains the following hooks:
- actionlint: lints our GitHub Actions workflow files.
- pyproject-fmt: formats and normalizes
pyproject.toml. - Ruff: does linting checks (including import sorting) and automatically fixes what it can.
- Ruff format: automatically formats your code to a standardized Python format.
- mypy: static type checker which verifies you are not using objects incorrectly.
- codespell: catches common spelling mistakes in the docs.
As mentioned, some of these tools automatically fix your code while other only highlight potential issues. Sometimes it will be enough to try to commit a second time and it will pass, while other times it may require manual changes to your code.
In rare cases it may be difficult or undesirable to change to code to pass the linting rules.
If this happens, it’s ok to add a Ruff # noqa or mypy # type: ignore comment to skip that line.
For details of how to do this, please see the Ruff docs
and mypy docs.
The documentation website is built with Astro Starlight and lives in docs/.
To work on the docs locally you need Node.js (v22.12 or newer):
cd docsnpm installnpm run devThis starts a local dev server with hot reload. npm run build builds the full
static site (including link validation) into docs/dist/.
Most pages live in docs/src/content/docs/ and use standard
Starlight Markdown/MDX:
asides, plain <details> blocks, <Tabs>/<TabItem> for content tabs, and
<Code code={...} /> with ?raw imports to embed the runnable snippets from
docs/code_snippets/ (aliased as @code_snippets; the library source is
@rich_click). Inline code with a language suffix, such as
`import click{:py}`, gets syntax highlighting.
The changelog and contributing pages are generated from the repo-root
CHANGELOG.md and CONTRIBUTING.md files by docs/scripts/prepare-content.mjs.
The landing page is docs/src/pages/index.astro, with its hero in
docs/src/components/Hero.astro. The hero’s terminal shows
the output of docs/code_snippets/homepage/sync_tool.py in each format, which
rich-codex captures from the outputs in .rich-codex.yml.
The docs show terminal output as text, in code blocks that
rich-codex (1.5+) fills in. A RICH-CODEX
comment directly above a code block runs the command in the block and saves
its output, with its colours, to the .ansi file in the block’s
runnable.outputFile, which the block then shows. In .mdx pages the comment
uses MDX comment syntax:
{/* RICH-CODEXworking_dir: docs/code_snippets/accessibilityterminal_width: 48*/}```sh runnable.outputFile="../images/code_snippets/accessibility/colors.ansi"$ python colors.py```command in the comment runs a different command from the one the block shows,
for example to install another tool’s CLI with uv run --with. The README keeps
SVG screenshots for GitHub and PyPI.
The docs workflow runs rich-codex on every push to main and commits the files
it updates. To run it yourself:
uv run rich-codex --skip-git-checksUse of AI
Section titled “Use of AI”We welcome contributions that use AI assistance. The maintainers of this code use AI coding assistance to varying degrees. Additionally, we have accepted and will continue to accept contributions from outside contributors which are AI written.
All we ask is:
- Please disclose the use of AI coding in your pull request.
- Please communicate with us using your own words, not through an AI.
- Permission to use AI in contributions is not the same as permission to spam us with slop PRs.
Please also consider the following: The maintainers of this code base have access to the same LLMs that you do. We have just as much of an ability as you do to copy+paste a simple issue description into an AI coding agent and get a pull request out of it. If you are scraping Github repos to find open issues and slinging slop at hundreds or thousands of projects you have no connection to, we are not interested.
Credits
Section titled “Credits”This package was written by Phil Ewels (@ewels), based on initial code by Will McGugan (@willmcgugan).
rich-click is co-maintained by Daniel Reeves (@dwreeves).
Furthermore, these contributors helped make the package what it is today:
See the full list of contributors here.