Contributing¶
This is an open source project, and we are open to new contributors.
Getting started¶
- Install uv and just. modern-di supports Python 3.11 and later.
-
Clone the project:
-
Run
just install. It runsuv lock --upgrade, then syncs every extra and the lint group, so you lint with the newestruffandty, as CI does.uv.lockis gitignored. Run it again in every new checkout or worktree beforejust lint.
Running linters¶
ruff and ty do the static analysis. Run all checks with just lint, which also applies
ruff's fixes and formatting.
Running tests¶
Run all tests with just test. Run a subset with just test <PATH> -k <NAME>.
just test-ciis the full run with coverage, and fails below 100% line and branch coverage ofmodern_di.just test-raceruns only the thread-race tests. CI repeats them on free-threaded Python builds.just benchruns the guard-tier benchmarks, andjust bench-comparethe cross-framework ones.
Working on the docs¶
The site is built from docs/ with MkDocs. Before you open a pull request that touches it:
just test-docsruns every Python block underdocs/as a test, with Sybil. The framework pages underdocs/integrations/are skipped there.just test-docs-integrationsruns every page, the framework pages included, with each integration's latest release installed. It builds a throwaway virtualenv.just docs-buildis the strict MkDocs build. Any warning fails it.
The writing rules are in docs/agents/docs-style.md.
What CI runs¶
Every pull request runs just lint-ci and just adr-check, just test-ci and just test-docs on
Python 3.11 to 3.14 (3.15 as a pre-release), just test-race --count=50 on the free-threaded
builds, just test-docs-integrations, just docs-build, and an offline link check of every
Markdown file.
Submitting changes¶
- Fork the repo and branch off
main. - Make your change with tests, and keep 100% line and branch coverage of
modern_di. The gate isreport.fail_under = 100inpyproject.toml. - Run
just lintandjust testlocally before pushing. - For a non-trivial change, the pull-request body is the spec. The template has Summary, Changes and Checklist sections.
- Open a pull request upstream.