Ibraheem Ahmed
6f7b1c9bb3
[ty] Add environment variable to dump Salsa memory usage stats ( #18928 )
...
## Summary
Setting `TY_MEMORY_REPORT=full` will generate and print a memory usage
report to the CLI after a `ty check` run:
```
=======SALSA STRUCTS=======
`Definition` metadata=7.24MB fields=17.38MB count=181062
`Expression` metadata=4.45MB fields=5.94MB count=92804
`member_lookup_with_policy_::interned_arguments` metadata=1.97MB fields=2.25MB count=35176
...
=======SALSA QUERIES=======
`File -> ty_python_semantic::semantic_index::SemanticIndex`
metadata=11.46MB fields=88.86MB count=1638
`Definition -> ty_python_semantic::types::infer::TypeInference`
metadata=24.52MB fields=86.68MB count=146018
`File -> ruff_db::parsed::ParsedModule`
metadata=0.12MB fields=69.06MB count=1642
...
=======SALSA SUMMARY=======
TOTAL MEMORY USAGE: 577.61MB
struct metadata = 29.00MB
struct fields = 35.68MB
memo metadata = 103.87MB
memo fields = 409.06MB
```
Eventually, we should integrate these numbers into CI in some form. The
one limitation currently is that heap allocations in salsa structs (e.g.
interned values) are not tracked, but memoized values should have full
coverage. We may also want a peak memory usage counter (that accounts
for non-salsa memory), but that is relatively simple to profile manually
(e.g. `time -v ty check`) and would require a compile-time option to
avoid runtime overhead.
2025-06-26 21:27:51 +00:00
Dylan
32c54189cb
Bump 0.12.1 ( #18969 )
2025-06-26 15:20:31 -05:00
Micha Reiser
c1fed55d51
Delete the ruff_python_resolver crate ( #18933 )
2025-06-25 12:53:13 +02:00
renovate[bot]
cc659c6988
Update Rust crate libc to v0.2.174 ( #18876 )
...
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-06-23 08:06:03 +02:00
renovate[bot]
c8e03a0449
Update Rust crate mimalloc to v0.1.47 ( #18877 )
...
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-06-23 08:05:40 +02:00
renovate[bot]
f88fbc3952
Update Rust crate syn to v2.0.104 ( #18878 )
...
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-06-23 08:02:04 +02:00
Micha Reiser
23261a38a0
[ty] Add more benchmarks ( #18714 )
2025-06-18 13:41:38 +02:00
Brent Westbrook
87f0feb21a
Bump 0.12.0 ( #18724 )
...
- [x] Updated changelog
- [x] Updated breaking changes
2025-06-17 11:05:59 -04:00
renovate[bot]
d715c1fef8
Update Rust crate memchr to v2.7.5 ( #18696 )
...
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-06-16 08:10:43 +02:00
renovate[bot]
5383bcc497
Update Rust crate clap to v4.5.40 ( #18692 )
...
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-06-16 08:09:33 +02:00
renovate[bot]
9b927265f9
Update Rust crate libcst to v1.8.2 ( #18695 )
...
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-06-16 08:09:18 +02:00
renovate[bot]
b38115ba95
Update Rust crate jiff to v0.2.15 ( #18693 )
...
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-06-16 08:08:57 +02:00
renovate[bot]
32a0d4bb21
Update Rust crate libc to v0.2.173 ( #18694 )
...
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-06-16 08:08:34 +02:00
renovate[bot]
ccae65630a
Update Rust crate syn to v2.0.103 ( #18698 )
...
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-06-16 08:06:48 +02:00
renovate[bot]
4cdf128748
Update Rust crate toml to v0.8.23 ( #18699 )
...
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-06-16 08:06:34 +02:00
renovate[bot]
0c18a5a737
Update Rust crate pyproject-toml to v0.13.5 ( #18697 )
...
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-06-16 08:02:16 +02:00
renovate[bot]
37b2de90f8
Update to unicode 16 ( #18700 )
...
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-06-16 08:01:54 +02:00
Micha Reiser
3a430fa6da
[ty] Allow overriding rules for specific files ( #18648 )
2025-06-15 14:27:39 +01:00
Ibraheem Ahmed
c9dff5c7d5
[ty] AST garbage collection ( #18482 )
...
## Summary
Garbage collect ASTs once we are done checking a given file. Queries
with a cross-file dependency on the AST will reparse the file on demand.
This reduces ty's peak memory usage by ~20-30%.
The primary change of this PR is adding a `node_index` field to every
AST node, that is assigned by the parser. `ParsedModule` can use this to
create a flat index of AST nodes any time the file is parsed (or
reparsed). This allows `AstNodeRef` to simply index into the current
instance of the `ParsedModule`, instead of storing a pointer directly.
The indices are somewhat hackily (using an atomic integer) assigned by
the `parsed_module` query instead of by the parser directly. Assigning
the indices in source-order in the (recursive) parser turns out to be
difficult, and collecting the nodes during semantic indexing is
impossible as `SemanticIndex` does not hold onto a specific
`ParsedModuleRef`, which the pointers in the flat AST are tied to. This
means that we have to do an extra AST traversal to assign and collect
the nodes into a flat index, but the small performance impact (~3% on
cold runs) seems worth it for the memory savings.
Part of https://github.com/astral-sh/ty/issues/214 .
2025-06-13 08:40:11 -04:00
Micha Reiser
1f27d53fd5
[ty] File inclusion and exclusion ( #18498 )
2025-06-12 19:07:31 +02:00
Alex Waygood
324e5cbc19
[ty] Pull types on synthesized Python files created by mdtest ( #18539 )
2025-06-12 10:32:17 +01:00
renovate[bot]
e6fe2af292
Update Rust crate anstyle to v1.0.11 ( #18583 )
...
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-06-12 08:54:38 +02:00
Ibraheem Ahmed
65a2c6d4eb
Update salsa ( #18636 )
2025-06-12 07:17:00 +02:00
Alex Waygood
e84406d8be
[ty] Infer the Python version from --python=<system installation> on Unix ( #18550 )
2025-06-11 14:32:33 +00:00
Micha Reiser
3aae1cd59b
Fix incorrect salsa return_ref attribute ( #18605 )
2025-06-11 09:19:57 +02:00
Micha Reiser
5dcfc9f074
Move corpus tests to ty_python_semantic ( #18609 )
2025-06-11 08:55:30 +02:00
renovate[bot]
b5a77df46f
Update Rust crate smallvec to v1.15.1 ( #18586 )
2025-06-09 07:04:29 +02:00
renovate[bot]
8d1d0be648
Update Rust crate hashbrown to v0.15.4 ( #18585 )
2025-06-09 07:03:58 +02:00
renovate[bot]
1cf7b67e85
Update Rust crate anstream to v0.6.19 ( #18582 )
2025-06-09 07:03:19 +02:00
renovate[bot]
c18dc41f1a
Update Rust crate camino to v1.1.10 ( #18584 )
2025-06-09 02:28:52 +01:00
Alex Waygood
1274521f9f
[ty] Track the origin of the environment.python setting for better error messages ( #18483 )
2025-06-06 13:36:41 +01:00
Dylan
5faf72a4d9
Bump 0.11.13 ( #18484 )
2025-06-05 15:18:38 -05:00
Carl Meyer
9e8a7e9353
update to salsa that doesn't panic silently on cycles ( #18450 )
2025-06-04 07:40:16 +02:00
renovate[bot]
844c8626c3
Update Rust crate libcst to v1.8.0 ( #18424 )
2025-06-02 07:40:18 +02:00
renovate[bot]
1c8d9d707e
Update Rust crate clap to v4.5.39 ( #18419 )
2025-06-02 07:39:27 +02:00
Micha Reiser
54f597658c
[ty] Fix multithreading related hangs and panics ( #18238 )
2025-06-01 11:07:55 +02:00
Zanie Blue
88866f0048
[ty] Infer the Python version from the environment if feasible ( #18057 )
...
Co-authored-by: Alex Waygood <alex.waygood@gmail.com >
2025-05-30 21:22:51 +00:00
Micha Reiser
8005ebb405
Update salsa past generational id change ( #18362 )
2025-05-30 15:31:33 +02:00
Brent Westbrook
aee3af0f7a
Bump 0.11.12 ( #18369 )
2025-05-29 09:17:12 -04:00
Brent Westbrook
9925910a29
Add a ViolationMetadata::rule method ( #18234 )
...
Summary
--
This PR adds a macro-generated method to retrieve the `Rule` associated
with a given `Violation` struct, which makes it substantially cheaper
than parsing from the rule name. The rule is then converted to a
`NoqaCode` for storage on the `Message` (and eventually on the new
diagnostic type). The `ViolationMetadata::rule_name` method was now
unused, so the `rule` method replaces it.
Several types had to be moved from the `ruff_diagnostics` crate to the
`ruff_linter` crate to make this work, namely the `Violation` traits and
the old `Diagnostic` type, which had a constructor generic over a
`Violation`.
It's actually a fairly small PR, minus the hundreds of import changes.
The main changes are in these files:
-
[crates/ruff_linter/src/message/mod.rs](https://github.com/astral-sh/ruff/pull/18234/files#diff-139754ea310d75f28307008d21c771a190038bd106efe3b9267cc2d6c0fa0921 )
-
[crates/ruff_diagnostics/src/lib.rs](https://github.com/astral-sh/ruff/pull/18234/files#diff-8e8ea5c586935bf21ea439f24253fcfd5955d2cb130f5377c2fa7bfee3ea3a81 )
-
[crates/ruff_linter/src/diagnostic.rs](https://github.com/astral-sh/ruff/pull/18234/files#diff-1d0c9aad90d8f9446079c5be5f284150d97797158715bd9729e6f1f70246297a )
-
[crates/ruff_linter/src/lib.rs](https://github.com/astral-sh/ruff/pull/18234/files#diff-eb93ef7e78a612f5fa9145412c75cf6b1a5cefba1c2233e4a11a880a1ce1fbcc )
Test Plan
--
Existing tests
2025-05-28 09:27:09 -04:00
Micha Reiser
66b082ff71
[ty] Abort process if worker thread panics ( #18211 )
2025-05-26 13:09:06 +01:00
David Sherret
fbaf826a9d
Only enable js feature of uuid crate for wasm crates ( #18152 )
2025-05-26 10:33:51 +01:00
renovate[bot]
83498b95fb
Update Rust crate uuid to v1.17.0 ( #18306 )
2025-05-26 07:40:01 +02:00
renovate[bot]
03d7be3747
Update Rust crate jiff to v0.2.14 ( #18303 )
2025-05-26 07:38:37 +02:00
Dylan
0397682f1f
Bump 0.11.11 ( #18259 )
2025-05-22 13:09:44 -05:00
Micha Reiser
3b56c7ca3d
Update salsa ( #18212 )
2025-05-20 09:19:34 +02:00
Micha Reiser
220137ca7b
Cargo update ( #18191 )
2025-05-19 09:14:11 +02:00
renovate[bot]
38c332fe23
Update Rust crate bincode to v2 ( #18188 )
...
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Micha Reiser <micha@reiser.io >
2025-05-19 08:57:09 +02:00
renovate[bot]
12f5e99389
Update Rust crate jod-thread to v1 ( #18189 )
...
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-05-19 08:25:46 +02:00
renovate[bot]
d9cd6399e6
Update Rust crate insta to v1.43.1 ( #18180 )
...
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-05-19 06:24:40 +00:00