Skip to main content

django-ty

Django ORM support for ty-extended. Official Ty checks ordinary Python and Django fields; django-ty adds constructor, relation, query result and model-state checks. Plugins use the Python subset supported by Monty. The package ships one universal Python wheel and runs without building Rust or starting a Python plugin worker.

Install and check

uv add django-ty

Enable installed plugin discovery:

[tool.ty.plugins]
auto-discover = true
uv run ty-extended check .

Select a settings module when it cannot be inferred:

uv run python -m django_ty --settings-module project.settings check .

The module launcher finds the installed executable even when it is absent from PATH.

Editors

Start ty-extended server and enable workspace diagnostics so closed model modules contribute reverse relations and cross-module queryset information.

For the official VS Code extension, use a trusted workspace:

{
  "ty.path": ["/absolute/project/.venv/bin/ty-extended"],
  "ty.diagnosticMode": "workspace"
}

On Windows, use .venv/Scripts/ty-extended.exe. For Neovim 0.11 or later:

vim.lsp.config("ty", {
  cmd = { "/absolute/project/.venv/bin/ty-extended", "server" },
  settings = { ty = { diagnosticMode = "workspace" } },
})
vim.lsp.enable("ty")

Django behavior

The plugin checks model constructors, raw relation keys, custom primary keys, inherited fields, reverse relations, managers, query results, literal lookups and creation defaults. It infers values() dictionaries and values_list() rows, including lazy .get() results and no-argument field order. Model ID state follows construction, loading, saving, deletion, aliases and branches.

Native ORM declarations come from django-types 0.24.0. Reviewed modern Django declarations and adapters preserve newer APIs, including widgets, async pagination, validators and email attachments. The complete packaged declaration tree is reproducible from pinned inputs; hashes, module overlays and adapters are recorded in the provider receipt.

The package does not install django-stubs, django-stubs-ext or MyPy. WithAnnotations and other django-stubs-ext utilities remain outside the supported surface. Native field and queryset annotations use conventions such as CharField[str] and QuerySet[Book]; row-specific querysets use ValuesQuerySet[Model, Row]. See the migration inventory.

Versions

Django-ty 0.8 requires ty-extended>=0.90.0,<1.0, Django >=5.0,<6.2 and Python >=3.10. The native integration requires ty>=0.0.101,<0.1 and is qualified on every release from 0.0.101 through 0.0.104. ty-extended releases are independent of official Ty; ordinary Ty updates within a compatible group do not require a Django-ty release.

The Django/Python matrix records tested combinations and the versions of each comparator. Ty compatibility records the independently qualified checker groups. Future upstream releases need compatibility checks before being described as tested.

Versions through django-ty 0.5 used a distribution that owned the ty command. Remove old django-ty and ty-extended packages before installing the current stack, reinstall official ty, and change plugin-enabled commands and editor launchers to ty-extended.

Performance and correctness

Native field inference avoids generating replacement declarations for every ordinary Django field. Scoped indexes, bounded batches, shared type factories and lazy row construction reduce the remaining plugin work. Benchmarks compare identical generated projects against native official Ty with django-types and MyPy with its Django plugin, retaining all samples and negative controls.

Django's documentation defines expected behavior. The installed framework independently checks reviewed disagreements; MyPy is a comparator. The coverage map records 172 line-level contracts and their exact evidence. The separate modern API regression includes eight positive assertions and three intentional errors, plus runtime controls. These are measured contracts, not a claim about every Django API or application.

Installed-wheel checks cover discovery, the module launcher, an empty PATH, real editor sessions, hover, unsaved errors, restoration and source preservation. Runtime and qualification instructions describe reproduction and the release gates.

Development

python scripts/build-monty.py --check
bash scripts/build-wheel.sh
python scripts/audit_stub_imports.py
python scripts/evaluate_django_stubs_coverage.py --check
python -m unittest discover -s tests
bash scripts/differential-conformance.sh --check
python scripts/probe_django_versions.py --check --clean-environments

The Python environment running SDK tests needs ty-extended installed. The historical Rust reference supplies regression requests. Current interpreter parity compares complete CPython and Monty responses; Django runtime contracts provide the independent semantic checks. Consumers use the packaged Python plugin in embedded Monty.

MIT. Third-party notices cover the declaration providers.

Metadata

Release files for django-ty 0.8.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for django-ty 0.8.0
File Size Uploaded Provenance Actions
django_ty-0.8.0.tar.gz 249.6 kB Without provenance Details for django_ty-0.8.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for django-ty 0.8.0
File Interpreter ABI Platform Actions
django_ty-0.8.0-py3-none-any.whl Python 3 none any Details for django_ty-0.8.0-py3-none-any.whl

Total release size: 766.9 kB

Release files / django_ty-0.8.0.tar.gz

Download URL django_ty-0.8.0.tar.gz
Size 249.6 kB
Tags Source
SHA-256 checksum
How to use checksums
a257b73ed0397342cc8c213bd99185098170ab5439020f4af3d79f5a97c2cca0
BLAKE2b-256 checksum
How to use checksums
2b0e26b0a91456552295a33505a7193024164febc8a40d6c2a73b12e2a75a28f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.23 {"installer":{"name":"uv","version":"0.12.23","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / django_ty-0.8.0-py3-none-any.whl

Download URL django_ty-0.8.0-py3-none-any.whl
Size 517.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6e5a4ac0122d73e51164416a7cbd7bc1c5d1679a231de147bbd95fa7b9a77086
BLAKE2b-256 checksum
How to use checksums
b420284f37e0ed26872e41eb1ef34a57c6e5e91d8ab55738bcbb3263bd0dda73
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.23 {"installer":{"name":"uv","version":"0.12.23","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for django-ty 0.8.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page