Skip to content

build: upgrade ty to 0.0.107 - #184

Open
simontaurus wants to merge 1 commit into
mainfrom
build/ty-upgrade
Open

simontaurus wants to merge 1 commit into
mainfrom
build/ty-upgrade

Conversation

@simontaurus

Copy link
Copy Markdown
Contributor

ty>=0.0.24 was never a pin; the lock froze 0.0.49 at the June uv migration and every release's plain uv lock preserved it. This re-locks to 0.0.107 and adapts the config.

Changes:

  • [tool.ty.rules] renamed: invalid-return-type -> invalid-explicit-return, invalid-method-override -> incompatible-method-override, call-non-callable -> not-callable; unresolved-attribute split upstream into missing-attribute + missing-union-attribute, both kept at the old severities (rules section and the tests/typing/** override)
  • inline # ty: ignore[unresolved-import] -> [import-not-found] (3 sites)
  • incompatible-attribute-override downgraded with rationale: pydantic v1 configuration is a Config class override by design
  • an examples/** override keeps unused-type-ignore-comment quiet: the one blanket ignore there is load-bearing for downstream checker configs where the silenced rule runs

What the new rules found, fixed rather than silenced:

  • legacy model_validate({...}) called super().model_validate without returning it and fell off the end - it answered None for every dict payload; v1 parse_obj had the same fall-off for unmatched input (src/oold/model/__init__.py, src/oold/model/v1/__init__.py)
  • the v1 descriptor's __iris__ getter-only override silently dropped the mixin's setter; direct property assignment now delegates like __setattr__ already did (src/oold/model/v1/_descriptor.py)
  • from_json overrides renamed the abstract base's json_dict parameter to data; the base now matches, so a keyword call cannot break on an override
  • the document stores narrowed the base's format: LinkedDataFormat | None to a mutable LinkedDataFormat; widened to match

One claim from #183 corrected in the docs: attribute writes through Optional[Link[T]] type only under pyright. ty does not apply __set__ inside a union on either 0.0.49 or 0.0.107 (0.0.107 rejects even = None), so the typing probe asserts the constructor direction and the docs say so instead of calling it version-dependent.

843 passed under the descriptor binding, 827 under OOLD_DESCRIPTOR_BINDING=0; ty check 0 errors (11 warnings, 10 of them the pre-existing unsupported-base set); ruff, deptry, strict docs build clean.

- rename the configured rules; unresolved-attribute split into
  missing-attribute and missing-union-attribute
- fix what the new rules found: legacy model_validate({...}) and
  v1 parse_obj fell off the end and answered None; the v1 descriptor
  __iris__ override dropped the mixin's setter; from_json overrides
  renamed the base's parameter; document-store format narrowed the base
- examples keep their blanket type: ignore for foreign checker configs
@github-actions

Copy link
Copy Markdown
Contributor

Release preview

No version bump from the current commits (stays at v2.3.2). Use conventional commit types (feat, fix, ...) to trigger a release.

Changelog preview (truncated)

Preview via python-semantic-release and conventional commits.

@github-actions

Copy link
Copy Markdown
Contributor

📊 Benchmark Results

Click to see benchmark comparison
📊 Benchmark Comparison (threshold: 1.3x)
============================================================

➖ Unchanged (within threshold):
  ➖ test_simple_dict_document_store: 0.0012s → 0.0012s (-0.2%)
  ➖ test_sqlite_document_store: 0.0013s → 0.0013s (-0.5%)
  ➖ test_local_sparql_store: 0.0273s → 0.0268s (-1.9%)
  ➖ test_oneof_subschema: 0.0403s → 0.0403s (+0.1%)
  ➖ test_enum_docstrings: 0.0337s → 0.0342s (+1.5%)
  ➖ test_subclass_inheritance: 0.0364s → 0.0371s (+1.9%)
  ➖ test_class_hierarchy: 0.0342s → 0.0340s (-0.7%)
  ➖ test_core[v1]: 0.0243s → 0.0246s (+1.3%)
  ➖ test_core[v2]: 0.0289s → 0.0288s (-0.3%)
  ➖ test_schema_generation[v1]: 0.0013s → 0.0013s (-0.1%)
  ➖ test_schema_generation[v2]: 0.0025s → 0.0025s (-0.6%)
  ➖ test_simple_json: 0.0005s → 0.0005s (-0.5%)
  ➖ test_complex_graph: 0.0011s → 0.0011s (+3.6%)

============================================================
Summary: 0 regressions, 0 improvements, 13 unchanged
============================================================

✅ No significant performance regressions

Threshold: 1.3x (30% slower triggers a regression warning)

Note: Benchmarks are informational only and won't fail the build.

💡 Tip: Download the benchmark-results artifact for detailed JSON data

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant