David Peter
David Peter
A one-liner hack that I use is the following: ```bash uvx ty check script.py --python "$(uv python find --script script.py)" ``` I think it requires that you run the script...
> But why the `../..`? It works for me without (i.e. ty seems to accept being passed a python binary) You're right. This may have been fixed in https://github.com/astral-sh/ruff/pull/18827, which...
> The way we intend to solve this is through uv. In fact, there's an open feature request for a [`--with-requirements script.py`](https://github.com/astral-sh/uv/issues/6542) option (and an [open PR](https://github.com/astral-sh/uv/pull/12763)), which would serve...
As a note for readers who are not aware about the full context: our current behavior is very much intentional and documented [here](https://github.com/astral-sh/ruff/blob/main/crates/ty_python_semantic/resources/mdtest/doc/public_type_undeclared_symbols.md) (with an example similar to the one...
The implicit instance attribute `x` on `C` is unannotated, which means that ty would not catch an external mutation of that attribute on an instance of `C`. Consider: ```py c...
> I believe that with `mypy`, you can either annotate `__init__` argument or provide a PEP526 annotation and it will be equivalent (the posted snipped works with no diagnostic in...
I haven't investigated, but type-checking this code requires building large union and intersection types. We probably need the same optimization that we already implemented for int/str/bytes literals, see [this comment](https://github.com/astral-sh/ruff/blob/c4a47d1a901e481580d5ab71484376ff2479c8fb/crates/ty_python_semantic/src/types/builder.rs#L31).