Metadata-Version: 2.4
Name: django-ty
Version: 0.1.1
Summary: Django semantic extension for ty-extended.
Project-URL: Repository, https://github.com/regularkevvv/django-ty
Project-URL: Releases, https://github.com/regularkevvv/django-ty/releases
Author-email: Kevin Castro <hola@kev.pe>
License-Expression: MIT
License-File: LICENSE
Keywords: django,extensions,ty,typing
Classifier: Development Status :: 3 - Alpha
Classifier: Environment :: Console
Classifier: Framework :: Django
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Rust
Classifier: Topic :: Software Development :: Quality Assurance
Requires-Python: >=3.10
Requires-Dist: django<6.1,>=5.0
Requires-Dist: ty-extended<0.60.0,>=0.59.0
Requires-Dist: types-pyyaml>=6.0.12
Requires-Dist: typing-extensions>=4.11.0
Description-Content-Type: text/markdown

# django-ty

`django-ty` adds Django ORM semantics to `ty-extended`. It installs Django,
the checker runtime, and a packaged Django static API for Django 5.0-6.0.

## Install

```sh
uv add django-ty
```

Installed plugin discovery is deliberately opt-in. Add this to the project
configuration:

```toml
[tool.ty.plugins]
auto-discover = true
```

Then run:

```sh
uv run ty check .
```

No installer command, `.ty` directory, or file copy is needed.

## Coverage

The complete pinned static API is packaged inside the wheel. No upstream
`django-stubs`, `django-stubs-ext`, or mypy-plugin distribution is installed.
Utilities supplied by `django-stubs-ext`, including `WithAnnotations`, are
intentionally outside `django-ty`'s product surface. `django-ty` handles Django
model fields, forward and reverse relations, model-specific managers, queryset
result types, `values()`, `values_list()`, basic `annotate()`, and literal lookup
validation.

The measured feature parity is **100.0%** against pinned `mypy` 2.1.0 with
`django-stubs` 6.0.6: all **82 of 82** in-scope reference outcomes match. The exact
behavior is in the
[compatibility map](https://github.com/regularkevvv/django-ty/blob/main/docs/DJANGO-STUBS-COVERAGE.md).
It is generated by running both checkers against the same 82 assertions and is
reproduced in CI. Hand-assigned statuses and weights are not used.

## Development

```sh
uv run --no-project --python 3.11 python scripts/evaluate_django_stubs_coverage.py --check
uv run --no-project --python 3.11 python -m unittest tests/test_compatibility_value.py tests/test_evaluate_differential_conformance.py
bash scripts/differential-conformance.sh --check
cargo test --locked
cargo llvm-cov --locked --all-targets --summary-only --fail-under-lines 98
bash scripts/e2e.sh
```

To refresh the vendored static API from the reviewed pinned checkout:

```sh
uv run --no-project --python 3.11 python scripts/vendor_django_static_api.py --upstream-root /path/to/django-stubs-6.0.6
bash scripts/differential-conformance.sh --write
uv run --no-project --python 3.11 python scripts/evaluate_django_stubs_coverage.py --write --check
```
