This document outlines the architectural and organizational decisions made for the citry monorepo.
This repository follows a monorepo pattern where:
-
Rust as source of truth - Core logic lives in Rust
crates/ -
Language bindings - Rust functionality is exposed to multiple languages - Python, PHP, JS, Go...
Each language has one package to define language-specific API. E.g.
packages/py/citry_coreexposed Rust code to Python. -
Packages - The actual packages for developers are defined as separate packages, e.g.
packages/py/citry. -
Third party git modules - In some cases, like for Ruff, we have to include them as git module. These are stored inside
third_party/.
citry/
├── crates/ # Rust workspace crates (core + internal crates)
│ ├── citry_core_py/ # Main Rust crate exposed to Python
│ ├── citry_html_transform/
│ ├── citry_i18n/ # Language-neutral Fluent catalog runtime
│ ├── citry_native_render/ # Rust code that reads simple="vue" rows on CPython
│ ├── citry_vue_compiler/ # Native browser-template compilation
│ ├── citry_template_formatter/
│ ├── python_safe_eval/
│ └── citry_template_parser/
├── packages/ # Shipping products per language
│ └── py/ # Python packages
│ └── citry/ # Main Python package
│ └── citry_core/ # Expose citry_core_py to Python
├── tests/ # Integration tests
├── pyproject.toml # Root tooling configuration (NOT releasable)
└── Cargo.toml # Rust workspace configuration
The architecture is designed to support multiple language bindings:
- Python: Via PyO3/maturin
- JS/TS: Via wasm-bindgen
- Go: Via stable C ABI/FFI
- PHP: Via stable C ABI/FFI
As such, the Rust crates are ideal for:
- Text transformation - e.g. template parser, or HTML/code modification
- Shared component logic with string interfaces - Instead of re-implementing it for each language, we define it one in Rust.
- Rust: Install via rustup. Vendored Ruff requires Rust 1.97 or higher, and this repository builds with one dated nightly that rustup selects for you.
- Python: 3.11 or higher
- UV: Fast Python package installer (recommended)
- Node.js and pnpm: needed for the gate's Node-based
phases: the pinned
pyright, thecitry-clientTypeScript package, the docs playground bundle, the VS Code language extension, and the Citry UI asset check. A current LTS Node is fine; runpnpm installonce after cloning. pnpm is the repo's Node package manager: the committed lockfile ispnpm-lock.yaml, CI installs from it withpnpm install --frozen-lockfile, and one root install covers every member inpnpm-workspace.yaml, includingdocs_site/_internal/frontend,packages/editors/*, andpackages/js/*. npm is not a substitute here because it does not read the pnpm workspace or run those package-local gates.
This codebase uses Rust edition 2024, and vendored Ruff requires Rust 1.97
or higher. The edition and minimum version are both available on stable Rust.
For development, the repository names one dated nightly, written
nightly-YYYY-MM-DD, in rust-toolchain.toml.
Every machine and CI job then builds with the same compiler, and a new nightly
reaches the project only when someone moves that date on purpose (see
Moving the Rust nightly date).
The published citry-core wheels, the docs release build and the
example-project tests use the minimum version, Rust 1.97.0, so moving the
nightly date does not change what users install. Most Python and docs CI
jobs install a citry-core wheel built with the nightly (see
CI Dependencies). Inside the checkout, rust-toolchain.toml
takes priority over a toolchain that dtolnay/rust-toolchain installs, so
every job that installs Rust that way also sets RUSTUP_TOOLCHAIN to the
same version. The wheel jobs get the same result from maturin-action, which
runs rustup override set. The toolchain validator
(scripts/validators/toolchain.py) fails on a dtolnay/rust-toolchain job
without a matching RUSTUP_TOOLCHAIN.
Check your Rust version:
# Check current Rust version
rustc --version
cargo --version
# Verify the toolchain for this project
cd citry
rustup showInstall or update Rust:
# Install rustup (if not already installed)
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
# From the repository root, install the toolchain and components that
# rust-toolchain.toml names
rustup toolchain install
# rustup then selects that toolchain whenever cargo or rustc runs in this
# directoryVerify the correct toolchain is active:
# From the repository root
cd citry
rustup show active-toolchain # Should name the date in rust-toolchain.toml
rustc --version # Should show a nightly versionDo not run rustup override set in this directory: an override wins over
rust-toolchain.toml, so your builds would no longer use the pinned compiler.
Treat the nightly date like any other dependency pin. Move it on purpose, in its own pull request, when the project needs a newer compiler or as routine maintenance. Never move it as a side effect of unrelated work.
- Change
channelinrust-toolchain.tomlto the newnightly-YYYY-MM-DD. A nightly's date is usually the day after the commit date thatrustc --versionprints, sorustc 1.101.0-nightly (16d1ffac1 2026-10-26)isnightly-2026-10-27. - Run
rustup toolchain installto fetch it, and checkrustc --version. If a nightly lacksclippyorrustfmt, the install fails; pick another date. - Run the fast gate (
python scripts/check.py --profile fast). New clippy lints and format changes often come with a new nightly. Fix them in the same pull request. - Open the pull request. Every Rust job in CI installs the new date through
the
install-rustaction, which reads the file. Thetoolchainvalidator (scripts/validators/toolchain.py) fails if the channel is not a dated nightly, or if a workflow, composite action or example workflow names a nightly outside a comment.
Only rust-toolchain.toml sets the date. Workflows and scripts read that
file, so moving the date needs no other edit.
Install UV 0.13.5 or later (the version the release workflows pin) with one of these methods:
# macOS/Linux
curl -LsSf https://astral.sh/uv/install.sh | sh
# Windows (PowerShell)
powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"
# Or via pip (if you have Python already)
pip install uv-
Clone the repository:
git clone <repository-url> cd citry git submodule update --init --recursive # Initialize Ruff submodule
-
Verify Rust toolchain (required before building):
# Install the toolchain that rust-toolchain.toml names rustup toolchain install rustc --version # Should show a nightly version
The
rust-toolchain.tomlfile selects the repository's dated nightly whenever you run cargo commands in this directory. Rust edition 2024 itself does not require nightly. -
Install the workspace (from the repository root):
cd citry uv sync --all-packagesThis is the one-step bootstrap. From the root
pyproject.tomland the locked workspace it: builds thecitry_coreRust extension through the maturin backend, installs the pure-Pythoncitrypackage in editable mode, and installs every package's dev dependencies (pytest, ruff, mypy, maturin, and each package's own test deps). Because the lockfile now knows every package, a lateruv syncoruv runis safe and will not remove the editable installs. -
Rebuilding the Rust extension during development:
uv syncrebuildscitry_corewhen the Rust sources change (thecache-keysin itspyproject.tomlcovercrates/**). For a tighter inner loop while working on Rust, build it directly:cd packages/py/citry_core uv run maturin developIn a separate worktree, explicitly select that worktree's virtual environment before invoking maturin. It honors
VIRTUAL_ENVeven when the maturin executable comes from a different environment. An inherited value can install the editable package into another checkout's environment. Check the selected interpreter and importedcitry_core._rustpath after rebuilding.Note:
uv syncbuilds the extension through maturin's PEP 517 backend, which compiles Cargo'sreleaseprofile, so a local sync gives an optimized build. CI's test jobs install a wheel built with therelease-wheelprofile instead (see CI Dependencies).maturin developwithout--releaseproduces a debug (unoptimized) extension. That is fine for tests, but it makes the Rust-backed paths ~10x or more slower, so pass--release(for exampleuv run maturin develop --release) before running any benchmark. A few limits differ between the two builds, such as the native render path's depth limits, so a test that depends on one reads it fromcitry_core._rustrather than copying it. The extension reports how it was compiled incitry_core._rust.BUILD_PROFILE("release"or"debug"), and the benchmark runners exit on a debug build with the rebuild command. To measure a debug build on purpose, setCITRY_BENCH_ALLOW_DEBUG_NATIVE=1. Check which build is installed:uv run --no-sync python -c \ 'from citry_core import _rust; print(_rust.BUILD_PROFILE)'When switching between a version-specific extension and an ABI3 build, both generated binaries can remain in the package directory. Python prefers the binary matching its exact version. Check the imported file before testing:
uv run --no-sync python -c \ 'import citry_core._rust as rust; print(rust.__file__)'To test ABI3, move the older generated binary for that interpreter outside the package directory and confirm that Python imports the intended ABI3 artifact (
_rust.abi3.soin the macOS build). -
Run tests:
# From the root directory uv run pytest # Or run Rust tests first (scoped to our crates, see "Running tests" below) cargo test -p citry_core_py -p citry_html_transform -p citry_i18n -p citry_native_render -p citry_vue_compiler -p citry_template_formatter -p citry_template_parser -p python_safe_eval
The repository's .claude/settings.json sets
up Claude Code the same way for everyone who works here. The measurements
behind these settings are in
docs/agent/RATIONALE.md.
-
CLAUDE_CODE_AUTO_COMPACT_WINDOWis 750000. Claude Code compacts a conversation (replaces its history with a summary) once its context reaches 750,000 tokens, in the main session and in every subagent. On a model with a 1M-token context window it otherwise waits until about 967,000 tokens, and every turn re-sends, and pays for, the whole context. -
The settings enable two code intelligence plugins,
rust-analyzer-lspandpyright-lspfrom Anthropic's official marketplace. They give Claude anLSPtool that finds definitions and references by symbol, and report type errors after each edit. Claude Code installs the plugins, but not the language servers they start. Install those once:# rust-analyzer for the pinned nightly; run it again after moving # the nightly date, because rustup installs components per toolchain rustup component add rust-analyzer # pyright at the version package.json pins for the check gate npm install -g "pyright@$(node -p \ "require('./package.json').devDependencies.pyright")"
A missing server does not stop the session. Claude falls back to grep and whole-file reads, and the plugin reports the problem only under
/plugin> Errors. So a SessionStart hook,check-lsp-servers.py, checks both servers each time a session starts. When one is missing, does not start, or (for pyright) differs from the pinned version, it shows a warning with the command that fixes it, and tells Claude that theLSPtool will fail for that language. -
The PostToolUse hook in
.claude/hooks/warns Claude when an edit adds an em dash, or a word that the house style inCLAUDE.mdbans.
The saved agents in .claude/agents/ carry their own
settings. docs-cold-reader runs on Sonnet. implementer keeps its prompt
cache (the copy of its context that the model can reuse cheaply between
turns) for one hour instead of five minutes, because it often waits on
builds and CI for longer than that. Claude Code ignores the one-hour setting
while a subscription is drawing on usage credits, and the
subagentPromptCacheTtl setting or the
CLAUDE_CODE_SUBAGENT_PROMPT_CACHE_TTL variable overrides it.
Note: Codebase-wide tools (like uv sync, uv run pytest, uv run ruff) should be run from the repository root directory, as they read the root pyproject.toml for configuration.
# From the package directory
cd packages/py/citry_core
uv run maturin developThe Community extension and UI-library directories are rendered from
docs_site/data/community_packages.yml.
Add, update, or remove listings there rather than formatting cards by hand.
The schema, review policy, disclosure rules, publication lifecycle, and future
weekly discovery process are defined in
docs_community_packages.md.
Several lint rules, and the name check in actions.Dispatch, read tables in
citry/_html_attribute_values.py:
citry.template.invalid-attribute-valuechecks the value of an attribute that accepts only certain keywords, such asdraggable="treu", and a value on a boolean attribute, such asdisabled="false", which still turns the attribute on.citry.template.misspelled-directiveandcitry.template.misspelled-attributeread the attribute names each element accepts.citry.template.unknown-aria-attributereads thearia-*names.citry.template.misspelled-elementreads the HTML, SVG, and obsolete HTML element names.citry.vue.misspelled-eventandcitry.browser.undeclared-component-eventread the DOM event names.actions.Dispatchrefuses every name in the DOM event names table, and so does the browser runtime, which holds a copy of that table.
A script generates that module from published standards and Vue's type
declarations. The script also lists a few names and keywords by hand:
closed keyword sets the standard describes only in words, such as the
<input type> keywords, and values browsers accept outside the standard,
such as wrap="off". To pick up names and keywords the sources have added
or removed, run:
python scripts/generate_html_attribute_values.pyThe script downloads the HTML Standard's
index and
obsolete features
pages, WAI-ARIA 1.2 and the
WAI-ARIA 1.3 draft, and the
SVG 2 and
SVG 1.1 element indexes. It
also reads the event names in Vue's runtime-dom.d.ts, which the language
server's bundled types include. Pass --saved NAME=FILE to read a saved copy
of one page instead of downloading it (--source FILE does this for the
index), and --vue-types FILE to read another runtime-dom.d.ts;
--help lists the page names. The generated module's docstring records
every source and the date it was generated.
The script also copies the DOM event names into
_vue/client.js, between the
BEGIN DOM_EVENT_NAMES and END DOM_EVENT_NAMES comments. After any run,
rebuild the browser runtime that pages load, _vue/runtime.js, with
pnpm --dir packages/js/citry-client run build. --client-only copies the
committed table into client.js without downloading anything. A name that
browsers fire but no source lists goes in SUPPLEMENTAL_EVENT_NAMES in the
script, with its spec reference, so that every refresh keeps it.
Review the diff before committing: a new name or keyword becomes valid, and a removed one starts being reported. No CI job refreshes the tables, because that would need network access.
When Vue's first render in the browser sets an attribute, it either calls
setAttribute or assigns an element property, and the two can leave
different text in the page. The Vue server renderer cannot ask a browser which
one happens, so it reads
crates/citry_vue_compiler/src/dom_members.rs.
That file tells it, for each HTML element and lowercase attribute name, which
attribute text a browser keeps. When the table is unsure, the server leaves
that region for the browser to render.
The file is generated by tools/dom-members/ from the
web platform IDL (@webref/idl and @webref/elements) and MDN's browser
compatibility data. The tools directory is its own pnpm root, outside the
workspace, with its own lockfile, so the data packages are installed only where
the table is generated or tested. From the repository root:
pnpm --dir tools/dom-members install
pnpm --dir tools/dom-members run generate
pnpm --dir tools/dom-members run check
pnpm --dir tools/dom-members run test
pnpm --dir tools/dom-members run test:browser
pnpm --dir tools/dom-members run refreshgeneraterewritesdom_members.rs, andcheckfails when the committed file differs from what the pinned data produces.testruns the generator's own tests on small synthetic inputs.test:browsermounts every element in real browsers, runs Vue's attribute code, and compares the result with the table. SetBROWSERSto a comma-separated list (BROWSERS=chromium,firefox,webkit) to choose the engines. Install them first withpnpm --dir tools/dom-members exec playwright install.refreshupdates the data packages to their latest versions and regenerates the table. It needs network access, adds a browser-data copy when one is due, and stops when a new member needs review inlib/reviewed.mjs.
A Vue bump must refresh the table. The @vue/runtime-dom line in the file's
header has to match the Vue version in
packages/py/citry_lsp/citry_lsp/types/inventory.json, and
scripts/validators/generated_copies.py fails the gate when it does not.
Some members cannot be classified from the IDL alone, because the web
standard describes them in prose, because a boolean attribute does nothing
when it is set to false, or because a browser has them although no data
records them. The generator reads the reviewed lists of these from
tools/dom-members/lib/reviewed.mjs. It stops when a string attribute with
no reflection marker in the IDL is on neither of the two lists that say
whether it mirrors, until someone reviews it.
The "Generated files" workflow runs check and test on every pull request.
test:browser runs in its own workflow,
.github/workflows/repo--dom-members.yml, only when a pull request changes the
table or tools/dom-members/. The Playwright version in that directory's
lockfile decides which browser builds are installed, so a Playwright bump runs
it too. Because of the path filter, it cannot be a required check.
Rust tests are scoped to the crates under crates/, one -p flag per crate.
The vendored ruff submodule's crates are auto-included in the cargo workspace
(path dependencies inside the workspace directory), so a bare cargo test
would also run ruff's own test suite. CI scopes the run the same way
(see rust--tests.yml).
# From the root directory
# Python tests
uv run pytest
# Rust tests (our crates only)
cargo test -p citry_core_py -p citry_html_transform -p citry_i18n -p citry_native_render -p citry_vue_compiler -p citry_template_formatter -p citry_template_parser -p python_safe_eval
# Both (Rust first, then Python)
cargo test -p citry_core_py -p citry_html_transform -p citry_i18n -p citry_native_render -p citry_vue_compiler -p citry_template_formatter -p citry_template_parser -p python_safe_eval && uv run pytestThe Python tests fail on any deprecation warning. The filterwarnings
setting in the root pyproject.toml turns each one into an error, and each
warning that Citry cannot fix is listed there as a named exception. How to fix
a warning or add an exception is in the "Fix deprecation warnings" section of
docs_site/content/community/development.md.
Do not run pytest -W error::DeprecationWarning here. anyio's pytest plugin
raises a deprecation while pytest loads it, so pytest stops before any test
runs. The filterwarnings setting avoids this by listing that one warning as
an exception.
Install the browser-test dependencies and Chromium before running the E2E suite locally:
uv sync --all-packages --group e2e
uv run playwright install chromiumThe Citry and Citry UI browser suites run by file across four pytest workers,
matching the four CPUs on the standard public GitHub Linux runner. Each worker
owns its own browser process and test servers; loadfile keeps all tests from
one file on the same worker so file-local fixtures are not split across
processes:
uv run --no-sync pytest \
packages/py/citry/tests/e2e \
packages/py/citry_ui/citry_ui/components \
packages/py/citry_ui/citry_ui/quality/tests/e2e \
packages/py/citry_ui/tests/e2e \
-m e2e \
--browser chromium \
-n 4 \
--dist loadfile \
--durations 30The pull-request Chromium job and the scheduled Chromium, Firefox, and WebKit
jobs use this same distribution. The pull-request job selects
-m "e2e and not weekly" so it skips the tests marked weekly; the
scheduled cross-browser job selects -m e2e and runs them. The browser
matrix still assigns each browser to a separate GitHub job; the four workers
run inside that browser's one job and do not request four GitHub runners.
--durations 30 reports the slowest tests so an oversized file that limits
parallelism remains visible.
Do not put the worker flags in pytest's global addopts. Small focused runs,
the ordinary Python matrix, and the docs-site E2E suite stay serial. In
particular, distributing the docs-site suite would repeat its session-scoped
site build once per worker. On a machine with fewer than four CPUs or limited
memory, lower -n; four is the CI default, not a correctness requirement.
The docs-site playground and live-code browser tests run against the release
pinned in docs_site/static/playground/runtime.json, and skip the tests that
need this checkout's Citry unless CITRY_PLAYGROUND_CORE_WHEEL is set. See
Which browser tests run against the pinned release.
The parity check records every Vue page the non-browser suite prepares,
renders each one with the Rust renderer and with Vue's own
renderToString in Node, and compares the HTML. scripts/check.py runs it
in both profiles, so CI runs it too: its pytest phase loads the recording
plugin, and the vue render parity phase that follows compares the pages
that run recorded. The comparison itself takes a few seconds.
When you change the server's hydration renderer
(crates/citry_vue_compiler/src/server_render.rs) or the compiled render
code it reads, run it on its own. It needs pnpm install and a native
build, and takes about as long as one non-browser test run. It also records
pages from the qualification tests and the benchmark board's server tests,
which the gate's pytest phase does not run:
.venv/bin/python scripts/vue_render_parity/check.pyWhat it compares and the rules it applies are in
docs/design/vue_ssr_selected_tree_plan.md.
# From the root directory
# Python (ruff - replaces black, isort, flake8)
uv run ruff format . # Format code
uv run ruff check . # Lint code
uv run ruff check --fix . # Auto-fix linting issues
# Rust (rustfmt)
cargo fmt# From the root directory
uv run mypy packages/py/citry_core# From the root directory
cargo clippyQuality is enforced by explicit commands, not a commit-time hook. Nothing runs
automatically on git commit, so the tools never change files behind your
back; run the appropriate check when you choose and fix what it reports.
Tests provide evidence at three different boundaries. Use the narrowest one that answers the question at hand:
- While implementing, run focused checks. Run the affected test file, package check, formatter, type checker, or a few tests that could disprove the change. Repeat these freely because they should complete in seconds. A reviewer should likewise run those targeted cases, not the entire repository.
- When the touched surfaces settle, run the fast repository profile. It
runs every static, type, package, and validator phase plus the portable
non-browser Python tests, distributed by file across four workers. It omits
coverage and the small
qualificationstress slice so routine integration feedback is not dominated by instrumentation or deliberately deep boundary proofs. - At an integration boundary, one owner runs the full profile. An integration boundary is when a substantial piece of work is settled and ready for handoff, a pull request, or release. In a shared worktree, the primary integration owner waits for other edits to finish and runs the full coverage profile once. Subagents and reviewers report their focused checks; they do not each repeat the full gate. If files change after that run, the integration owner decides which evidence must be refreshed.
Browser E2E is a separate fourth lane because it requires Playwright and a
browser binary. The repository profiles always pass -m "not e2e", so their
behavior does not change merely because someone installed the optional E2E
group. Use the dedicated four-worker command in
Browser end-to-end tests, and let its Chromium and
cross-browser CI jobs provide the final browser evidence.
This ownership rule avoids concurrent full gates by practice rather than by a workspace lock. A full result belongs to the source generation it checked; it is not evidence for edits made while or after it ran.
A Rust build folder (target/) for this workspace takes 4 to 10 GB, and
several worktrees building in parallel can fill a laptop disk. When the disk
is full, no shell command can run, not even the one that would free space, so
every agent on the machine stops until someone deletes files by hand. Agents
working in a worktree follow these rules to keep that from happening:
- Run
df -h /before starting a Rust build, and do not start one with less than 6 GB free. - Give each worktree its own
target/, and do not point several worktrees at one shared folder throughCARGO_TARGET_DIR. Cargo identifies the workspace's own crates by their path inside the workspace, which is the same in every worktree, so a build in one worktree can reuse crates that were compiled from another worktree's source and test the wrong code. - Build with
CARGO_INCREMENTAL=0andCARGO_PROFILE_DEV_DEBUG=line-tables-only, and export both in every shell that builds, includinguv sync. Cargo's incremental cache (saved state for faster rebuilds) and full debug information roughly double the folder's size, and neither pays off in a short-lived worktree that rebuilds only a few times. A build without the two variables recompiles everything and stores a second copy in the sametarget/. - Build a release profile only when a measurement needs it. Release builds
keep full debug information here (
[profile.release]inCargo.toml), so deletetarget/releaseright after. - Delete a worktree's
target/once its pull request is open. Aftermaturin develop, the built extension sits inpackages/py/citry_core/citry_core/, so tests still run oncetarget/is gone. Check that a_rust.*.sofile is there before you delete it. - Count the disk each parallel agent will need before you start a batch.
Measured on this repository: a fresh worktree takes about 0.8 GB, a
private venv about 0.3 GB, and a worktree after a Rust build with the two
variables above about 1.2 to 2.1 GB. So budget 2.5 GB for each coding
agent (a built worktree plus its venv, rounded up), and count each agent
already running at 2.5 GB even while its worktree is still small. Keep
5 GB free on top. Start at most
(free GB - 5) / 2.5new coding agents, rounded down, and none when that is zero or less. Also keep to six coding agents at once, because each one runs tests and builds that compete for the same CPU and memory. A read-only research agent needs no worktree and almost no disk. - Remove a worktree when its pull request merges or closes: check that
git -C <path> statusshows no uncommitted change, rungit worktree remove <path>, delete its local branch (git branch -D, since a squash merge leaves the branch looking unmerged), and delete the venvs and build output the agent left in its scratchpad folder. Do it as part of finishing the task, not in a cleanup pass weeks later, and remove only worktrees you or your agents created. - Give each pytest run its own temporary folder. Set
PYTEST_ADDOPTS=--basetemp=/tmp/<your-folder>/pytestsoscripts/check.pypicks it up too. Use a folder no other run uses, because pytest empties it at the start of each run, and delete it when the run ends. Without this, every run on the machine shares the defaultpytest-of-<user>folder (under$TMPDIRon macOS), and cleaning that folder by age can delete files a parallel run still uses.
Test fidelity comes first, but setup cost should match the boundary under test:
- Reuse immutable, module-scoped applications, registries, catalogs, and library installations when a test is checking many inputs against the same configuration. Create a fresh instance when isolation, registration, lifecycle, cache invalidation, or failure cleanup is the behavior under test.
- Batch homogeneous render cases through one small test component instead of defining and registering a new component class for every row. Keep each row separately identified so failures remain local.
- Test source mapping and response joining with fake analyzer responses. Keep a
smaller acceptance matrix against the real
tysubprocess for transport, protocol, environment, and lifecycle boundaries. Cache immutable executable validation within one server process; never share analyzer state across unrelated temporary workspaces. - Inject short shutdown/request bounds into lifecycle tests. Production timeout values are user-safety policy, not a duration that every unit test must sleep through.
- In Playwright, wait for the state that proves success. For debounce, throttle, polling, and timer behavior, use Playwright's clock rather than sleeping through wall time. A fixed sleep is appropriate only when elapsed real time is itself the contract.
- Mark an unusually expensive stress or depth proof with
qualificationonly when a cheaper test already covers the ordinary behavior. The fast profile omits that marker. The full profile runs it in a separate two-worker phase without coverage instrumentation, and the Python version matrix retains it. - Mark a browser test
weeklywhen it is too slow to run on every pull request, such as a guard that walks every browser scenario. The pull-request e2e job runs-m "e2e and not weekly", and the weekly cross-browser job (py--tests-cross-browser.yml) runs-m e2e, so it includes these tests. Give aweeklytest thee2emarker too. Without it, the ordinarynot e2ejobs run the test on every pull request. - Citry renders on two paths: the native (Rust) render path on standard
CPython and the Python path everywhere else
(
native_render.md). Tests run on the native path by default. A test of the Python evaluator's own internals asks for thepython_render_pathfixture; a test that must hold on both paths asks forrender_path, or compares them withrender_bothfrompackages/py/citry/tests/_render_paths.py.pytest --python-render-pathruns a whole session on the Python path (tests that ask forrender_pathor callrender_bothstill run both), as the ubuntu / Python 3.11 CI cell does. Run it once locally before opening a pull request that touches rendering. The option exists only when the run includespackages/py/citry/tests, as a run from the repository root does. SetCITRY_NATIVE_RENDER=0to do the same outside pytest.
When a file becomes a load-balancing outlier under --dist loadfile, first
remove avoidable waits and repeated setup. Split the file only when it still
contains independent fixture groups large enough to schedule separately.
# Routine integration: all repository phases and non-browser tests, without
# coverage. This is the profile agents normally run after focused checks.
python scripts/check.py --profile fast
# Final integration: the same non-browser phases with the coverage threshold.
# With no --profile argument, `full` remains the backward-compatible default.
python scripts/check.py --profile full
# Machine-readable: progress and 30-second heartbeats go to stderr; stdout ends
# with one JSON object containing the profile, phase status and duration, and
# the tail of any failing phase's output.
python scripts/check.py --profile fast --reporter agent
# Run only the custom validators (fast; no compiling or tests).
uv run --no-sync python scripts/validate.pycheck.py only checks; it never edits files. It assumes the workspace is set
up (uv sync --all-packages, plus pnpm install for the pinned Node tools)
and that cargo, uv, node, pnpm, and the Rust toolchain are on PATH. The
human and JSON reports include each phase's elapsed time and the total. In
agent mode, phase starts, finishes, and a heartbeat every 30 seconds go to
stderr while stdout remains a single parseable JSON result. Both profiles run
the non-browser pytest suite with -n 4 --dist loadfile --durations 30. The
main pytest phase selects not e2e and not qualification; the full profile
enables pytest-cov there, enforces the repository threshold, and then runs the
qualification and not e2e stress slice separately without coverage.
The main pytest phase also records every Vue page the tests prepare into a
temporary directory for that gate run, and the vue render parity phase
compares those pages with Vue's server renderer (see "Vue render parity
check" above).
Coverage measures shipped runtime modules. It omits tests, repository-only
qualification helpers, subprocess adapters whose execution belongs to child
processes, and Citry UI's public demo snippets/, which are excluded from the
wheel and verified through the docs and UI scenario suites. The threshold is a
ratchet immediately below the current measured runtime coverage; raise it as
focused tests recover headroom.
Before the first Node phase, the pnpm install phase runs
pnpm install --frozen-lockfile --offline, so every Node phase builds with the
dependencies pnpm-lock.yaml names. It is a quick no-op when the install
already matches. When pnpm's store lacks a locked package, the phase fails with
ERR_PNPM_NO_OFFLINE_TARBALL; run pnpm install --frozen-lockfile once with
the network, then re-run the gate.
The pyright phase runs the pinned pyright from node_modules alongside mypy.
The package-local Node phases run pnpm run check for citry-client, the docs
playground, and the VS Code language extension. The VS Code check also fails
when the rebuilt out/extension.js differs from the committed copy while none
of its sources, package.json, tsconfig.json, or pnpm-lock.yaml changed,
because release qualification rejects that VSIX. When one of those inputs did
change, the check only reminds you to commit the rebuilt bundle. The citry-ui assets phase
fails when a committed, minified Citry UI file (a runtime.min.js or
production CSS) does not match the readable source it is built from, or has no
readable source at all. The
vue render parity phase
runs Node with the Vue that citry-client pins. One root pnpm install covers
all of them, the same way uv sync installs the Python tools.
The repo-specific invariants (every Python package has a Dependabot entry, the Rust bindings match the Python stub, the toolchain pins agree, every crate is a workspace member) live as small modules in scripts/validators/. They are auto-discovered: scripts/validate.py runs every <name>.py in that directory, so adding a check is just dropping in a new file (names starting with _ are skipped).
Each validator exports a check() function that returns a list of problem descriptions; an empty list means the invariant holds:
"""One line on what this invariant protects."""
from pathlib import Path
REPO_ROOT = Path(__file__).resolve().parents[2]
def check() -> list[str]:
problems: list[str] = []
# ... read files under REPO_ROOT; append a message for each violation ...
return problemsThe runner prints PASS/FAIL per validator and exits non-zero if any returns problems (or raises). There is no registration, argparse, or logging boilerplate to write: keep the module to the check logic and let validate.py (and check.py) handle running and reporting. If a validator needs an extra Python dependency, add it to the root [dependency-groups].dev.
Every uses: line in .github/workflows/ and .github/actions/ that names
a third-party action pins it to a full 40-character commit SHA, with the tag
it came from in a trailing comment:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7A tag can be moved to other code by whoever controls the action's repository, and the next run would execute that code with this repository's secrets; a SHA always names the same code.
Dependabot's github-actions entry reads the comment and opens a pull
request that moves the SHA and the comment together. Two cases need a
manual step:
- The
toolchainvalidator (scripts/validators/toolchain.py) names the SHAs of the maturin, rust-toolchain, PyPI publish, setup-uv, sccache, rust-cache and pnpm setup actions. When a Dependabot pull request moves one of them, update that constant in the same pull request. dtolnay/rust-toolchaincarries a date comment rather than a tag, so Dependabot does not update it.
To add an action, reuse the SHA other files already pin for the same tag.
For a new tag, look up its commit with
gh api repos/<owner>/<repo>/git/ref/tags/<tag>; for an annotated tag,
follow the returned tag object with
gh api repos/<owner>/<repo>/git/tags/<sha>.
The workflow_action_pins validator
(scripts/validators/workflow_action_pins.py)
fails the gate on a tag or branch reference, or on a SHA without its
comment. Local actions (./...) and docker:// images are not checked,
and neither are the example projects' own workflows under examples/,
which users copy into their own repositories.
The gate runs in CI via the repo--check.yml
workflow, which builds the workspace, installs the Node workspace, and
explicitly runs python scripts/check.py --profile full on every change (no
path filters). That run includes the Vue render parity phase.
The per-language matrix workflows (rust--tests.yml,
py--tests.yml) add cross-version,
cross-OS, and dedicated browser breadth on top of that single-environment gate.
Citry's language-neutral Events contract lives in
packages/protocol/events/v1/ and owns
Events calls, results, actions, and browser manifests. The current Vue prepared
definition/occurrence protocol lives in citry._vue.protocol and its browser
coordinator; the Vue design tracks the cutover and qualification.
The Events directory contains the prose spec, JSON Schemas, worked examples, a
standard-library-only Python package, and a TypeScript package. It is the
editable source. Citry ships byte-identical Python copies
under citry._protocol; refresh or check them with:
uv run python scripts/sync_protocol_python.py
uv run python scripts/sync_protocol_python.py --checkThe Events TypeScript package supplies protocol types and validation used by
the Vue Events bridge in packages/js/citry-client. The client build
combines the production Vue runtime, the fragment manager, the prepared
coordinator, and the Events bridge into citry/_vue/runtime.js; i18n has a separate generated bundle. The
coordinator is the hand-written citry/_vue/client.js; the build removes its
comments and indentation, so rebuild after editing it. The build does the same
to the hand-written development checks, citry/_vue/dev_checks.js, and writes
citry/_vue/dev_checks.min.js, the file the wheel ships. Package-local
pnpm run check commands type-check the sources, replay shared cases, and
reject stale generated files:
pnpm --dir packages/protocol/events/v1/js run check
pnpm --dir packages/js/citry-client run checktests/conformance-cases.json holds surgical mutations that require matching
Python and JavaScript issue paths and categories. A schema constraint means one
concrete structural rule at one schema location. The companion
tests/constraint-ownership.json groups every such rule under named Python
and JavaScript validator functions and supporting test files. Counts and
content fingerprints make a schema edit fail until its validator assignment
is reviewed. Run the Events protocol audit with:
uv run python -m packages.protocol._tooling.check \
packages/protocol/events/v1The report deliberately keeps complete ownership assignment separate from the smaller exact-mutation count. Relationship rules such as reference integrity and cycle rejection live in the named valid/invalid fixture corpora because JSON Schema does not express them.
The publish workflow builds one wheel and one source distribution. Its smoke job then builds a second wheel from the source distribution in a temporary directory outside the checkout and runs:
python scripts/verify_citry_distribution.py --dist-dir distThe verifier compares every installed citry/ source file with both wheels
and the source distribution, compares the two wheels member by member, and
installs each wheel into its own fresh environment. The installed checks run
outside the repository with Node absent from PATH and without jsonschema.
They exercise both embedded protocol packages, the three browser files
(the runtime, the development checks, and the i18n plugin), the typing marker, the top-level import, and citry --help. Both wheels must also
stay below the release size cap, MAX_WHEEL_BYTES in the verifier.
Pull requests run the wheel part of this check earlier. The citry-ui-wheel-build
job in the Python tests workflow already builds the citry wheel, and checks its
filename, metadata, RECORD, file list, and size with:
python scripts/verify_citry_distribution.py --check-wheel dist/citry-[0-9]*.whlThe same job checks the citry-core wheel it builds for Linux with
verify_citry_core_distribution.py check-wheel. It also builds citry-lsp and
pygments-citry and runs their release verifiers with --skip-install-smoke.
That checks the wheel, the sdist, and a wheel rebuilt from the sdist, leaving
only the install smoke test to release qualification.
That job starts with a size check, before the checks above. It runs
scripts/check_package_sizes.py on every
wheel and source distribution the job built and prints each file's size next
to its cap. It writes a GitHub Actions warning for a file at 90 percent of its
cap or more. When a file is over its cap, it writes an error for that file and
fails the step, so the pull request that grows a package fails here instead of
the release failing. The release checks below stop at the first file they
reject, but this step lists every file that is over its cap. When this step
fails, the later checks in the job are skipped.
The script reads each cap from the verifier that enforces it
(MAX_WHEEL_BYTES or MAX_SDIST_BYTES), so no number is written twice, and
the warning and the error name the constant to raise. When the growth is
expected, raise that constant in the pull request that causes it.
A file of exactly the cap passes, as it does in the release checks. The script also fails its step when a file is missing or it has no cap for it. The release checks enforce the caps for every wheel and for the LSP and Pygments source distributions. Only release qualification runs the citry-ui source distribution through a verifier, so this step is the only check on that file's size before release qualification. The VS Code extension's file is not built in this job, so it has no size check here.
The main test workflow has a separate i18n release-qualification job. It builds
the native extension in release mode, runs benchmarks/i18n.py, checks the
browser i18n payload, and uploads the machine-readable result. The Citry UI
wheel job also builds a source distribution, rebuilds the wheel from it, and
requires both wheels to contain the same checked catalog package. Its installed
production smoke resolves a real Citry UI message without parsing package FTL.
During active development, citry can need an unreleased companion
citry-core change. Build that wheel explicitly and pass it to the same
isolated proof:
uv build --package citry-core --wheel --out-dir dist/core
python scripts/verify_citry_distribution.py \
--dist-dir dist \
--core-wheel dist/core/citry_core-*.whlCandidate preparation passes the locally built Core wheel when Citry Core is selected in the same plan. This qualifies the unreleased pair concurrently. During promotion, the controller still publishes and verifies Core before it starts Citry, whose public dependency must then resolve to those exact bytes.
Each workflow that runs on pull requests or on pushes to main and dev
puts a run in a concurrency group (GitHub runs one run of a group at a time)
named after the workflow and either the pull request or, for a push, the
branch. Three workflows that run on a push to main are exceptions, listed
below. A newer run then cancels the older one still going in that group:
- A new commit on a pull request cancels the checks for the previous commit.
- A new push to
main(ordev) cancels the checks still running for the previous push. The older commit then has no complete result from those checks, though the repository Check still finishes. The newer commit's run tests the older commit's changes too, so a failure the older commit introduced shows up on the newer one. Release step 5 below says how to get a result for the release commit itself. - A scheduled or manual run gets a group of its own, named after its run ID, so no other run cancels it.
Three workflows that run on a push to main never let a newer push cancel a
push run:
repo--check.yml, because release step 5 requires a complete repository Check result for the release commit itself. It still cancels an older run for the same pull request.repo--docs-deploy.yml, because a cancelled deploy publishes nothing, so if the newer run then fails, the site stays on a deploy older than both commits. Itspagesgroup still keeps at most one newer run waiting.repo--release-candidate.yml, because it starts the publish workflows that qualify a release and waits for them.
The publish workflows start only when the release candidate or
repo--release.yml dispatches them. repo--release.yml starts only by hand,
and it starts repo--docs-release.yml once the packages are published. None
of them cancels a started run, at the workflow or the job level.
packages/py/citry/tests/test_ci_workflows.py checks the concurrency settings
these rules depend on.
Use py--diagnostic.yml to reproduce
one Python failure on a selected hosted OS and supported Python version. Its
default citry profile on ubuntu-latest installs Citry and Citry's test
dependencies, plus the small root tooling group used by Citry's repository
policy tests. Select citry-core, citry-lsp, citry-ui, or
pygments-citry when the target belongs to another package. full-workspace
installs every package's development environment for failures that depend on
their interactions. None of the profiles installs browser, documentation, or
benchmark dependency groups.
A package profile installs that package's declared development dependencies.
Tests for optional host integrations may skip when their optional host is not
part of that profile. Select full-workspace when the missing host interaction
is what the diagnostic needs to exercise.
In the GitHub Actions UI, open Python diagnostic, choose Run workflow,
select the branch or tag, then set runner_os, python_version,
install_profile, core_wheel_mode, and pytest_target. The target must be
an existing test_*.py file or node ID inside the selected package. The
validator rejects browser and benchmark paths, cross-profile paths, path
traversal, multiple targets, and pytest options. The validated value is passed
to pytest as one literal argument, and pytest also excludes the e2e marker.
The equivalent command-line dispatch is:
gh workflow run py--diagnostic.yml \
--ref review \
-f runner_os=macos-latest \
-f python_version=3.14 \
-f install_profile=citry \
-f core_wheel_mode=reuse \
-f pytest_target='packages/py/citry/tests/test_server_reload.py::test_development_server_hot_reloads_assets_and_restarts_python[django]'Profiles that import Citry Core tell uv sync to omit the editable Core
package. Setup then installs the exact cached or newly built wheel. The wheel
key includes the hosted runner image version, OS, and architecture; the full
Python runtime and ABI; the resolved rustc -Vv and uv versions; and a digest
of the tracked Cargo workspace, Rust sources, Ruff submodule commit, patched
vize crates, Core package contents, lockfiles, root build constraints, and
toolchain configuration, selected by the same rule as the shared CI wheel in
scripts/citry_core_wheel.py. The digest also
covers the workflow and its setup helper, so a build-recipe change cannot reuse
a wheel built by the previous recipe. There are no prefix restore keys: only
an exact match can be installed. A manifest beside the wheel records its cache
key, filename, and SHA-256 digest. Setup verifies all three, installs the
wheel, and imports its extension before a new cache entry can be saved.
On an exact wheel hit, the workflow skips submodule initialization and native
compilation. On a miss, it initializes the Ruff submodule, enables the GitHub
Actions backend for sccache, builds the wheel, records its manifest, and
installs and imports it. In reuse mode, the workflow then saves the verified
wheel before pytest runs. This timing preserves the build when the selected
diagnostic test fails. core_wheel_mode=rebuild bypasses the wheel cache and
exercises the native build through sccache; use it when the build itself is
under investigation. The setup result appears in both the job log and job
summary.
The build first runs uv lock --check to verify the Python workspace lock.
The Core package also sets tool.maturin.locked = true, so Cargo verifies and
uses Cargo.lock while building the native extension.
GitHub scopes Actions caches by key, cache version, and branch. Repeated runs on one investigation branch can reuse that branch's exact wheel. A matching cache populated on the default branch is also available to other branches, but a wheel first saved on one feature branch is not a general cross-branch cache for sibling branches. Cache eviction can still turn a later run into a safe miss and rebuild.
Start CI investigation with the narrowest failing node ID, and repeat that
target while diagnosing. After the fix passes focused local checks, run
python scripts/check.py --profile full once at the final integration
boundary and let the ordinary pull-request workflows provide the required
matrix and browser evidence. A green diagnostic run is supporting evidence;
it does not replace the full gate.
To add a new tooling dependency (like a linter, formatter, or test utility) that should be available across the entire codebase:
-
Edit the root
pyproject.tomlfile -
Add the package to the root
devdependency-group. Use this only for repo-wide tooling; a dependency used by a single package belongs in that package's own[dependency-groups]instead:[dependency-groups] dev = ["maturin>=1.10.2", "ruff>=0.10.0", "mypy>=1.0.0", "your-new-tool>=1.0.0"]
-
Install the new dependency:
# From the root directory uv sync --all-packages -
Use the tool:
# From the root directory uv run your-new-tool
Runtime extras on the citry package (the pip install citry[...] surface, as
opposed to the root dev/ci tooling extras above) are namespaced
citry[<category>-<name>] so the extras namespace stays collision-free and has
room to grow. Three categories exist so far:
-
analysis-<backend>: an analysis backend used by editor or static-analysis tooling.citry[analysis-ty]installs the pinnedtytype checker so Citry can resolve Python expression types.citry-lsppins the same backend directly because it owns the analyzer process and releases independently of Citry. Ordinary runtime users do not need it. -
watcher-<backend>: a file-watcher backend for hot reload, e.g.citry[watcher-watchfiles],citry[watcher-watchdog]. Seedocs/design/hot_reload.md. -
ext-<name>: an optional or bundled extension and its dependencies, e.g. a futurecitry[ext-storybook].
Rules:
- Always include the category prefix. Do not add a bare
citry[watcher]orcitry[storybook]: an unprefixed token reads ambiguously (iswatchera backend name or a category?) and risks colliding with a future package or extension of the same name. - Import the optional dependency lazily, inside the module that needs it, so
plain
import citrynever requires it (the contrib adapters anddocs_site/_internal/cli.pyare the precedent). - Declare each dependency once, at its owner. Runtime extras stay on the
citrypackage. A dependency imported only by that package's tests belongs in its[dependency-groups].dev. Only repo-wide tools belong in the root dev group. The uv workspace installs every member's selected groups into the shared environment withuv sync --all-packages, so no root mirror is needed. Refreshuv.lock, and grep CI workflows before changing a pin because jobs may select groups or extras explicitly. This is the landed workspace model from #8.
To add a new third-party dependency as a git submodule:
-
Determine the location: Submodules are organized by language in
third_party/:- Rust -
third_party/rust/ - Python -
third_party/py/ - ect..
- Rust -
-
Add the submodule:
# From the root directory # Example: Adding a Rust crate git submodule add https://github.com/example/upstream-repo.git third_party/rust/upstream-repo # Or for a specific tag/branch git submodule add -b v1.0.0 https://github.com/example/upstream-repo.git third_party/rust/upstream-repo
-
Update documentation: Add an entry to
third_party/README.mddocumenting:- What the dependency is for
- Where it's used
- License information
- Update policy
-
Update references: If the submodule is used in code (e.g.,
Cargo.tomlfor Rust), update path references to point to the new location. -
Commit the changes:
git add .gitmodules third_party/rust/upstream-repo third_party/README.md git commit -m "Add upstream-repo as submodule"
Initializing submodules (for new clones):
# Initialize all submodules
git submodule update --init --recursive
# Or initialize a specific submodule
git submodule update --init third_party/rust/upstream-repoUpdating a submodule:
# Navigate to the submodule
cd third_party/rust/upstream-repo
# Fetch latest changes
git fetch origin --tags
# Checkout a specific tag/commit
git checkout v1.2.0
# Return to root and commit the update
cd ../../..
git add .gitmodules third_party/rust/upstream-repo
git commit -m "Update upstream-repo submodule to v1.2.0"To keep track of the current version, update the comment in the .gitmodules file.
Verifying builds after updating a submodule:
After updating an upstream submodule, always verify that everything still builds. Upstream packages may introduce new dependencies that need to be added to the workspace Cargo.toml.
For example, when I upgraded ruff from v0.14.0 to v0.14.10, they added datatest-stable as a Rust dependency. So it had to be added to our root Cargo.toml:
When adding a new Rust dependency to any crate in the workspace, follow these guidelines to ensure version consistency across the entire workspace:
-
Add the dependency to the root
Cargo.toml: All dependency versions should be specified and pinned in the rootCargo.tomlunder the[workspace.dependencies]section.[workspace.dependencies] your_new_dependency = { version = "1.2.3" }
-
Use
workspace = truein individual crates: Individual crates should reference the workspace dependency usingworkspace = true, not specify versions directly:# In crates/your-crate/Cargo.toml [dependencies] your_new_dependency = { workspace = true }
This ensures the entire workspace uses the same version of the dependency, preventing version conflicts and reducing binary size.
-
Document upstream dependencies: If the dependency was introduced because it's required by an upstream third-party package (like
ruff), add a comment in the rootCargo.tomlto document this:# Used by ruff_python_parser datatest-stable = { version = "0.3.3" }
This helps track which dependencies are direct requirements vs. transitive requirements from upstream packages.
Example: Adding a new dependency to python_safe_eval:
-
Add to root
Cargo.toml:[workspace.dependencies] # Used by python_safe_eval serde_json = { version = "1.0.113" }
-
Add to
crates/python_safe_eval/Cargo.toml:[dependencies] serde_json = { workspace = true }
-
Run
cargo buildto verify it works.
When adding a new package to the monorepo (either a new Rust crate or a new Python package), you need to make sure its dependencies are watched.
No Dependabot entry to add for a Rust crate. Dependabot's cargo ecosystem is turned off for the whole workspace, because Dependabot cannot load a workspace whose path dependencies point into the third_party/rust/ruff submodule (#76). The full reasoning sits beside the commented-out entry in .github/dependabot.yml.
Declare the crate's external dependencies in the root Cargo.toml under [workspace.dependencies]. The rust-audit job in repo--security.yml runs cargo deny check advisories, which checks them against RustSec, the Rust security advisory database. It runs on pull requests that change a lockfile or manifest, on pushes to main, and every Monday, and the Monday run opens a tracking issue when it fails. Accepted advisories are listed in deny.toml, each with its reason and tracking issue. A Rust dependency changes version only when someone opens a pull request that bumps it.
You must add a Dependabot entry for each new Python package that has its own pyproject.toml with dependencies.
-
Create the new Python package in
packages/py/your-package/with its ownpyproject.toml -
Add a Dependabot entry in
.github/dependabot.yml:# Python - your-package - package-ecosystem: "pip" directory: "/packages/py/your-package" schedule: interval: "weekly"
-
Verify the configuration by checking that Dependabot can detect the package's dependencies.
Note: The root pyproject.toml already has a Dependabot entry for tooling dependencies (ruff, pytest, mypy, etc.). Each Python package with its own dependencies needs its own entry.
Example: If you add a new Python package packages/py/citry/, you would add:
- package-ecosystem: "pip"
directory: "/packages/py/citry"
schedule:
interval: "weekly"Why pip and not the uv ecosystem, and how uv.lock stays in sync. The
entries use package-ecosystem: "pip" on purpose. Dependabot's newer uv
ecosystem would update uv.lock for you, but its uv-workspace support is still
immature, and the root pyproject.toml uses [tool.uv.sources] with
{ workspace = true }, which trips a known Dependabot uv parse bug. pip bumps
each package's pyproject.toml correctly but does not touch uv.lock, so the
Check gate would otherwise fail at uv sync --locked. The
repo--dependabot-relock.yml
workflow closes that gap: on a Dependabot PR it runs uv lock and commits the
refreshed uv.lock back to the PR branch. If no token is configured it instead
comments on the PR with the manual uv lock command and fails, so a missing or
expired token never silently blocks a PR.
Setting up the relock token. The push has to use a token that is not the
default GITHUB_TOKEN (a GITHUB_TOKEN push does not re-trigger the Check
gate, so it would stay red). Store it as a Dependabot secret (repo Settings
-> Secrets and variables -> Dependabot, not the Actions tab), because a
Dependabot-triggered run can only read Dependabot secrets. Two options:
-
Org GitHub App (recommended, not tied to one person). An org-owned App is free on any plan and does not depend on one person's account. The mental model to hold: ownership and installation are two separate things, and you need both. Owning the App lets the org control it (its settings and key) but grants access to no repositories; installing it is what gives it repo access and creates the installation the workflow mints a token from. Set it up once:
- Register it under the org at
https://github.com/organizations/citry-dev/settings/apps/new(Organization citry-dev->Settings->Developer settings->GitHub Apps->New GitHub App; you must be an org owner). Already made it under your personal account? Do not recreate it, transfer it: your accountSettings->Developer settings->GitHub Apps-> the App ->Advanced->Transfer ownership->citry-dev. - Give it write access to code. In the App's permissions set
Repository permissions->Contents: Read and write; that is what lets it push theuv.lockcommit. - Install it on the repo (owning it is not enough, and this is the step
people miss). App page ->
Install App-> install oncitry-dev->Only select repositories->citry(or all). If a personal App showed no org to install on, that was itsWhere can this GitHub App be installed?setting defaulting to "Only on this account". - Approve any pending permission change. If you set or changed
Contents: Read and writeafter installing, GitHub holds it as a request an org owner must approve, or the token will not actually have write access. - Store the credentials as Dependabot secrets. Copy the numeric
App IDandGenerate a private key(downloads a.pem); add them as the Dependabot secretsRELOCK_APP_IDandRELOCK_APP_PRIVATE_KEY. The workflow mints a short-lived installation token from these on each run (actions/create-github-app-token), so no long-lived token is stored.
- Register it under the org at
-
Fine-grained PAT (simpler, but personal and expiring). Create it on your own account at
Settings->Developer settings->Personal access tokens->Fine-grained tokens, withResource owner: citry-dev,Repository: citry, andRepository permissions->Contents: Read and write. The org must allow fine-grained PATs (Organization citry-dev->Settings->Personal access tokens). Add it as the Dependabot secretRELOCK_TOKEN. Prefer the App for anything long-lived, since a PAT stops working when its owner leaves or it expires.
If neither is set, the workflow still runs: it posts a PR comment with the exact
uv lock command and fails, so the fix is one copy-paste away.
UV can manage multiple Python versions automatically:
# Install a specific Python version
uv python install 3.11
# Use a specific version for this project
uv python pin 3.11
# Sync with that version
uv sync --all-packagesCI installs the workspace from the lockfile, but it does not let uv sync
compile the citry-core Rust extension in every job. Compiling it takes about
5 minutes on Linux, 12 on Windows and 20 on macOS, most of it in the
link-time optimization step that runs when citry_core_py is linked, which
no Rust cache can skip. Instead,
CI builds one citry-core wheel per OS, caches it, and installs it in each job:
- The
citry-core-wheelaction names the wheel by a cache key and restores it from the GitHub Actions cache. Only an exact key match counts. - When nothing matches, the action fetches the Ruff submodule, installs the
Rust toolchain, and runs
python scripts/citry_core_wheel.py build. That builds the wheel withuv build, theabi3-py311feature and therelease-wheelprofile (the feature and profile of the published CPython wheel), imports it in a throwaway environment, writes amanifest.jsonwith the wheel's name, SHA-256 digest and cache key, and saves both under the key. - The job then runs
python scripts/citry_core_wheel.py installwith its ownuv syncselections after--. It checks the manifest, runsuv sync --locked <selections> --no-install-package citry-core, installs the wheel in place of the editable package, and imports the extension.
python scripts/citry_core_wheel.py install \
--wheel-dir "$RUNNER_TEMP/citry-core-wheel" -- --all-packagesThe cache key is a hash of every tracked file that can change the wheel:
the root Cargo.toml and Cargo.lock, rust-toolchain.toml, anything
under .cargo/, every crate file except its Markdown and its tests/,
benches/, examples/ and docs/ folders, everything under
third_party/rust/ (the Ruff submodule counts as its commit, the patched
vize crates as their files), the Python package, metadata, README and
license files of packages/py/citry_core, the root pyproject.toml's
build-constraint-dependencies (which pin maturin), the action and the
script themselves, the uv version, and the runner's OS, architecture and
image family. So a pull request that changes Rust code always builds and
tests a new wheel, and one that changes only Python reuses the wheel the
last run built from the same Rust sources. A change to the Python files
inside packages/py/citry_core/citry_core also rebuilds the wheel on every
OS, because those files ship in it. The script reads the hashes from
the Git index, so it computes the key before the Ruff submodule is checked
out. The build also drops RUSTUP_TOOLCHAIN, RUSTFLAGS, MATURIN_PEP517_ARGS
and similar variables, because the key does not cover them.
py--tests.yml builds the wheel once per run in three jobs,
citry-core-wheel-linux, citry-core-wheel-windows and
citry-core-wheel-macos, which upload it as a run artifact. The test, e2e, Vue
conformance, i18n qualification and citry-ui-wheel-build jobs download that
artifact rather than reading the cache, so a cache eviction during a run cannot
fail them. They run whenever their wheel job ran, even after it failed, so a
broken build fails the required citry-ui-wheel-build check rather than
letting it pass as skipped. The test matrix is split into one job per OS
(test-linux, test-windows, test-macos, all shown as test), so each cell
waits only for its own OS's build, and the Linux-only jobs wait only for the
Linux build. The Check, docs check, docs deploy, docs release, Lighthouse,
external-link and cross-browser workflows call the action directly, so they
build the wheel themselves only when no earlier run cached it.
GitHub scopes the cache by branch: a wheel saved on main serves every pull
request, and a wheel first saved on a pull request serves only that pull
request's later runs. A job that installs the wheel must not run uv sync
again without --inexact --no-install-package citry-core, and must call
uv run with --no-sync; otherwise uv replaces the wheel with the editable
package and compiles it.
The jobs that test other interpreters or the release artifacts build their
own extension: py--alt-interpreters.yml (free-threaded CPython and
PyPy, which the limited-API wheel does not serve), the publish workflows,
the release-tag build in repo--docs-release.yml and the example-project
tests (which build with the minimum supported Rust), and
py--diagnostic.yml, which caches a wheel for one interpreter with the
same input selection.
The logo is the characters C3, which is how the name sounds read aloud: say
the ci of citry as the English letter C and what is left is tri, Slovak for
three. It is a pun on the name, not a version number.
Everything that shows the logo is cut from two SVG files, and nothing else is drawn by hand:
| File | What it is |
|---|---|
docs_site/static/img/citry-icon.svg |
The mark on a square frame, for anything sitting in a square slot |
docs_site/static/img/citry-mark.svg |
The same two paths on a wide frame, for anything sitting beside text |
Both take their colour from the surrounding CSS through currentColor, except
the square one, which sets its own and flips with the reader's theme because a
favicon loads as its own document with no stylesheet around it.
Every PNG is a screenshot of one of those two SVGs. After changing the artwork, run:
uv run --no-sync python docs_site/scripts/icons.pyThat writes the browser and phone icons into docs_site/static/img/
(favicon.svg, favicon-16.png, favicon-32.png, favicon.png,
apple-touch-icon.png), the README wordmark and the profile picture into
docs/assets/, and the VS Code Marketplace icon into
packages/editors/vscode/images/. It needs Playwright and a Chromium binary
(uv sync --extra social-cards, then playwright install chromium). Do not
hand-export a PNG or edit one in an image editor: the next run overwrites it,
and the file drifts from the drawing in the meantime.
Three of the outputs are drawn on a white ground rather than a transparent one, because their host fills transparency with something unpredictable: iOS paints a home-screen icon's transparency black, a chat client composites a link preview against its own theme, and GitHub shows a profile picture on both. The rest are transparent.
In the docs site, do not paste the path data. The
<c-citry-mark /> component holds
it, and both the site header and the social-share card render through it. Pass
css_class when a stylesheet sizes and colours it, or color with width and
height when there is no stylesheet to read (the card is screenshotted on its
own, so it states both).
When the mark stands beside the name, it sits slightly shorter than the
letters. The site header is the reference: a 1rem mark against a 1.05rem
name, spaced 0.5rem apart (.djc-logo in docs_site/static/css/site.css).
The README wordmark and the card footer are built from those same two
proportions, so all three read as one lockup. They do not follow the stylesheet
automatically, so retuning the header means retuning
MARK_TO_NAME and GAP_TO_NAME in docs_site/scripts/icons.py and the mark
size in og_card.py.
A README that ships outside the repository (PyPI, the VS Code Marketplace) is
rendered on that host's own domain, where a repo-relative path such as
docs/assets/citry-wordmark.png or ./LICENSE resolves against their site and
404s. GitHub resolves the same path fine, so the breakage is invisible until
someone opens the package page. Every reference in those files therefore has to
be absolute: images at https://raw.githubusercontent.com/..., repository files
at https://github.com/citry-dev/citry/blob/.... The
published_readme_links validator enforces this, so a relative path fails the
gate rather than shipping.
PyPI stores the rendered project description in each release's uploaded
metadata. Editing a package README on main does not change an already
published version; the new description appears with that package's next
release. Do not create an otherwise-empty patch release merely to refresh the
description unless maintainers explicitly choose to do so.
A released description never changes, and a link to main in it would break
as soon as the file moves or is deleted. Still write main links in a package
README, because they render on GitHub and stay current there. Each publish
workflow rewrites them to the package's release tag when it builds the package.
Each publish workflow sets the CITRY_RELEASE_TAG_PREFIX environment variable
to its package's tag prefix, such as citry-ui@. It is the same prefix
scripts/release.py uses to name the release tag. Every job that builds the
package runs this step just before the build (shown here for citry-ui):
python3 scripts/release_links.py pin packages/py/citry_uiThe command appends the version from the package's pyproject.toml (or
package.json for the VS Code extension) to the prefix. That gives the tag
the release will create, such as [email protected]. It then points each file,
folder, or raw link on main in the citry-dev/citry repository at that tag.
That covers the github.com/citry-dev/citry/blob/main/, tree/main/, and
raw/main/ forms, raw.githubusercontent.com/citry-dev/citry/main/, and the
long refs/heads/main spelling. It rewrites the README.md, CHANGELOG.md,
pyproject.toml, and package.json directly inside that package directory.
For citry, whose README is a link to the root README.md, it rewrites the
root file. The workflow never commits the rewritten files.
Each publish workflow creates the tag only after it publishes the package, so the rewritten links do not resolve yet while it checks the built package. Nothing fetches them during the release.
The command fails, and the build stops, when the variable is unset or is not a
<package>@ prefix, when the manifest has no X.Y.Z version, or when the
package directory does not exist. If you run it yourself with the variable
set, it rewrites your working copy.
The scripts/verify_*_distribution.py scripts, which check each built package
before it is published, read the same variable. When it is set, they check
three things:
- The package's copies of those files match the rewritten files, so a package built without the rewrite, or for another version, fails.
- A wheel's
METADATA, an sdist'sPKG-INFO, and the VSIX manifest contain no link tomainin this repository, even in a form the rewrite does not cover, such ascommits/main. Change such a link by hand. "Edit this page" links (edit/main/) are allowed, because an edit is always made onmain. - The same files have no file, folder, or raw link pinned to another version
of the same package, such as an older
[email protected]. Links to another package's tag, andcompare/ranges, are allowed: they name releases that already exist.
When the variable is not set, as in pull-request CI and local runs, they expect the files exactly as the repository holds them.
The published_readme_links validator fails when a package publishes a README
but scripts/release.py does not list the package, when its publish workflow
does not set the tag prefix that scripts/release.py uses, or when that
workflow has no release_links.py pin step for the package directory.
The root README (which PyPI shows as the citry description) repeats the
landing page's two benchmark sections, each with its chart as two PNGs, one
for a light page and one for a dark page:
errors, "Catch mistakes early": a screenshot of the same<c-error-benchmark-chart>the landing page draws fromdocs_site/data/error_prevention.json.speed, "Python at JavaScript speed": a screenshot of the same<c-benchmark-chart>the landing page draws fromdocs_site/data/benchmark_time_to_interactive.json, with the landing card's bar colours.
After a benchmark's data changes, redraw its chart (name errors, speed,
or both; with no name, the script redraws both):
uv run --no-sync python -m docs_site.scripts.benchmark_images speedThe script writes the images to docs/assets/benchmarks/ and rewrites the
chart's README block between its benchmark-chart:<chart> comments: the
heading, the sentences around the image, the image links, and the alt text,
which lists every framework's number. It needs Playwright and a Chromium
binary, like icons.py. Do not edit the blocks by hand. Redraw a chart only
after its data or style changes: fonts and Chromium render a little
differently on each machine, so a run elsewhere draws new files even when
nothing changed.
The sentences around each chart, such as the intro, the hint above the error
chart, and the note that names the Citry version, come from functions in
docs_site/scripts/benchmark_readme.py. The landing page prints the same
sentences with <c-benchmark-text part="..." />, so the two cannot drift.
Add each new benchmark run's version note to VERSION_NOTES (errors) or
SPEED_VERSION_NOTES (speed, keyed by the report Citry's numbers come from)
in that file; until you do, the docs build and the validator fail.
Each file name holds the chart, the benchmark run, and a hash of the image,
for example errors-20261021T182412Z-33f45034c4c4-light.png. The script
never overwrites a file: a new run or a redrawn chart gets a new name, and
the old file stays on main for the released pages that load it. Commit the
new files with the README change.
The readme_benchmark_charts validator rebuilds each README block from its
data and fails when the two differ, when a linked image is missing or belongs
to the other chart, or when an image no longer matches the hash in its name.
It also fails when the landing page loses a section heading the README
repeats (HEADINGS in benchmark_readme.py). It does not compare pixels, so
after a style change to a chart, rerun the script yourself.
The README section "Monitoring vulnerabilities across the ecosystem" says
how many security advisories from other frameworks and libraries the
maintainers checked Citry against, with a graphic of each project and its
count. The landing page shows the same section. Both are built from
docs_site/data/advisory_watch.json: each project's name and count, the
total (which must equal the sum of the counts), and the month the numbers
are as of. The counts come from the maintainers' private advisory survey
(see CLAUDE.md, Mechanism 8).
After the data changes, run:
uv run --no-sync python -m docs_site.scripts.advisory_watchThe script draws the graphic as two SVG files (light and dark) in
docs/assets/advisories/ and rewrites the README block between its
advisory-watch comments. It needs no browser, and the same data always
gives the same files. Like the benchmark images, each file name holds a
hash of the file, and the script never overwrites a file, because released
PyPI pages keep loading the files they were published with. Commit the new
files with the README change.
Each project's circle sits at a spot picked by hand, in POSITIONS in
docs_site/scripts/advisory_watch.py, so a new project needs a spot there;
the script stops until it has one. The "How we check advisories" section of
docs_site/content/security.md lists the watched projects and the first
review's numbers in plain text, so update it by hand as well.
The landing page prints the sentence, the graphic, and the note with
<c-advisory-watch part="..." />. Its graphic is inline SVG coloured by
the site's CSS color variables, so the theme toggle recolours it. The
readme_advisory_watch validator redraws the README block and both files
from the data and fails when they differ, when a file changed after it was
written, or when the landing page loses the heading.
The first VS Code release used this practical macOS workflow. It favors crisp, readable editor text over the smallest possible file:
- Record the editor with macOS Screen Recording or QuickTime Player. Hide notifications and avoid personal paths, branch names, SSH host/user names, tokens, and unrelated editor chrome before recording when possible.
- Import the recording into DaVinci Resolve on its own timeline. Set the timeline resolution to the recording's native resolution before editing so text is not resampled prematurely.
- Cut idle sections and speed up slow interactions where useful. The clip should demonstrate one outcome without making the cursor difficult to follow.
- In Deliver, export as GIF at the timeline resolution and frame rate with a 128-color palette.
- If Resolve emits an unnecessarily high frame rate (the first clips used 18 FPS), open the GIF in Preview, show the individual frames, and remove every second frame. Replay the result to confirm the timing still reads naturally; depending on the stored frame delays, deletion may also speed up the clip. GIFs store frame-to-frame changes rather than behaving like a simple stack of independent images, so halving the frame count can reduce bytes by much more than half.
- If the result is still too large, render again at two-thirds of the original width and height. Half-size editor captures were too blurry in the first release; two-thirds retained readable code while cutting substantially more data.
- For last-resort redaction, Preview can edit individual frames: paste the same opaque rectangle over the sensitive region in every frame. Scrub the entire GIF afterward so no single transition leaks the covered content.
Keep each Marketplace GIF below roughly 5 MiB when practical, but do not trade
away code readability merely to hit the target. Store the source GIFs under the
extension's images/ directory, reference them through absolute raw GitHub
URLs, and exclude them from the VSIX because they are listing media rather than
runtime assets.
A GitHub organisation profile picture and a repository social-preview image can
only be uploaded through the web interface; there is no API for either.
docs/assets/citry-avatar.png is the file to upload for the profile picture.
<c-youtube-video> shows a play button until the visitor clicks it, and loads
nothing from YouTube or Google before that. When you add a video or re-record
one, save its thumbnail so the box shows a picture instead of a plain dark
background. The video id is the part after v= in the video's watch URL:
uv run --no-sync python \
-m docs_site.scripts.youtube_thumbnail <video id>The script saves YouTube's 1280 by 720 picture, or the 480 by 360 one when
YouTube has no large version, as
docs_site/static/img/video-thumbnails/<video id>.jpg. It prints the
thumbnail value to copy into the component:
<c-youtube-video
video_id="d3nPqvDdNB0"
title="50-minute Citry and Django code-along"
thumbnail="/static/img/video-thumbnails/d3nPqvDdNB0.jpg"
/>
The picture is a file in this repository because a thumbnail linked from
i.ytimg.com (YouTube's image server) would send the visitor's IP address to
Google when the page loads. So a thumbnail that does not start with
/static/ stops the docs build with an error that names the value. Without a
thumbnail, the play button sits on the plain dark box.
The script prints an error and writes nothing when any of these happens:
- The video id is malformed.
- The file already exists.
- YouTube has no thumbnail, answers with something that is not a complete JPEG, or the request fails (for example a rate limit).
A re-recorded video has a new id, so it gets a new file:
- Run the script for the new id.
- Update
video_idandthumbnailin every<c-youtube-video>(git grep -n "c-youtube-video" docs_site/content). - Keep the old file.
docs_site/versions/holds a built copy of each released docs version, and its pages load images from the shared/static/folder. Thesnapshot_static_filescheck, whichpython -m docs_site versions-checkruns, fails when a file one of those pages loads is gone.
Add --replace to the command only when the picture changed on YouTube for
the same id and every docs version should show the new one.
Rust is the source of truth for all core functionality. Language bindings are thin wrappers that expose Rust functionality to other languages.
The top-level Cargo.toml defines a workspace that includes:
- Core crates (
citry_core_py,citry_html_transform,citry_i18n,citry_native_render,citry_vue_compiler,citry_template_formatter,python_safe_eval,citry_template_parser) - Shared dependencies and toolchain configuration
- Unified linting, formatting, and testing
Shipping Rust capabilities are exposed to Python through a single binding crate,
citry_core_py, compiled to one extension module, citry_core._rust. A
Rust-to-Python binary is large (on the order of ~100 MB), so bundling every
crate into one module ships one binary instead of one per crate.
The Python-facing API is written by hand rather than left as maturin's
auto-generated re-exports. The maturin-built binary is only a Python module
(citry_core._rust); the citry_core package wraps it with a thin Python
layer that unwraps union-returning Rust calls, adds Python-side error context,
and keeps a stable public surface (mirrored in the _rust.pyi stubs). That
layer is why the package can hold Python code beyond the raw bindings.
The architecture is designed to support multiple language bindings:
- Python: Via PyO3/maturin (current)
- JavaScript/TypeScript: Via wasm-bindgen (planned)
- Go: Via stable C ABI/FFI (planned)
- PHP: Via stable C ABI/FFI (planned)
The Python package lives in packages/py/citry_core/.
Key Files:
packages/py/citry_core/pyproject.toml- Package metadata and build configurationpackages/py/citry_core/__init__.py- Public Python API- Rust extension module built via maturin
The pyproject.toml in packages/py/citry_core/:
- Uses
maturinas the build backend - References the Rust crate at
../../../crates/citry_core_py/Cargo.toml - Includes Python source files via
[tool.maturin]include paths
Currently, we have a single Python distribution (citry_core) that includes both:
- The Rust extension module (bindings)
- Python-side SDK code (helpers, types, error handling)
Future consideration: Split into two distributions:
citry_core(thin): Only bindings + minimal shimscitry(fat SDK): Full Python SDK that depends oncitry_core
This would reduce verbosity in the package directory and allow independent versioning if needed.
The root pyproject.toml uses UV for dependency management instead of traditional requirements.txt files.
Why UV?
- 10-100x faster than pip
- Better dependency resolution
- Built-in virtual environment management
- Lock files for reproducible builds
Structure: the root is a uv workspace; packages/py/* are members, and repo-wide tooling lives in a dependency-group:
[tool.uv.workspace]
members = ["packages/py/*"]
[dependency-groups]
dev = ["maturin>=1.10.2", "ruff>=0.10.0", "mypy>=1.0.0"]The workspace has exactly one dependency lockfile: the root uv.lock.
Run uv lock from the repository root and commit that file for every workspace
dependency or package-version change. Development, CI, and release all read this
root file, including for every workspace member.
Usage:
# Install the whole workspace (builds citry_core, installs citry editable,
# and pulls every package's dev group)
uv sync --all-packages
# Run tools
uv run pytest
uv run maturin developEvery build backend uv downloads for a workspace package or a benchmark runner
is pinned to an exact version and hash. When you change a project's
[build-system] requires, want a newer backend release, or see the
build_backend_pins validator fail, refresh the pins and record them in each
lockfile:
python scripts/build_constraints.py update
uv lock
uv lock --directory benchmarks/web/runner
uv lock --directory benchmarks/errors/runnerWhen uv builds or syncs a workspace package, it first downloads that package's
build backend from PyPI: setuptools for citry, citry-lsp, citry-ui, and
pygments-citry, and maturin for citry-core. The two benchmark runners build with
hatchling, which also needs editables while uv installs the runner as an
editable project. uv.lock records the packages Citry installs, but not these
build-time downloads. So the root pyproject.toml lists every build backend of
the workspace packages, and each package a backend needs, in [tool.uv] build-constraint-dependencies with an exact version and the sha256 hash of each
file PyPI publishes for it. It also sets require-build-hashes = true.
uv then stops the build when a download does not match a listed hash, or when
a build needs a package the list leaves out. uv reuses a workspace package
wheel it has already built and cached without checking the backend again.
uv reads require-build-hashes from the nearest pyproject.toml that has a
[tool.uv] table, but it reads the pins, and the copy of them in uv.lock,
from the root of the workspace that the project belongs to. The workspace
packages belong to the repository's workspace, so they use the root table. A
benchmark runner sits under the repository root without being a workspace
member, so it is a workspace root itself. uv applies the root's
require-build-hashes to a runner that has no [tool.uv] table, but does not
read the root's pins for it, so uv sync --frozen there stops with
Hash-checking is required, but no trusted hash was provided for: hatchling.
Each runner's pyproject.toml therefore has its own [tool.uv] table with the
same two settings, because a table of its own stops uv from inheriting the
root's, and a generated block of pins for its backend.
uv lock --directory <runner> copies the pins into the runner's uv.lock.
The benchmark apps and error-benchmark baselines have a [tool.uv] table of
their own and no build backend, so the setting does not reach them. The
example projects have no [tool.uv] table, so they inherit
require-build-hashes but not the pins; they have no build backend, and
uv sync --frozen only installs wheels for them. A command run from a project
outside the repository, such as an example project copied to a temporary
folder, has to pass the pins itself (examples/_internal/qualify.py does this
for --editable-root). The published citry-core wheels are built by
maturin-action, which downloads maturin from GitHub itself and does not use
these pins.
update resolves every [build-system] requires entry under packages/py/
for Python 3.11 and later on every platform, then rewrites the lines between
the BEGIN build constraints and END build constraints comments in the root
pyproject.toml. It does the same in each benchmark runner's pyproject.toml
(STANDALONE_PROJECT_PATTERNS in scripts/build_constraints.py), resolving
only that runner's backend and the extras in BACKEND_EXTRA_REQUIREMENTS. A new
standalone project that builds with a backend needs its pyproject.toml path
added to STANDALONE_PROJECT_PATTERNS. uv lock copies the pins into each
uv.lock. The build_backend_pins validator fails when a project asks for a
backend or a version range its table does not cover, or when a runner's
uv.lock does not record its table, and its message names the command that
repairs it.
The release verifiers and the Citry UI rebuild in py--tests.yml pass
--no-config when they rebuild a wheel from a fresh sdist, so they never read
the root table. Those builds export the pins to a file
(python scripts/build_constraints.py export <file>, or
build_constraints.export() from Python) and pass
--build-constraints <file> --require-hashes to uv build.
The Pyodide build sets UV_CONSTRAINT to the same file, so the
uv pip install that pyodide-build runs to fill its build environment checks
maturin's hashes. uvx reads UV_CONSTRAINT for versions but ignores its
hashes, so the tools uvx installs, such as pyodide-build itself, are not
checked. Because uvx applies the versions, the maturin version in
packages/py/citry_core/pyodide-build.json must match the root pin, or the
Pyodide build stops with a resolver conflict.
The pins apply only to builds in this repository. The published sdists keep
their [build-system] requires ranges, so someone building Citry from source
still picks their own backend version.
This needs uv 0.13.5 or later, the first uv that reads hashed
build-constraint-dependencies entries. An older uv cannot read them:
uv sync, uv lock, uv run, and uv build stop with an error that points
at the root pyproject.toml, while uv pip prints a warning and ignores the
whole [tool.uv] table. Every CI workflow pins the same uv release, so a uv
release that changes this setting cannot break CI before the pin moves; the
setting is still marked experimental (build-dependency-hashes), so check
uv's release notes when raising the pin.
The pins cover the build backends of this repository's own packages and
benchmark runners, plus the ones in THIRD_PARTY_BUILD_REQUIREMENTS in
scripts/build_constraints.py: backends that a locked third-party package
needs on a supported interpreter it ships no wheel for, such as Cython for
PyYAML on CPython 3.15 and PyPy 3.11, and pkgconfig for Brotli on free-threaded
CPython 3.14. When uv has to build some other third-party package from its
sdist, that backend has no pin and the build stops with Hash-checking is required, but no trusted hash was provided. Add the backend to that list, then
run python scripts/build_constraints.py update and the uv lock commands it
prints.
The root pyproject.toml is explicitly marked as non-releasable:
- No
[build-system]section (prevents building) "Private :: Do Not Upload"classifier- Version
0.0.0with descriptive name
This prevents accidental releases while still allowing tooling configuration.
The root pyproject.toml contains tool configurations that apply to the entire codebase:
- Black: Code formatting (119 char line length)
- isort: Import sorting (black-compatible)
- flake8: Linting (E302, W503 ignored)
- mypy: Type checking
- pytest: Test configuration
Important: These tools are not excluded from the packages/ directory. They apply codebase-wide, including to all Python packages.
Tools exclude standard build artifacts and caches:
.venv,.tox,build,dist__pycache__,.mypy_cache- But NOT
packages/- tools should run on package code
- Published distributions are independently versioned and released.
- Each Python distribution declares its version in its own
pyproject.toml. - The
citrydistribution pins its compatiblecitry-coreversion exactly; the release-order rule below keeps that pair coherent. - Rust crates declare their versions in their
Cargo.tomlfiles.
This section tells contributors how to keep Citry's compatibility
promise. The promise starts with citry 1.0.0: code that worked on one
1.x release keeps working on the next, a breaking change needs a new
major version, and a feature is deprecated before it is removed (see
Deprecating a feature). The Versioning and
support page of the docs site tells users what Citry promises. Before
1.0.0, citry may change its API in any release, and
Contract versions says when the version number of
a data format may change.
The rules cover citry, the package that applications depend on. It
pins one exact citry-core version and installs it, so the rules do not
cover citry-core's own API. A citry-core change that alters what a
covered citry name, the template syntax or a diagnostic does is still
a breaking change to citry. Other published packages at 1.0.0 or later,
such as citry-lsp, apply the rules to the names and settings their own
docs describe. citry-ui is below 1.0.0 and may change its API in a
minor release.
A change is breaking when code or data that worked on one 1.x release can fail or behave differently on the next, and what it relied on is covered. A name, setting or format is covered when the docs describe it and do not mark it experimental, or when a list below names it. If the two disagree, the not-covered list wins.
Breaking changes:
- removing or renaming a covered name;
- adding a required argument;
- rejecting input that was accepted before;
- raising a different exception type, because code that catches the old type stops catching it;
- changing a default to a stricter value;
- changing what a setting means.
Not breaking:
- adding a name, an optional argument, or a setting whose default keeps the old behavior;
- making a check less strict;
- fixing behavior that contradicted the docs.
These are covered. Change them incompatibly only in a new major version:
- The names in
citry.__all__, and in the__all__of eachcitry.ext.<name>module or package, eachcitry.contrib.<name>module andcitry.reload, and the names that one of those lists exports from its own__all__, such ascitry.ext.events.actions: their signatures, documented behavior and exception types. Node class constructors are the exception. - The template syntax and the reserved tag and attribute names, the
component class attributes and nested classes (
Kwargs,Slots,Stateand the rest), the settings and their defaults, the CLI commands and options, the JSON thatcitry check --format jsonprints, and the documented extension hooks. - The diagnostic rule names, which are the names
citry checkgives its findings, such ascitry.template.unknown-component. - The names of the node classes (the classes that compiled templates
create, such as
ComponentNodeandIfNode) and the attributes that an extension hook reads from them throughctx.nodes. - The Events wire format
citry-events/1, which carries the server events that run Python handlers from the browser: its requests, replies, manifests and records. It is frozen for all of 1.x. Any change to it, even an addition, needs the new formatcitry-events/2, except that a security fix may refuse input. Every 1.x release still accepts validcitry-events/1requests (see Contract versions).
These are not covered, so any minor or patch release may change them:
- Names that start with
_, except the ones the docs tell users to set, such as_guardon anEventsclass and_publicon aStateclass. citry_core._rust, and submodules that no__all__above exports. Import names fromcitry, not from its submodules:from citry import Slotis covered, andfrom citry.slots import Slotis not. The same holds forcitry.ext.events.handlers.- The code the template compiler generates, the text of error messages, and the exact whitespace of rendered HTML.
- The messages that Citry's server and its own browser code send each other, other than Events. Contract versions says what limits a change to them.
- Features marked experimental in their docs and docstrings, such as
ComponentGraph.
One private module has a rule of its own. citry-lsp imports the Citry
internals it needs, and the experimental template analysis names, from
citry._lsp_support, which also holds the private attribute and setting
names that citry-lsp reads by name. Every citry-lsp 1.x must work with
every citry 1.x. Users must not import it, and the docs do not describe it,
but during 1.x treat it as covered:
- Do not remove or rename a name, remove a parameter, make a parameter required, change a default, remove a public member of a class it exports, change the value of a string or number constant, or remove an entry from a collection constant. Keep what a function returns and the arguments it passes to a callback.
- You may add names, optional parameters and class members.
- When citry-lsp needs another Citry internal, add it to the module and
record it by running
packages/py/citry/tests/test_lsp_support_module.pyas a script. That test checks the rules above against the recordedlsp_support_names.json, and citry-lsp'stest_citry_imports.pyfails when citry-lsp imports a private Citry module directly. - A name added after 1.0.0 is missing from older releases, so citry-lsp
imports it in a
tryblock and turns off the feature that needs it when the import fails. Do not raise citry-lsp'scitry>=floor above 1.0.0 for it. - Release qualification runs
scripts/lsp_citry_pairs.pyfor two pairs: the oldest citry-lsp of the major version with the candidatecitry, and the candidate citry-lsp with the oldestcitryof the major version. Its docstring says what to do when an old test fails for a reason that is not a break.
Three kinds of change may come in a minor release even though they can break a user's setup. List each one in the changelog:
- A new
citry checkrule. A new rule can makecitry checkfail in a user's CI, so the changelog names each new rule and the setting that turns it off. Give every rule that a user may reasonably disagree with arule_*setting. A minor release never adds a rule that turns a template that renders today into a render error. - A new supported Python version, and dropping a Python version after upstream support for it ends.
- A minor update of the Vue version that Citry bundles. Moving to a new
Vue major needs a new
citrymajor.
A minor or patch release may refuse input that earlier releases
accepted when that is needed to fix a security problem, and its
changelog says so. When the hole is in a released version, build the fix
and its changelog line in the private fork, and make them public only
when they land for the release, as
Releasing advisory fixes describes. Follow
Mechanism 7 in CLAUDE.md and
SECURITY.md.
Any other change that has to break covered behavior in a minor or patch release is the maintainer's decision. Ask the maintainer before you open a pull request, and give the change an "Upgrading from" section in the changelog.
From citry 1.0.0, Citry deprecates a covered feature before it
removes it. A deprecated feature keeps working and keeps warning until a
major release removes it. A minor or patch release never removes it, and
a major release may remove it however soon it comes. A feature
deprecated in 1.4.0 still works in 1.9.0, and 2.0.0 can remove it.
- Leave the old name, argument or setting working, with its old behavior.
- In the code that handles the old name, argument or setting, on every
path that reaches it, call
warn_at_caller(message, CitryDeprecationWarning)fromcitry/_caller_warnings.py.citry.CitryDeprecationWarningis public and a subclass ofDeprecationWarning, so users can turn it into an error in their tests. The message names the old way and its replacement, and says the old way can be removed in the next major release. - Move everything else in Citry to the replacement, including its docs examples and its other tests.
- Mark the feature in its docs page and its docstring: start a line
with
Deprecated in version 1.4.0.(the release that first warns), and name the replacement. - Add a
### Deprecatedsection to the package's changelog entry for the release, next to### Addedand### Changed. Name what is deprecated and what replaces it. Most users learn of a deprecation from this entry, because Python shows aDeprecationWarningonly when it points at the__main__module, and a web server runs the user's code in imported modules. The entry is also the list of work to do before the next major upgrade. - When the major release removes the feature, say so in an "Upgrading from" section of that release's changelog entry.
For example, deprecating an argument:
from citry._caller_warnings import (
CitryDeprecationWarning,
warn_at_caller,
)
def render_page(page, *, old_title=None, title=None):
if old_title is not None:
warn_at_caller(
"`old_title` is deprecated, use `title`. It can "
"be removed in the next major release.",
CitryDeprecationWarning,
)
# The old argument keeps its old meaning until it is removed.
title = old_title if title is None else title
...warn_at_caller points the warning at the first call outside the citry
package, so it names the user's own line on most paths (str(),
serialize(), a framework adapter). A fixed stacklevel would point
into Citry on some of those paths. Two cases cannot name the user's
line: a warning raised while Citry builds an Events response names the
web framework's line, and one raised under the citry command, when no
user code is on the stack, names a line inside Citry.
A test for the deprecated path checks three things: the old way still
returns what it returned before, it warns with
CitryDeprecationWarning (inside pytest.warns, so the warning does
not fail a suite that turns warnings into errors), and the warning
points at the test file.
test_caller_warnings.py
shows how to read the file a warning points at. A path that builds an
Events response cannot point at the test file, so its test checks the
warning class only.
Steps 1 and 2 fit a Python name, argument or setting. For template
syntax, a CLI option or a changed default, warn_at_caller may not fit.
Propose the warning in the pull request (for template syntax, a
citry check finding may fit better) and ask the maintainer.
When you change data that Citry stores or sends, this section says whether you may change its version number. A contract version is the number Citry writes into that data so that the code reading it can tell which format it got. Examples:
- the
citry-events/1string in every Events request; _ARTIFACT_VERSIONand_CITRY_COMPATIBILITY_VERSIONincitry/ext/cache/artifact.py, for the render cache, which stores rendered output;_PROTOCOL_VERSIONincitry/ext/events/tokens.py, for State tokens;TEMPLATE_ANALYSIS_SCHEMA_VERSIONincitry/analysis.py, for the data that the editor reads;- the
SCHEMAstring of the Vue compiler crate (citry_vue_compiler).
Before 1.0.0. A package below 1.0.0, such as citry-ui, keeps each
contract version at 1, as the contract-version rule in
CLAUDE.md says, and fixes a format in place.
For citry and every other package at 1.0.0 or later, the rest of
this section applies. citry-core follows its own version numbers, and a
citry-core format counts only where a covered citry behavior depends
on it.
A deploy that replaces servers one at a time leaves old and new citry
versions running together for a while, and a deploy can skip releases
(1.0.0 to 1.7.0). Each version reads data that the other wrote: the
State tokens (the tokens that carry a component's State, or point to it
on the server), Events requests, and HTML fragments that the server
sends after the page has loaded. So a change to a Citry format should
leave an open page working, or at worst make the next event call fail
with stale_state. The one case that still fails is a page from a newer release
that calls a server still running an older release (see the
citry-events/1 bullet below). The rules cover a deploy between any two
1.x releases. A deploy from 0.x to 1.0.0 is a fresh start, so 1.0.0 does
not need to read 0.x data.
A public format is one that the docs or a spec describe, or that
code other than Citry's own server and browser code reads, such as a
tool or an editor. Examples are citry-events/1, the JSON of
citry check --format json, and the catalog and template analysis data
that citry-lsp reads, even though the Python API that produces the
analysis data is experimental.
citry-events/1is frozen for all of 1.x and is never changed in place, apart from the security exception below. Its readers reject unknown fields and unknown values (such as an action type), so an addition is a change too. A new field, a new value, or any other change needs the new formatcitry-events/2, which a 1.x release may add besidecitry-events/1. Every 1.x release still accepts validcitry-events/1requests. The first release that stops accepting them is 2.0.0 or later, and comes at least one minor release after the first release that acceptscitry-events/2. A page that a newer release rendered can reach a server still running an older release, which answersprotocol_mismatch, and the call fails with that error. The Events spec,packages/protocol/events/v1/spec.md, says the same in its "Versioning" section; keep the two in step.- Change another public format incompatibly only in a major release,
which also raises its number. Adding to it is a change too, and it is
safe only when every reader accepts it: find every reader in
citry,citry-lsp, the browser code and the Rust crates. One that rejects what it does not know turns the addition into a break. You cannot find every reader of a format that users' own tools read, such as the JSON ofcitry check, so add a field to it only when its docs tell readers to ignore fields they do not know. - One exception applies to every public format whose input Citry reads,
citry-events/1included. A 1.x release may refuse input that earlier releases accepted when that is needed to fix a security problem. The release's changelog says so. The Events spec states the same exception forcitry-events/1. - Follow the spec of a format when it has one (the Events spec requires
readers to reject unknown fields). Otherwise write each new reader so
that it skips fields it does not know, and uses a default for a field
that an older writer did not send. A newer
citry-lspreading data fromcitry1.0.0 is a case that must keep working.
An internal format is one that only Citry's own code reads back:
State tokens, render-cache entries, the messages between the server and
Citry's own browser code, and the data that citry hands to the
citry-core it pins. When you cannot tell which kind a format is, treat
it as public and ask the maintainer in the pull request.
- A minor or patch release may move an internal format to a new version, but only when the releases already out treat data in a version they do not know as missing. The render cache then renders again, and a page whose token is rejected as stale is offered a reload. This must be true of the releases already out, because during a deploy an old process reads what a new one wrote, and the code of a release that is out cannot change. So read what the oldest 1.x release does with a version it does not know, and write a test that gives the new code the old version. Staging a change over two releases (one that reads the new version, a later one that writes it) does not help, because a deploy can skip releases.
- The render cache meets this condition. Citry treats a cache entry
with an unknown version, or one written by a different
citryversion, compiler or browser runtime, as not found, and renders again instead of using it. Each entry stores a hash of the installedcitryversion and of the compiler and runtime contracts, so after a release every entry that an older release wrote is not found. Processes of two releases that share a cache replace each other's entries until the deploy ends. The integer versions rarely need to change. - A State token meets this condition. A signed token starts
cev1., and a token that points to State on the server startsces1.. The server answersstale_state(409) for a token whose prefix has the same shape (ce, a letter, a number) but another value, such ascev2., and for a token or server-stored entry whose payload names a version other than 1. Citry's browser client reports that code as an out-of-date page (the app decides what the visitor sees; a development page asks Citry's own reload question), and a reload brings a fresh token. Until then the call fails withstale_state. So a release may raise the token version. A new token version changes the prefix and keeps its shape, because 1.0.0 answersinvalid_statefor a prefix of any other shape; the payload check only helps while the payload stays JSON in thecev1layout. - The
preparedobject of avue-prepared/1render (the data that Citry's browser code applies to the page, which refuses one written for a different helper contract) and the Vue fragment messages (citry-vue-fragment/1) meet this condition too. When Citry's browser code in a page that an older 1.x release rendered gets a render or a fragment it cannot read, it reports an out-of-date page the same way (citry:events:staleorcitry:fragments:stale). Before you change any other message between the server and Citry's browser code, check what the browser code of the oldest 1.x release does with a version it does not know, because an open page keeps running the browser code of the release that built it. - The data between
citryand its pinnedcitry-corenever meets another release, because the two install together. Its readers may reject what they do not know: the request types of the Vue compiler use the serde attributedeny_unknown_fields, the Rust JSON reader setting that rejects unknown fields. If someone installs a differentcitry-coreanyway, the request fails with an error instead of being misread.
For both kinds:
- Never change a released version in place, except as the security exception above allows. A change that old readers cannot read gets the next number, and one change updates the code that writes the data, the code that reads it, and every test, fixture and doc that shows it.
- Record the new version in the changelog when a visitor or an operator
can notice it, such as an open page whose calls fail with
stale_stateor a render cache that renders again. A major release also lists it in its "Upgrading from" section.
Tests of the version-check code itself may use several arbitrary version numbers. These rules govern the contract versions Citry ships.
Each published package owns one changelog. The root
CHANGELOG.md belongs only to the Python citry package.
Auxiliary distributions keep release notes in their package directories, for
example:
packages/py/citry_core/CHANGELOG.mdforcitry-corepackages/py/pygments_citry/CHANGELOG.mdforpygments-citrypackages/py/citry_lsp/CHANGELOG.mdforcitry-lsppackages/py/citry_ui/CHANGELOG.mdforcitry-uipackages/editors/vscode/CHANGELOG.mdfor the VS Code extension
This matches the independently versioned and tagged distributions. Users see the release history for the package they are deciding whether to upgrade, and one change is not duplicated across unrelated release streams. Internal crates and monorepo infrastructure do not need user-facing release notes.
What goes in an entry and how to write it are in
CLAUDE.md; link relevant issues when
helpful.
This monorepo uses package-specific git tags to distinguish versions of different packages.
Tag format:
Tags follow the format: <package-name>@<version>. A tag with no language prefix means the Python package.
Examples:
[email protected]- the citry-core Python package[email protected]- the citry Python package[email protected]- the Citry language server[email protected]- the Citry UI component library[email protected]- the Citry Pygments lexer[email protected]- the Citry VS Code extension
Editor-extension tags include the editor name so they cannot collide with a
Python distribution. The VS Code extension uses vscode-citry@<version>.
Note: When a second host language (JS/PHP/Go) is published, we will revisit how to disambiguate its tags from the Python ones (likely a <language>@ prefix on the non-default languages); until then the prefix would be noise. The version after @ must match the package's pyproject.toml version: the publish workflow checks this and fails the release on a mismatch.
Rationale:
- Clarity: Each tag clearly identifies which package it refers to
- Independent versioning: Supports packages versioning independently
- Filtering: Easy to list tags for a specific package:
git tag -l "citry-core@*" - Scalability: Works well as the monorepo grows with multiple major projects and language bindings
There is one release entry point. Individual package workflows are internal workers and must not be run by hand.
prepare release changes on a branch from current main
-> open a pull request against main and merge it
-> Prepare release candidate runs automatically
-> determine which manifest versions do not have final tags
-> qualify all selected packages concurrently
-> retain one candidate bundle with exact run, artifact, and hash identities
-> inspect the successful candidate
-> run Release qualified packages with its workflow run ID
-> publish each dependency layer concurrently
-> verify exact public bytes before starting the next layer
-> create final tags, GitHub Releases, and Discord notifications
-> verify public browser packages and build the documentation snapshot
-> the release App commits generated site files directly to main
-> the main documentation workflow deploys the updated site
When a fix for this release was built in a private security advisory, land it
on main and wait for CI there to pass before you start the steps below (see
Releasing advisory fixes).
Prepare a release as follows:
-
Update each selected package manifest, compatibility constraint, owning changelog, and published README. If Citry Core changes, update Citry's exact Core pin in the same release commit. If citry-lsp changes, update the VS Code extension's
citry.lspVersiononly when that extension should ship too. -
Run
uv lockwhen Python workspace metadata changed. Keepdocs_site/static/playground/runtime.jsonon compatible public packages during qualification. After publication, the documentation release workflow reads the package versions from the immutable Citry release source and updates this JSON from the published release inventories. It verifies the downloaded wheel bytes and dependencies, then runs the published-runtime browser tests before committing the new pins. Pyodide and unrelated package pins stay unchanged. An unavailable or incompatible wheel stops this update; the deployed site keeps its existing runtime. -
Sweep version references deliberately. Update live metadata and pins, but do not rewrite historical changelogs, dated research, fixtures, or unrelated versions merely because the number matches.
-
Open a pull request with the release changes and merge it into
main, as described in How changes reachmain. A qualifying candidate is created automatically when the release surfaces change. To retry candidate preparation or make an explicit selection, run Prepare release candidate withautoor a comma-separated list such ascitry-core,citry,citry-lsp,vscode-citry. From the command line, start the run, then list the recent candidate runs to find its ID (a new run can take a few seconds to appear in the list):gh workflow run repo--release-candidate.yml -f packages=auto gh run list --workflow repo--release-candidate.yml --limit 5
-
Inspect the candidate run and its selected package graph. Require the repository Check and applicable language, browser, and example CI runs to pass for the same commit before publishing, including the
framework-floorsjob inpy--tests.yml. Qualification is the expensive part and happens before release intent. Independent package builds run in parallel; the candidate retains their exact artifact IDs and GitHub archive digests for 30 days. Citry's qualification also runsscripts/rolling_deploy/check.py, which sends the requests of pages the previous release rendered to the candidate and the other way round, as a rolling deploy does; a failed check stops the release only when both releases share a major version of 1 or later. Qualification requires each worker to be dispatched from the planned commit onmain. Ifmainadvances before dispatch, prepare a new candidate on currentmain.No newer push cancels the repository Check, so every commit on
mainkeeps its own Check result. A newer push tomaincancels the other checks still running for the older commit (see Cancelling stale runs and targeted diagnostics), so hold merges tomainuntil the release commit's checks finish. If a newer push already cancelled some of them, push a temporary branch at the release commit and start each cancelled check on that branch with Run workflow. A manual run tests the tip of the branch it is started on, gets a group of its own, and is never cancelled. Delete the branch afterwards. -
Start the only publication entry point, Release qualified packages, and supply the successful candidate workflow run ID (the ID column of
gh run list --workflow repo--release-candidate.yml, or the number after/runs/in the run page's address). From the command line:gh workflow run repo--release.yml -f candidate_run_id=<run-id>
-
The controller publishes dependency layers in order while running packages within each layer concurrently. For example, Citry Core and citry-lsp may publish together, followed by Citry and the VS Code extension. Package workers promote only the retained candidate bytes, verify the registry, create the annotated final tag and GitHub Release, and send the appropriate Discord event.
-
Verify the resulting public packages and GitHub Releases. When Citry is selected, the controller starts the documentation workflow after all selected packages have been published. The workflow verifies the browser runtime and builds the version snapshot. A separate job uses the dedicated release App to commit only generated documentation and runtime pins directly to
main. That push starts the normal site deployment. No follow-up PR or browser-runtime tag is needed. -
Confirm that the playground pins moved to the published release, then run the playground and live-code browser tests against them. When Citry is selected, Release docs updates
docs_site/static/playground/runtime.jsonfrom the published wheels, runspytest docs_site/tests/e2e/test_playground_e2e.py -k published_runtimeagainst the new pins, and only then commits them tomain. That push changesdocs_site/, so Docs check runs the whole docs browser suite against the new pins, with the tests that need this checkout's Citry skipped. Nothing runstest_live_code_e2e.pywith those tests included, so run it and the rest of the playground suite yourself from the updatedmain:CITRY_PLAYGROUND_PINS_MATCH_CHECKOUT=1 uv run --no-sync pytest \ docs_site/tests/e2e/test_playground_e2e.py \ docs_site/tests/e2e/test_live_code_e2e.py \ docs_site/tests/e2e/test_preview_bridge_e2e.py
When Citry is not selected, nothing updates the pins. They take the Citry Core and citry-ui versions named in the next Citry release's source. The skip rule for these tests is described in Which browser tests run against the pinned release.
-
When a package is selected, open a few links in its published description on PyPI or the Marketplace (for example the root README's
https://github.com/citry-dev/citry/tree/[email protected]/examples/starters/fastapi) and confirm they resolve. The release build points them at the new tag, which exists only after publication, so no earlier check can prove them. If a link returns 404, check that the package's tag exists. Rerunning Release qualified packages with the same candidate resumes the remaining steps, including creating the tag (see When a release stops partway). -
When an example raised its Citry or citry-lsp floor to a version that this release published, run
uv lockin that example, runpython -m examples._internal.release_gatefrom the repository root, and commit the refreshed locks together in one post-release change. A lock can name only a published release, so this is the one example update that cannot happen before publication.
The controller derives ordering from selected-package constraints. Citry waits for a selected Citry Core because it pins Core exactly. citry-lsp and citry-ui wait for a selected Citry only when their compatibility floor requires that new release. The VS Code extension waits for its selected citry-lsp version. Packages without a dependency relationship publish together.
Use this section when a release includes a fix that was built in a private security advisory. GitHub builds such a fix in a temporary private fork of the repository, and the fork causes two problems for a release.
The fix has never run in CI. GitHub Actions does not run in a temporary
private fork, so nothing has tested the fix when it first reaches the public
repository. After a push straight to main for 0.7.0, the failures on Windows,
Python 3.11, and Python 3.15 first appeared on main during the release. A
pull request catches failures in its own checks, but it runs only some of the
Python tests, so step 4 of the list below applies to both routes. No code
enforces that wait. It is a rule for whoever runs the release.
The fork's pull request cannot be merged. GitHub offers no way to merge it,
from the web page or through the API, so the fixes reach main through a
public pull request of their own, or through a push straight to main.
Land the fixes and publish the advisories in this order:
-
In the private forks, put the fixes in one chain of commits. Each advisory's branch merges the branches before it, so the last branch contains every fix. Merge current
maininto the chain too, somainis an ancestor of its last commit: a fast-forward needs that, and the rulesets require a pull request's branch to be up to date. Ifmainmoves before the fixes land, merge it into the chain again (a merge keeps the fix commits' hashes) and hold other merges tomainuntil the fixes are in. -
Bring the chain to
mainby one of two routes. Both keep every fix commit's hash, and both make the fixes public before the advisories are published. The fix is public from the moment you push it, so push only when you can land it as soon as its checks pass.- Through a pull request (preferred). Push the chain's last commit to
a new branch in the public repository, open a pull request against
main, and merge it with a merge commit, not a squash or a rebase, which would give the fix commits new hashes. This needs no change to the rulesets in Main branch and release permissions, and the pull request's CI runs beforemainmoves. This is the one public pull request for a hole in a released version. Describe the fixes as tightening the code and put the details only in the advisories, which are still private. 1.3.0 took this route (#881). - Through a fast-forward push. Move
mainto the chain's last commit with a fast-forward, so no merge commit is added. The rulesets block a direct push tomain, so the maintainer sets Require checks for main and Require pull requests for main to Disabled, pushes, and sets both back to Active straight away, then checks that their bypass lists still match Main branch and release permissions. No CI runs beforemainmoves. 0.7.0 took this route.
- Through a pull request (preferred). Push the chain's last commit to
a new branch in the public repository, open a pull request against
-
Close each advisory's fork pull request. GitHub does not publish an advisory while its fork pull request is open, so close these before you publish the advisories (step 7).
-
Wait for the runs that the merge or push started on
mainto pass: Check, Python tests, Rust tests, and the example and docs runs that apply. A push tomainthat changes the paths inpy--tests.ymlruns the Python tests on every supported system and Python version, where a pull request runs fewer, so this wait applies to the pull request route too. Do not merge anything else until the runs finish, because a newer push cancels the older push's Python tests (see Cancelling stale runs and targeted diagnostics). -
Fix any failure with an ordinary pull request, and wait again on the new tip of
main. -
Raise the package versions and follow the release steps above. After any fix lands on
main, prepare a new candidate, because a candidate built earlier does not contain it. -
Publish the advisories after every package of the release is on its registry and you have checked that a clean install from the registry works. An advisory tells readers to upgrade, so the fixed versions must install first. For 0.7.0 the check created a fresh virtual environment, ran
pip installon the released versions, and imported and rendered a component.Publish the advisories before you post anything of your own about the release, so the post can link to them. Each package's Discord post goes out as soon as its GitHub Release exists, before the advisories. That is fine.
If you requested a CVE (a public ID for the vulnerability) on an advisory, do not wait for the ID before you publish.
Prepare release candidate selects only packages whose version has no tag,
so a push of fixes that leaves every version alone starts no qualification.
When a version without a tag is already on main, a push that changes one of
that workflow's paths (changelogs, package manifests, the release scripts and
workflows) starts a candidate on its own. Wait for the test runs anyway.
PyPI, the extension registries, or sigstore can fail for a few minutes. Sigstore is the service that signs each uploaded file, so a user can check that the file came from this repository's CI. The controller retries a short outage on its own; after a longer one, a person only has to start the release again.
First, it retries a failed publish step. When a worker fails in a step that
uploads to a registry or signs with sigstore, the controller waits five
minutes and starts that run's failed jobs again, up to two times. The new
attempt reads the registry first. When some qualified files are already
there, it sends the files again with skip-existing, so PyPI skips a file it
already holds. The check after the upload then compares every public
file's SHA-256 with the qualified bytes. A failure in any other step, such as
a hash check, stops the release at once. Every attempt signs what it uploads:
Citry never publishes a file without its attestation (the signed record of
which workflow published it).
Second, you can start the whole release again. First wait until every publish run that the stopped release started has finished, so two runs do not publish the same package at once. Then run Release qualified packages again with the same candidate run ID:
gh workflow run repo--release.yml -f candidate_run_id=<run-id>When publication stops with an error, the controller prints this command after the error, filled in with the candidate's run ID, and a note that starting again fails the same way when the cause is not a short outage. A failure before the controller starts on the candidate, such as a missing token or an unreadable candidate file, prints no command.
For each package, the controller first looks for its tag:
- No tag yet: the package goes to its publish worker as usual.
- The tag exists and the GitHub Release exists: the controller downloads the retained qualification archive, checks it against the candidate's digest, and compares each qualified file's SHA-256 with what the registry serves. PyPI lists its own hashes. For the VS Code extension, the controller downloads the VSIX from both the Marketplace and Open VSX. It also checks that the GitHub Release holds exactly the qualified files, with the same SHA-256, plus the worker's two small JSON records (checked for presence only). When all of this matches, the package is skipped. When a registry is still missing files, or the GitHub Release holds anything else, the worker runs again and finishes or checks the rest.
- The tag exists but the GitHub Release does not: the worker runs. It skips the upload when the registry already has the files, then creates the missing GitHub Release.
A public file that differs from the qualified file stops the release with an error that names the file and the registry. A registry never lets a version's file be replaced, so this needs a person to decide what to do. A tag that names a different commit, or a tag that is not annotated, stops the release in the same way.
After the remaining layers, the restarted run also does the closing steps, such as starting the documentation release.
Restart only with the same candidate. A new candidate rebuilds only the packages that have no tag yet. A package that is on its registry but has no tag would then be compared against the new build. When that build differs from the earlier one, the publish fails with the hash error above. Prepare release candidate also refuses an explicit package list that names a version whose tag exists.
Open VSX reviews a new version before serving it, and answers 404 until the review ends. After a successful upload, the VS Code worker waits up to 45 minutes for Open VSX, and logs each 404 as "still under review". It waits up to five minutes for the Marketplace. No worker rebuilds during promotion or replaces an existing release asset.
If publication created the GitHub Release but failed to start documentation or Discord, recover that remaining step directly. Rerunning package publication does not resend Discord for an existing Release. The controller retries documentation dispatch after successful publication. For a missing documentation snapshot, run:
gh workflow run repo--docs-release.yml -f [email protected]Use the existing release tag. For a missing Discord post, use the notification workflow described below.
Examples are not coupled to every Citry version. Each project declares and locks a compatible public Citry range. The exact-commit examples CI workflow runs alongside candidate preparation and overlays the selected wheel in a clean copy, proving the unreleased change without rewriting every example lock. Update an example's minimum and lock only when that example actually adopts a new public contract. When the new contract arrives in the release being prepared, raise the minimum in the release change and refresh the lock after publication (step 11 above).
Every package publisher creates its GitHub Release with GITHUB_TOKEN. GitHub
does not start another workflow from the resulting release event, so the
publisher sends a citry-release-published repository dispatch after the
Release exists. repo--discord-release.yml
then reads that Release and posts its notes to the channel assigned to the tag:
| Discord channel | Published tag families |
|---|---|
| Announcements | citry@*, citry-ui@*, vscode-citry@* |
| Development | citry-lsp@*, citry-core@*, pygments-citry@* |
Internal crates, protocol packages, and other unpublished tools send no
notification. The release-notification validator requires every workflow
that creates a GitHub Release to own exactly one route, so add the new tag
family to scripts/discord_release.py when a
publisher is added.
The notifier fails visibly when its assigned repository secret is absent or
Discord rejects the webhook. Use DISCORD_WEBHOOK_ANNOUNCEMENTS for the main
release channel and DISCORD_WEBHOOK_DEVELOPMENT for the contributor channel.
Because notification runs separately from publication, this failure does not
change public package bytes. Retry a missed post by manually running Notify
Discord on Release with the existing GitHub Release tag; do not rerun the
package publisher merely to resend Discord.
citry pins one exact citry-core version, not a range. The pin lives in
the dependencies list of
packages/py/citry/pyproject.toml.
The runtime node classes in citry.nodes read the source that citry-core's
compiler emits, so a citry-core release that changes that output
would otherwise reach an already-published citry that cannot read it. Raise
the pin in the same change that bumps citry-core's version. That makes the two
releases a pair, and the controller publishes and verifies citry-core before
it starts Citry's publication layer.
Citry UI, the LSP and example applications declare a minimum Citry version without an upper bound. Version checks accept later Citry versions; integrations that consume versioned protocols must still validate those schemas.
Development updates to main require a pull request, the check job, an
up-to-date branch, and resolved review conversations. Zero approving reviews
are required while the repository has one maintainer, so that maintainer can
merge their own PR after checks pass. JuroOravec also has a For pull requests
only bypass on the separate required-check ruleset to merge selected PRs
without waiting for checks. The PR and resolved-conversation requirements still
apply, and direct pushes to main remain blocked. The PR history remains, but the sole-maintainer
process does not provide independent approval.
Generated release site updates use a dedicated GitHub App as the only always-allowed
bypass actor for the PR and status-check rules. A separate ruleset blocks deletion and
force pushes without bypass actors. GitHub's App bypass applies to the branch;
the trusted workflow enforces the file restriction. The write job accepts only
docs_site/versions/ and docs_site/static/playground/runtime.json, after the
build and browser checks pass. If main advances during generation, the job
fails and must be rerun against the new base. It never rebases unvalidated
output or force-pushes.
Configure the release identity once before enabling this workflow:
- Create an organization-owned GitHub App with repository Contents: write
and install it only on
citry-dev/citry. Give it no organization permissions or webhook. Keep it separate from the Dependabot relock App. - In the
release-maintenanceenvironment, add variableRELEASE_APP_IDand secretRELEASE_APP_PRIVATE_KEY. Under Deployment branches and tags, select Selected branches and tags and allow only the exact branchmain, with no tag rules. Keep the private key out of repository-wide, organization-wide, and Dependabot secrets. - Add this App alone as an always-allowed bypass actor for the exact-main PR
and status-check rulesets. Keep deletion and force-push protection in a
separate ruleset with no bypass. Give
JuroOravecthe pull-request-only bypass on the required-check ruleset alone. Other users andgithub-actionsreceive no bypass.
The build job has only the read token and no release environment. A fresh write
job accesses release-maintenance, mints a short-lived repository-scoped App
installation token, and copies the successful build's generated artifact. It
runs no release-tag code or package installation. The App push starts normal
main CI and docs deployment. Missing credentials fail the job; there is no
fallback to a maintainer token or a general Actions bypass.
The pypi and vscode-marketplaces environments allow the exact main branch
for publication jobs. Environment restrictions are configured in GitHub
settings, outside workflow files. Permission to use an environment is separate
from permission to update main or create a release tag.
Package publication, tag creation, and GitHub Release creation run in separate
jobs. The publication job verifies the exact public bytes and retains its release
files as an immutable Actions artifact. A separate job in each publisher then
uses the release App in release-maintenance to create the package's annotated
tag. Each tag job loads its environment secret and runs the shared Python helper.
The helper reads the package version from the qualified source commit, requires that commit to remain
on main, and executes only the current trusted workflow's helper code. The App
key is available only in this tag job and the generated-site write job.
Tag creation protection covers all six package namespaces and allows only the release App to create tags. A separate rule blocks tag updates and deletion without bypass actors. An existing annotated tag pointing at the expected commit is accepted. A lightweight tag, different target, or network failure stops the job. The helper never moves, deletes, or force-pushes a tag.
After tag creation, a fresh job verifies the transferred artifact digest, file inventory and qualified commit before attaching those files to the GitHub Release. It uses the ordinary Actions token and has neither publishing credentials nor the release App key. It sends a Discord notification only for a newly created Release. A failure after publication can be recovered by rerunning the controller with the same candidate: public packages must still match exactly, and matching annotated tags and complete Releases with byte-matching assets are accepted (see When a release stops partway). A draft, incomplete or mismatched Release stops for deliberate reconciliation; the workflow does not overwrite it. Existing Python Releases may also contain publish attestation files: these are accepted only when their bytes match GitHub metadata, their contents match PyPI provenance, and they identify the expected package file and digest. Recover a failed Discord notification through its own workflow after the Release exists.
The publishing environments permit only the exact main branch, with no tag
allowances. The release_security validator checks job dependencies, fixed
publishing environments, trusted helper checkout refs, artifact verification and
App-key placement. This detects mistakes in reviewed workflow changes; the GitHub
environment policies are the independent boundary against modified branch
workflows. Recheck those external policies and App permissions after changing the
release process.
Independent PR and deployment approvals will be enabled when the maintainer team grows; issue 112 tracks that change. The current sole-maintainer process requires no second approver. Administrator control over repository settings remains an explicit trust boundary.
Every change lands on main through an ordinary branch and a pull request.
Create a branch from current origin/main, commit the work there, push it,
and open a pull request against main. The required checks must pass against
an up-to-date base before the pull request merges, as described in
Main branch and release permissions.
Releases start from main after the pull request merges. GitHub cannot merge
the pull request of a private security advisory's fork, so a fix built there
reaches main through a public pull request of its own or, by exception,
through a fast-forward push (see
Releasing advisory fixes).
For audits of older work, the origin/review branch and the
reviewed-baseline tag keep the historical diff of changes that were
committed before they were read line by line.
Git tags are ordered by the commit date they point to, not the date they were created. When packages version independently:
- Tags may appear out of chronological order in the tag list
- To list tags chronologically for a specific package:
git tag -l "citry-core@*" --sort=-version:refname - This is expected behavior and acceptable for independent versioning
As the monorepo grows, we may adopt automated tooling for versioning and releases:
Potential Tools:
- Changesets: Popular for npm/pnpm monorepos, supports independent versioning with
package-name@versiontags (can be configured for custom tag formats) - Lerna: JavaScript-focused monorepo tool with flexible versioning strategies
- Cocogitto: Rust-focused tool that automates versioning based on conventional commits
- Semantic Release: Automated versioning based on commit messages
- Release Please: Google's tool that works with multiple languages and package managers
Benefits of automation:
- Automatic version bumping based on commit messages
- Automatic changelog generation
- Automatic tag creation
- Dependency version updates
- Coordinated releases across packages
When to adopt:
Consider adopting automated tooling when:
- Manual release process becomes error-prone or time-consuming
- Multiple packages are released frequently
- Coordinating releases across packages becomes complex
- Team size grows and release process needs standardization
Workflow file naming convention:
Since GitHub Actions workflows cannot be nested in subdirectories (all workflow files must be in .github/workflows/ at the root), we use a consistent naming convention to organize workflows by language and package:
Format: <language>--<package-name>--<workflow-type>.yml
Examples:
py--citry-core--publish.yml- Publish Python citry-core packagepy--pygments-citry--publish.yml- Publish the Citry Pygments lexerpy--citry-core--test.yml- Test Python citry-core package (future)js--citry-core--publish.yml- Publish JavaScript citry-core package (future)go--citry-core--publish.yml- Publish Go citry-core package (future)
Rationale:
- Double dashes (
--) clearly separate language → package → workflow type - Language prefix (
py--,js--,go--) namespaces the workflow file by language; release tags drop the prefix (a bare tag means Python), so the file naming is a separate scheme that still leaves room for other languages - Scalable as the monorepo grows with multiple packages and languages
- Easy to filter:
ls .github/workflows/py--*shows all Python workflows
Package-Specific Workflow Triggers:
Each publish workflow is configured to trigger only on tags for its specific package:
on:
push:
tags:
- "citry-core@*" # Only triggers for [email protected], etc.This ensures:
- Workflows only run when their specific package is released
- No unnecessary workflow runs for unrelated package tags
- Clear separation of concerns per package
Workflow Organization:
- Test workflows use descriptive names:
repo--check.yml,rust--tests.yml,py--tests.yml - Package-specific workflows use the
language--package--type.ymlconvention (e.g.,py--citry-core--publish.yml) - All workflows are in
.github/workflows/(no subdirectories supported by GitHub)
Path-filter ownership: A path-filtered workflow lists the files its jobs
actually read, build, or test, including root manifests, lockfiles, toolchain
configuration, and that workflow's own file. Do not use .github/** as a
shortcut: changing an unrelated workflow is not a dependency. Conversely, a
new script, generated contract, or source tree consumed by a job must be added
to both its push.paths and pull_request.paths. Tag, schedule, release, and
webhook workflows are event-scoped and intentionally have no file path filter.
The repository uses five separate test workflows to keep CI fast, and the path-filtered ones run only when relevant code changes:
Purpose: Runs the full non-browser check profile
(python scripts/check.py --profile full) on all changes: formatting, lints,
types, coverage, the custom validators, and a single-environment test pass.
Triggers: Runs on pushes to main and dev and on every pull request (no path filters).
What it runs:
python scripts/check.py --profile full: lock validation, cargo fmt/clippy/test, Ruff, mypy, Pyright, the client/docs-playground/VS Code package checks, pytest, and the custom validators, every phase followed by a combined report- The single source of truth for "does everything pass"
Configuration:
- Python 3.14 on ubuntu-latest, with the Rust nightly toolchain and Node 22
- The shared citry-core wheel (see CI Dependencies),
uv sync --locked --all-packageswithout the editable citry-core, andpnpm install --frozen-lockfile, thenpython scripts/check.py --profile full
Purpose: Checks, in about a minute once it has a runner, that the
committed files built from other files in the repository still match what
their builds write. The full gate runs the same checks, but only after it
builds citry_core, so this job reports a stale file well before the gate
does.
Triggers: Runs on pushes to main and dev and on every pull request (no
path filters), so it always reports and can be made a required check.
What it runs: pnpm install --frozen-lockfile, then each of these, every
one even after an earlier one fails:
- the docs playground bundles and
portable_ide.py(build.mjs --check) - the browser runtimes built from
packages/js/citry-client(its canary test) and the Vue types copied for the language server (build-vue-types.mjs --check) - the minified Citry UI assets (
pnpm run citry-ui:check-assets) - the VS Code extension bundle (
compile, thencheck-built-output.mjs) - the DOM member table (
generate.mjs --check) and its generator tests, after an install oftools/dom-membersfrom its own lockfile - the protocol Python copies, the diagnostic catalog bindings, and the copied
logo files and recorded Vue versions (
scripts/validators/generated_copies.py), all with Python's standard library only
Generated files that need a built citry_core, such as the Citry UI message
catalog and the native-render fixtures, are checked only by the full gate's
pytest phase.
Purpose: Tests all Rust crates in the workspace.
Triggers: Runs when changes are made to:
crates/**- Rust crate codethird_party/**- Third-party dependencies (e.g., Ruff submodule)Cargo.toml,Cargo.lock, andrust-toolchain.toml- workspace and toolchain inputs.github/workflows/rust--tests.yml- this test matrix's own definition.gitmodules- Submodule configuration changes
What it tests:
- All Rust crates via
cargo test -p <package>for each crate - Tests only our crates (excludes Ruff submodule crates)
Configuration:
- Rust nightly toolchain (matching
rust-toolchain.toml) - Tests on ubuntu-latest, windows-latest, and macos-latest
- Uses Rust dependency caching for faster builds
Why path filters: Avoids running Rust tests when only Python code, documentation, or unrelated files change.
Purpose: Tests all Python packages.
Triggers: A push to main or dev starts the workflow only when it
changes one of the paths below. Every pull request starts it. On a pull
request, its first job, changes, lists the pull request's files and compares
them with the same paths, and every other job skips when none of them match.
GitHub counts a skipped job's check as passing, so a check from a job without
a matrix, such as citry-ui-wheel-build, can be required on main without
blocking a docs-only pull request. (A skipped matrix job reports only its
plain name, such as test, so do not require a matrix cell such as
test (3.11, ubuntu-latest): it never reports on a docs-only pull request.)
- If
changesfails (for example, the GitHub API is down), every job runs, so a required check is never skipped by mistake. The same happens when the API lists fewer files than the pull request has (it lists at most 3,000), or when the pull request gets a newer commit whilechangesruns. - The two jobs that need the wheel build check its result directly.
citry-ui-wheel-installandcitry-ui-wheel-browserrun whencitry-ui-wheel-buildsucceeds. GitHub's default condition would skip them on every push, becausechangesis skipped there. - Cost:
changesitself takes a few seconds, but every pull-request run waits for it to get a runner before its other jobs start, about a minute when runners are busy. A push or a manual run does not runchangesand does not wait. - A retargeted pull request keeps its old result. Changing a pull request's base branch does not start a new run, so push a commit after retargeting a pull request (for example, one that was based on another pull request's branch).
- The path list appears twice. It is under
on.push.pathsand in thechangesjob, andtest_ci_workflows.pyfails if they differ.
The paths are:
packages/py/**- Python package codepackages/js/citry-client/**andpackages/protocol/**- browser/runtime contracts exercised by Python jobscrates/**- Rust code (Python packages depend on Rust via PyO3 bindings)third_party/**- Third-party dependencies used by both Rust and Python- root Python, Cargo, pnpm, lockfile, and toolchain inputs
- the exact release-helper scripts imported or executed by package tests or by
the
citry-ui-wheel-buildjob tools/pyodide-smoke/**anddocs_site/_internal/frontend/src/runtime_packages.js- the Pyodide check described below and the package resolver it imports.github/workflows/py--tests.ymlplus the Pygments and Citry UI publish workflows whose safety contracts are tested.gitmodules- Submodule configuration changes
What it tests:
- Installs the whole workspace with
uv sync --locked --all-packages --no-install-package citry-coreand then the citry-core wheel that thecitry-core-wheel-*jobs build once per run (see CI Dependencies), so every package's suite runs - Runs the portable Python tests via
uv run --no-sync pytest -m "not e2e" --ignore packages/py/citry/tests/test_server_reload.py -n 4 --dist loadfile --durations 30; four file-level workers share one GitHub runner - Runs this checkout's
citryandcitry-uiin Pyodide (thepyodide-smokejob, described under "The Pyodide check" below) - Tests the oldest framework versions that the
Compatibility page lists
(the
framework-floorsjob). On Python 3.11, it installs the workspace, replaces Django, FastAPI, Starlette, Flask and Werkzeug with the versions pinned in the job'sFRAMEWORK_FLOORS(plus httpx, which old Starlette needs), and runs every test file that imports one of them. It runs beside thetestjobs and takes about a minute, so it adds no time to the run. - By the maintainer's decision,
framework-floorsruns on pushes that start this workflow and on manual runs, not on pull requests. A change that needs a newer framework shows up in the push run after the merge. To check a branch before merging, start Run workflow on it. - When you raise the oldest supported version of a framework, change the
starter in
examples/starters, the job's pins and the Compatibility page together.test_ci_workflows.pychecks that the first two match.
Configuration:
- Pushes to
mainanddev, and manual runs, test the full set: Linux and Windows on Python 3.11 to 3.15, plus macOS on the oldest and newest Python - Pull requests test a trimmed set to save runner slots: Linux on every Python, Windows on 3.11 and 3.15, and macOS on 3.15. A failure that shows only on Windows 3.12 to 3.14 or on macOS 3.11 appears in the push run right after the merge
- Both sets leave out the Linux cell for the Python that
repo--check.ymluses (3.14), because that workflow runs the same tests there on every pull request - The
include:expressions in thetest-linux,test-windowsandtest-macosmatrices pick the set for their OS;test_ci_workflows.pypins both sets - Only the two wheel jobs install Rust, and only when no cached wheel matches the Rust sources
Why path filters: Avoids running Python tests when only documentation,
unconsumed scripts, or unrelated workflows change. Includes crates/**
because Python packages depend on Rust code via PyO3 bindings, and names the
release helpers that the distribution tests import so those dependencies are
not missed.
The Pyodide check: The docs playground runs Citry in a browser on Pyodide,
a Python for WebAssembly whose standard library lacks some functions that
CPython has. Citry 0.8.0 read time.thread_time when it was imported, Pyodide
has no such function, and no pull request job ran this checkout's Python
there, so the break reached a release. The pyodide-smoke job (a short check
that the packages import and render) runs on the same pull requests as the
rest of py--tests.yml and does this:
- It builds the
citryandcitry-uiwheels from the checkout withuv build. Both are pure Python, so it needs no Rust build. tools/pyodide-smoke/smoke.mjsstarts, in Node, the Pyodide build that thepyodidenpm package intools/pyodide-smoke/package.jsonprovides.- It installs the packages that
docs_site/static/playground/runtime.jsonlists, the way the playground does: the packages Pyodide ships,tzdata, and the published Citry Core wheel for Pyodide, whose SHA-256 it compares with the one PyPI lists for that file. The wheels from step 1 replace only thecitryandcitry-uientries. The script fails if an installed version differs from the one it expects. tools/pyodide-smoke/render_components.pyimports every module of both packages (about 380), including the ones that Events, the reload server, and the commands load later. It then renders a Citry component and a Citry UI button with a value that contains markup, and fails unless the markup comes out escaped.
The check catches an import that fails on Pyodide and a render that breaks there. It does not run an Events request, i18n formatting, or other code that runs after the first render.
To run it on your machine, build the wheels into an empty folder and give that folder to the script. The script stops if the folder holds more than one wheel for a package.
wheels=$(mktemp -d)
uv build --package citry --wheel --out-dir "$wheels"
uv build --package citry-ui --wheel --out-dir "$wheels"
pnpm --dir tools/pyodide-smoke install
node tools/pyodide-smoke/smoke.mjs "$wheels"Four facts help when it fails or does not run:
- It tests the published Citry Core, not the one in the checkout. Building
Citry Core for Pyodide needs Emscripten and takes minutes, so the release
qualification of
citry-coredoes that. The Citry Core thatruntime.jsonpins can be older than the onecitry'spyproject.tomlrequires, because the docs release workflow updatesruntime.jsononly after a release. The job also installs only the packages thatruntime.jsonlists, without resolving dependencies. A pull request that needs a newer Citry Core (for example, one that changes the compiler incrates/together with the Python that reads its output) or that adds a dependency therefore fails here until the next docs release updatesruntime.json. A traceback that points at a Citry Core mismatch or a missing module, not at a missing Pyodide feature, is that case. - The Pyodide version has two pins.
runtime.jsonsays which Pyodide the playground serves, andtools/pyodide-smoke/package.jsonsays which one this check runs.scripts/validators/toolchain.pyfailsscripts/validate.py, which thecheckjob runs, when they differ, andpnpm-lock.yamlin that folder must follow the change. Dependabot version updates do not touch this pin, because it moves withruntime.jsonandpyodide-build.json. - A change to
runtime.jsonalone does not run the job. The release site update changes that file by itself, and listing it as an input would rerun every Python job after each release. The pin check above and the playground tests in the docs check, which run against the pins in that file, cover it. Changes totools/pyodide-smoke/, to the playground'sruntime_packages.js(the script imports it), and to the Python packages do run the job. - It is not a required check. The job needs the npm registry, PyPI, and
the Pyodide CDN, and it fails in the Citry Core case above, so it reports on
pull requests without blocking them. The required checks are
checkandcitry-ui-wheel-build(in the "Require checks for main" ruleset in GitHub settings). The job has no matrix, so its check name ispyodide-smokeon every run, and adding it to the ruleset later needs no workflow change.
Purpose: Mounts every HTML element in Chromium, Firefox, and WebKit, runs
Vue's own attribute code on it, and fails when a browser keeps different
attribute text than the generated table
(crates/citry_vue_compiler/src/dom_members.rs) says the server should write.
Triggers: Runs by hand at any time, and on pushes to main and pull
requests only when the table, anything under tools/dom-members/, or the
workflow's own file changes. The Playwright version in that directory's
lockfile decides which browser builds are installed, so a Playwright bump runs
it too.
What it runs: pnpm --dir tools/dom-members install --frozen-lockfile,
installs the three browsers, then pnpm --dir tools/dom-members run test:browser
with BROWSERS=chromium,firefox,webkit.
Why path filters: Only a change to the table or its inputs can change the
result. Because of the filter, it cannot be a required check; the unfiltered
table check in repo--generated.yml covers the table matching its inputs.
The docs workflows need the local citry_core extension because the rendered
site imports Citry. repo--docs-check.yml, repo--docs-deploy.yml,
repo--docs-external-links.yml and repo--docs-lighthouse.yml install the
shared citry-core wheel (see CI Dependencies), so they
compile nothing unless no run has cached a wheel for the current Rust
sources. repo--docs-release.yml installs the shared wheel for its checkout
of main too, but its build-tag step then syncs the release tag in a
separate worktree, which compiles that tag's extension. For that build it
keeps the minimum supported Rust version (RUSTUP_TOOLCHAIN=1.97.0) and
sccache's GitHub Actions backend. It also keeps the
docs-citry-core-py314 Rust cache, which omits the job ID and is saved
even when a later step fails. That cache holds only the main checkout's
target folder, so it speeds up a shared wheel build after a wheel cache
miss, not the release-tag build; only sccache helps that build. The
toolchain validator checks these settings.
The docs workflows sync the root tooling package and Citry (which brings in
citry-core and the docs lexer); docs validation reads or builds Citry UI source
where needed without installing the LSP. Their path filters mirror those actual
inputs and the diagnostics catalog, rather than all Python packages or all
workflow files. The people-data refresh does not render the site or import
Citry at all, so it syncs only the root package and the docs extra and avoids
the Rust build entirely.
- Rust tests: Run via
rust--tests.ymlworkflow usingcargo test - Python tests: Run via
py--tests.yml, which installs the uv workspace (uv sync --locked --all-packages) and distributes the non-browser suite by file across four workers on each matrix runner - The full non-browser gate: Run via
repo--check.yml, which runspython scripts/check.py --profile full(lint, types, coverage, validators, and single-environment portable tests) - Dependencies: Installed from the uv workspace lockfile;
--lockedkeeps CI reproducible - Matrix testing: on pushes to
main, Python tests run across Python versions (3.11-3.15) and OSes, except Linux with Python 3.14, which the full gate inrepo--check.ymlalready covers on every pull request. Pull requests run Windows and macOS only on the oldest and newest Python (see thepy--tests.ymlconfiguration above). The real-server reload tests run only there, in check.py's serial "pytest reload servers" phase.
Each published Python package has an internal release-worker workflow:
py--citry-core--publish.yml, py--citry--publish.yml,
py--citry-lsp--publish.yml, py--citry-ui--publish.yml, or
py--pygments-citry--publish.yml. The repository candidate controller invokes
each worker in qualify mode for one exact main commit. The repository
release controller later invokes it in promote mode with the exact retained
run, artifact ID, and archive digest. Running these worker workflows manually
is not a supported release path.
The VS Code extension follows the same boundary in
vscode--citry--publish.yml: candidate preparation qualifies one VSIX, and
promotion can publish only that retained VSIX for the exact main commit.
The publish workflows build every release from a clean runner: no job in them
restores or saves a GitHub Actions cache. Every workflow that runs on main
can save caches that later main runs restore, so a release job that restored
one would let any of those runs change the bytes it publishes. The setup-uv
action turns its cache on by default, and setup-node does so for npm projects,
so each of those steps sets enable-cache: false or
package-manager-cache: false, and the Rust builds run without sccache. The
release_caches validator
(scripts/validators/release_caches.py)
fails the gate when a publish workflow restores a cache or uses an action
nobody has checked for caching. Ordinary CI keeps its caches. In qualify mode, verify-version stops the run unless
release_commit equals the run's own github.sha. The build and smoke jobs
therefore check out github.sha, which CodeQL does not treat as untrusted
code.
PyPI auth is Trusted Publishing (OIDC), not a stored API token. The release jobs carry id-token: write and target a GitHub environment named pypi; PyPI verifies the workflow's OIDC identity, so there is no secret to keep. Before a package's first publish, configure a PyPI publisher (a pending publisher if the project does not exist yet) with:
- PyPI project name (
citry-core,citry,citry-lsp,citry-ui, orpygments-citry) - Owner and repository (
citry-dev/citry) - Matching workflow filename under
.github/workflows/ - Environment name (
pypi)
The first publish from a configured pending publisher creates the project. The GitHub pypi environment is also where you can add a manual-approval gate on releases.
Candidate preparation invokes py--citry-core--publish.yml on the exact
main release commit. That qualification builds one source distribution and
44 native wheels. Fourteen cp311-abi3 wheels cover GIL-enabled CPython
3.11 and newer across every supported platform. Linux and musllinux also carry
one free-threaded wheel each for CPython 3.14 and 3.15, and one PyPy 3.11 wheel,
per architecture.
The workflow also builds one
cp314-cp314-pyemscripten_2026_0_wasm32 wheel for the exact Pyodide runtime
pinned by the playground. That browser wheel is another build of
citry-core, not a package dependency.
The qualification uses Rust 1.97.0, Maturin 1.16.0, and Cargo's
performance-qualified release-wheel profile: fat LTO, one codegen unit, and
no debug information in the stripped distribution build. The four-way
profile/ABI comparison and keep/drop decision are recorded in
docs/design/performance.md.
Builders select the three supported interpreter families explicitly, so a
runner-image change cannot silently add or remove a wheel. Runnable wheels are
installed and exercised in their build jobs: every supported interpreter on
Linux x86_64 and Windows, plus the oldest and newest CPython on macOS. The
remaining cross-architecture wheels receive the same static inspection. The
sdist job rebuilds outside the checkout with the declared Rust 1.97 minimum and
exercises the resulting wheel before uploading the sdist.
Each builder keeps its output in a separate directory. The final qualification
job rejects duplicate filenames and requires the complete 46-file set before
it creates verified-citry-core-distributions. Every wheel is checked against
the checkout for metadata, tags, Python payload, extension module, license,
RECORD, and size. release-inventory.json records every filename, byte size,
and SHA-256 hash. GitHub retains this promotion bundle for 30 days.
The qualification run records build provenance for the verified set; the
promotion records a second attestation for publishing those bytes.
Two separate runners build the PyEmscripten wheel from clean source trees with
the pinned Pyodide/Emscripten tuple. The workflow requires byte-identical
normalized outputs and checks the actual SDK-reported Emscripten version. It
uses that SDK's wasm-opt to remove the workspace's profiler-only DWARF/debug
payload before regenerating RECORD, then exercises build A in that exact
Pyodide runtime. That run of scripts/smoke_citry_core.py also evaluates,
parses and formats the deepest expressions that python_safe_eval accepts.
It rejects an expression whose depth bound, counted from its tokens, is above
MAX_NESTING in crates/python_safe_eval/src/nesting.rs. The WebAssembly
engine's call stack cannot grow, and this run checks that the parse,
evaluate and format passes fit in it, so a failure there means that limit is
too high for Pyodide. The qualify run only accepts a commit on main, so
this check cannot run on a branch before merging.
The repository release controller passes the retained run, artifact ID, and
archive digest to the same workflow. The worker safely extracts and completely
re-verifies the candidate against the release checkout, then publishes without
compiling again. It fails before Trusted Publishing if the qualification is
missing, expired, unsuccessful, from another commit, or byte-different. The
GitHub Release includes qualification-provenance.json with the selected run,
commit, and artifact digest.
An interrupted upload can be retried with the same candidate. The worker reads
PyPI's complete file inventory: an absent version is uploaded, an exact
filename and SHA-256 match is accepted, and a partial upload whose files all
match is finished by uploading the rest. Any different or unknown public file
stops the worker. It turns on skip-existing only when this check found the
public files with the qualified SHA-256, and the check after the upload proves
every file again. It never overwrites a GitHub Release asset. Every
third-party action under .github/ is pinned to a full commit SHA (see
Pinning GitHub Actions).
The permanent browser build tuple lives in
packages/py/citry_core/pyodide-build.json. Its Pyodide and Python versions
must match docs_site/static/playground/runtime.json, and so must the
pyodide version in tools/pyodide-smoke/package.json. The release site
update pins the PyPI project, version, filename, and SHA-256 for that browser
wheel. The worker resolves its public URL at runtime and accepts it only when
PyPI reports the expected filename and digest. Keep the deployed pin on public
packages until the new artifacts are available, as described in the release
procedure.
Candidate preparation invokes py--citry--publish.yml on the exact release
commit. The workflow builds one universal wheel and one source distribution,
requires their package, metadata, license, entry-point, and RECORD
inventories, rebuilds the sdist outside the checkout, and install-smokes both
wheels on CPython 3.11 through 3.15. When selected alongside an unreleased
Citry Core, the smoke uses the qualified candidate dependency rather than
waiting for public PyPI. The verified pair and release-inventory.json are
retained for 30 days.
Promotion safely extracts and re-verifies that exact pair, publishes it to
PyPI, verifies the complete public filename and SHA-256 inventory, creates the
annotated citry@<version> tag and GitHub Release. The controller starts the
documentation update after all selected packages finish. There is no staging tag, example-lock rewrite, or second
release commit. The parallel exact-commit examples workflow tests clean copies
with candidate overlays; checked-in compatible public locks move only when
their own requirements change.
Candidate preparation invokes py--citry-lsp--publish.yml on the exact release
commit. The workflow builds one universal wheel and one source distribution,
then requires that closed pair and its package, metadata, license,
console-entry-point, and RECORD inventories. It rebuilds the source
distribution outside the checkout and installs the wheel on CPython 3.11
through 3.15.
The installed-wheel smoke imports every shipped module, verifies Citry and the
analyzer dependencies against the manifest requirements, checks citry-lsp --help, and starts the stdio
server with closed input. This proves that a clean install resolves the public
Citry and direct analyzer dependencies without reading another workspace
package.
The candidate retains verified-citry-lsp-distributions and its exact byte
inventory for 30 days. Promotion receives that artifact's exact run, ID, and
digest, safely extracts and re-verifies the pair against the release checkout,
and publishes without rebuilding. An exact already-public PyPI inventory is a
safe retry, the worker uploads the rest of a partial upload whose files match,
and any different file stops the worker.
For the first release, create a pending PyPI Trusted Publisher with this exact
identity: project citry-lsp, owner citry-dev, repository citry, workflow
py--citry-lsp--publish.yml, and environment pypi. The workflow file and the
release commit must be on main before publication. Configure the GitHub
pypi environment to authorize that workflow's promote job.
Citry UI commits production CSS and selected large JavaScript frames beside
their readable *.source.css and *.source.js inputs. After editing one of
those inputs, run pnpm citry-ui:build-assets; use
pnpm citry-ui:check-assets to verify that every generated frame is current.
The locked Node workspace pins the build tools, while the published wheel
contains only the generated frames and performs no runtime compilation.
Candidate preparation invokes py--citry-ui--publish.yml on the exact release
commit. The workflow builds one universal wheel and one source distribution,
requires their closed runtime, metadata, license, and source inventories,
rebuilds the source distribution outside the checkout, and install-smokes the
wheel on CPython 3.11 through 3.15.
The launch floor registers the library, renders representative Button and Pagination components with the bundled i18n catalog, and exercises Tabs in an installed-artifact Chromium session. The broader visual, assistive-technology, and real-device matrix informs later stabilization but does not block alpha releases, including 0.2.0. Failed or unavailable manual rows remain recorded honestly and must not be reported as passing evidence.
The candidate retains verified-citry-ui-distributions and its exact byte
inventory for 30 days. Promotion selects it by exact run, artifact ID, and
digest, safely extracts and re-verifies the pair, and publishes without
rebuilding. An exact already-public PyPI inventory is a safe retry, the worker
uploads the rest of a partial upload whose files match, and any different file
stops the worker.
The PyPI Trusted Publisher created for the first release uses project
citry-ui, owner citry-dev, repository citry, workflow
py--citry-ui--publish.yml, and environment pypi. Before every release,
recheck that identity and confirm that the GitHub pypi environment authorizes
that workflow's promote job.
The extension lives in packages/editors/vscode/. From the repository root,
install the locked Node workspace and run its checks or create a development
VSIX with:
pnpm install --frozen-lockfile
pnpm --dir packages/editors/vscode run check
pnpm --dir packages/editors/vscode run packageengines.vscode, @types/vscode, the esbuild Node target, and @types/node
describe one compatibility decision and move together. The 0.1.0 floor is VS
Code 1.101.0, whose extension host embeds Node 22: the manifest uses
^1.101.0, the editor types are 1.101.0, the bundle targets node22, and the
Node types stay on 22.x. Raising only one value can either compile against an
unavailable editor/Node API or emit syntax the oldest supported host cannot
run.
This is a desktop and remote workspace extension. It starts
python -I -m citry_lsp in each file-backed workspace and therefore has no
browser entry point and does not claim VS Code for the Web support. The one
universal VSIX contains no native binary; compatible desktop forks can use
citry.python when they do not expose Microsoft's Python extension API.
The manifest sets capabilities.untrustedWorkspaces.supported to false:
the extension runs the workspace's Python interpreter and imports its app,
so VS Code keeps it off in Restricted Mode.
The Marketplace listing takes its public links from package.json: the
extension-specific guide is the homepage, the repository link names this
package's monorepo directory, bugs go to GitHub Issues, questions go to GitHub
Discussions, and the sponsor button uses the project's existing GitHub
Sponsors page. Keep the PNG icon at least 128x128. README screenshots and GIFs
use absolute HTTPS URLs to committed files and stay outside the VSIX; the
Marketplace fetches those URLs when it renders the listing.
Candidate preparation invokes vscode--citry--publish.yml on the exact release
commit. The qualification installs the locked Node workspace, runs the
TypeScript/Biome/101 Node checks, builds the VSIX, and applies
scripts/verify_vscode_citry_distribution.py. That verifier requires the
complete 16-member archive: manifests, README/changelog/support/license/icon,
five grammars, two language configurations, and the one bundled extension
module.
It rejects source, tests, dependencies, source maps, local build paths,
unexpected metadata or targets, duplicate/unsafe members, and archives over
the stated compressed and expanded size caps. release-inventory.json
records the exact filename, byte size, SHA-256, and member list.
The qualification then downloads VS Code 1.101.0 into a clean test profile,
installs the extension manifest's citry.lspVersion and its dependencies into a fresh Python 3.14
environment, and loads the extracted qualified VSIX. When citry-lsp is selected
in the same candidate, the smoke builds that dependency from the same release
commit; otherwise it installs the public pinned release. It requires
real c-if, c-for, and c-slot completions from the server, then formats
deliberately untidy embedded JavaScript and CSS twice through an exact,
hash-pinned Prettier VS Code extension. The smoke selects a different
standalone CSS formatter to exercise Citry's bundled Prettier fallback. The
full component fixture must retain plain HTML quotes and canonical
triple-quoted JavaScript/CSS host framing. The second command must be byte
idempotent. This proves the oldest declared editor host, the dependency
installation, and the virtual-document formatter bridge work together. The
verified bundle is attested and retained for 30 days.
Promotion receives the exact qualification run, artifact ID, and digest,
requires the commit to remain on main, safely extracts and rechecks the VSIX,
and uploads those bytes to both registries. Registry clients use
duplicate-safe recovery, after which the workflow downloads both public VSIX
files and requires their SHA-256 to match the candidate. The GitHub Release
carries the VSIX, exact-byte inventory, qualification provenance, and
public-registry verification.
Registry setup happens outside the repository. Complete it before promotion; candidate qualification does not talk to either registry.
The workflow stores no registry token. Each registry trusts a single GitHub
Actions identity: the repository citry-dev/citry, the workflow file
vscode--citry--publish.yml, and the GitHub environment vscode-marketplaces.
The promotion job has id-token: write, so it can ask GitHub for a short-lived
sign-in token (an OpenID Connect, or OIDC, token) that names those three
things. Each registry client sends that token to its registry and gets back a
publishing credential that expires within minutes. The job checks that it can
request a sign-in token before it installs the clients. Each registry needs its
own setup; the PyPI trusted publisher does not cover them.
Both registry forms mark the environment field as optional. Fill it in anyway.
Without it, any job in this workflow file can publish, including the
qualification job, which also has id-token: write for its attestation and
runs no environment rule.
- Sign in to Manage Publishers & Extensions
with the Microsoft account that will own releases. Create or confirm the
publisher ID
citry-dev(display nameCitry.dev) and ensure that account is an Owner or Contributor. The immutable ID must matchpackage.json. - Open the
citry-devpublisher, select Trusted Publishing, expand Create, and enter a policy name such asvscode-citry release, repository ownercitry-dev, repositorycitry, workflowvscode--citry--publish.yml, and environmentvscode-marketplaces. Select Create.
The workflow runs vsce publish --oidc, which @vscode/vsce has had since
4.0.0; the lockfile pins 4.1.0. The Marketplace credential it receives lasts 15
minutes, and each GitHub sign-in token can be exchanged only once. --oidc
never falls back to an access token, so a missing or mistyped policy fails the
publish step. See the
Marketplace publishing guide
for the policy fields.
- Create an Eclipse account whose GitHub username matches the GitHub identity used at Open VSX. Sign in to Open VSX, link the Eclipse account from profile settings, and sign the Eclipse Publisher Agreement (not the separate Contributor Agreement).
- Follow the
Open VSX publishing guide
to create the
citry-devnamespace. Creating it makes you a contributor; claim ownership as that guide describes before step 3. Open VSX accepts a trusted publisher only for an extension that already has a published version, so the first version of a brand-new extension must be published by hand (ovsx publish -p <token>) outside this workflow.citry-dev.citryalready has published versions. - As an owner of the
citry-devnamespace (a contributor cannot do this), open Settings -> Trusted Publishers, select the namespace, choose GitHub Actions, and enter ownercitry-dev, repositorycitry, workflowvscode--citry--publish.yml, and environmentvscode-marketplaces. An extension can have only one trusted publisher, and a registration cannot be edited; delete it and create it again to change it.
The workflow runs ovsx publish --trusted-publishing, which ovsx has had
since 1.2.0; the lockfile pins 1.3.0. With that flag ovsx fails when it
cannot get a GitHub sign-in token. ovsx uses an access token instead whenever
one is given through --pat or OVSX_PAT, so the job must not set either. See
the Open VSX trusted publishing guide.
In the repository's GitHub environment settings,
give vscode-marketplaces Selected branches and tags, allow the main
branch, and keep any required reviewers you want. Neither registry's policy
names a branch, so this environment rule, together with the environment field
in both registrations, is what limits publishing to main. A maintainer starts
promotion by hand, and the job checks out the exact candidate commit.
Both registry clients use --skip-duplicate only to recover from a partial
two-registry publish. A rerun of the same candidate still selects and verifies
the original qualification artifact, so it can finish the missing registry
without building different bytes. The workflow downloads the exact Marketplace
and Open VSX packages and verifies both hashes before creating the GitHub
Release.
Microsoft accepts a verified-publisher application only after the public
extension and eligible domain have met its six-month requirements. Track the
earliest date from the actual Marketplace publication, not from repository
preparation. Issue #84 owns that
follow-up for the first Citry release. The Marketplace domain challenge for
this publisher uses a TXT name shaped like
_visual-studio-marketplace-citry-dev.citry.dev. DNS control panels commonly
append the managed zone automatically: in Namecheap's host field enter only
_visual-studio-marketplace-citry-dev, not the full hostname, or the record is
silently created at ...citry.dev.citry.dev. Before retrying Microsoft's
check, query the intended FQDN and, when debugging propagation, query the
authoritative nameserver directly:
dig TXT _visual-studio-marketplace-citry-dev.citry.dev
dig +short NS citry.dev
dig @<authoritative-nameserver> TXT _visual-studio-marketplace-citry-dev.citry.devDo not record the challenge value in the repository; use the current value shown in the publisher portal.
- Rust crates are not published to crates.io; they are an internal implementation detail surfaced through the Python packages. Each crate's
Cargo.tomlsetspublish = false, socargo publishrefuses to upload it; add the same line to any new crate. - The root
pyproject.tomlis never published (no build-system;Private :: Do Not Upload).
-
JavaScript/TypeScript Bindings
- WASM build via wasm-bindgen
- Package in
packages/js/citry/ - Native Node.js addon as alternative
-
Go Bindings
- Stable C ABI from
crates/ffi/ - Go wrapper in
packages/go/citry/ - Generated header file in
include/citry.h
- Stable C ABI from
-
PHP Bindings
- Same C ABI as Go
- PHP extension in
packages/php/citry/
A future crates/ffi/ crate will provide:
- Stable C ABI boundary
- Language-agnostic interface
- Used by Go, PHP, and potentially other languages
- Generated headers committed to repo
- Rust First: Core logic always in Rust
- Thin Bindings: Language bindings are minimal wrappers
- Idiomatic APIs: Packages provide language-native interfaces
- Single Source of Truth: One implementation, multiple interfaces
- Tooling at Root: Shared configuration, not duplicated
- Explicit Non-Releasable: Root config clearly marked as tooling-only
The codebase was migrated from a single-package structure to a monorepo:
- Before: Root
pyproject.tomlfor both tooling and package - After:
- Root
pyproject.tomlfor tooling only packages/py/citry_core/pyproject.tomlfor package
- Root
When moving the package pyproject.toml:
manifest-pathupdated to"../../../crates/citry_core_py/Cargo.toml"readmeupdated to"../../../README.md"- Maturin include paths remain relative to package directory