ty's Rust crates can be found in the Ruff project. While the relationship between these projects will evolve over time, they currently share foundational crates and it's easiest to use a single repository for development. To contribute changes to ty's core, open a pull request on the Ruff repository.
The Ruff repository is included as a submodule to allow ty's release tags to reflect an exact snapshot of the Ruff project. The submodule is only updated on release. To see the latest development code, visit the Ruff repository.
The ty repository only includes code relevant to distributing the ty project.
Clone the repository:
git clone https://github.com/astral-sh/ty.gitThen, ensure the submodule is initialized:
git submodule update --init --recursiveYou'll need uv (or pipx and pip) to
run Python utility commands.
You can optionally install pre-commit hooks to automatically run the validation checks when making a commit:
uv tool install pre-commit
pre-commit installThe Python package can be built with any Python build frontend (Maturin is used as a backend), e.g.:
uv buildTo update the Ruff submodule to the latest commit:
git -C ruff pull origin mainOr, to update the Ruff submodule to a specific commit:
git -C ruff checkout <commit>To commit the changes:
commit=$(git -C ruff rev-parse --short HEAD)
git switch -c "sync/ruff-${commit}"
git add ruff
git commit -m "Update ruff submodule to https://github.com/astral-sh/ruff/commit/${commit}"To restore the Ruff submodule to a clean-state, reset, then update the submodule:
git -C ruff reset --hard
git submodule updateTo restore the Ruff submodule to the commit from main:
git -C ruff reset --hard $(git ls-tree main -- ruff | awk '{print $3}')
git add ruffReleases can only be performed by Astral team members.
Preparation for the release is automated.
- Run
./scripts/release.sh
./scripts/release.shThe release script will:
- Update the Ruff submodule to the latest commit on
mainupstream - Generate changelog entries based on pull requests here, and in Ruff
- Bump the versions in the
pyproject.tomlanddist-workspace.toml
- Editorialize the
CHANGELOG.mdfile to ensure entries are consistently styled. - Create a pull request with the changelog and version changes, e.g.,
Bump version to .... Binary builds will automatically be tested for the release. - Merge the PR
- Run the release workflow with the version
tag. Do not include a leading
v. The release will automatically be created on GitHub after everything else publishes. - Run
uv run --no-project ./scripts/update_schemastore.pyto prepare a PR to update thety.jsonschema in the schemastore repository. Follow the link in the script's output to submit the PR. The script is a no-op if there are no schema changes. - If necessary, update and release
ty-vscode. Follow the instructions in thety-vscoderepository. Updating the extension is required when:- for minor releases to bump the bundled ty version
- for patch releases after fixing an important bug in
ty lspto bump the bundled ty version - when releasing new
ty lspfeatures that require changes inty-vscode
When running the release workflow for pre-release versions, use the Cargo version format (not PEP
440), e.g. 0.0.0-alpha.5 (not 0.0.0a5). For stable releases, these formats are identical.