hydrust 0.5.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,26 @@
1
+ # Generated by Cargo
2
+ # will have compiled files and executables
3
+ debug
4
+ target
5
+
6
+ # These are backup files generated by rustfmt
7
+ **/*.rs.bk
8
+
9
+ # MSVC Windows builds of rustc generate these, which store debugging information
10
+ *.pdb
11
+
12
+ # Generated by cargo mutants
13
+ # Contains mutation testing data
14
+ **/mutants.out*/
15
+
16
+ # RustRover
17
+ # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
18
+ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
19
+ # and can be added to the global gitignore or merged into this file. For a more nuclear
20
+ # option (not recommended) you can uncomment the following to ignore the entire idea folder.
21
+ #.idea/
22
+
23
+ dev-docs/
24
+ code_reference/
25
+ # Python
26
+ __pycache__/
@@ -0,0 +1 @@
1
+
@@ -0,0 +1,66 @@
1
+ # Hydrust
2
+
3
+ ## Common commands
4
+
5
+ ```bash
6
+ # Test the project
7
+ cargo test
8
+
9
+ # Run linting checks
10
+ cargo clippy
11
+ ```
12
+
13
+ ## Adding a feature
14
+
15
+ **A settings key** — parse it in `initialize`, then add it to `CORE_SETTINGS` (or
16
+ to the `feature_toggles!` list for an on/off switch, which registers the key for
17
+ you). Update the counts in [tests/capabilities.rs](tests/capabilities.rs). In the
18
+ extension: declare it in `package.json`, send it from `startServer`, add a
19
+ `SETTING_COMPAT` entry.
20
+
21
+ **A diagnostic rule** — add it to `diagnostic_rules!` in
22
+ [src/diagnostics.rs](src/diagnostics.rs) and it is advertised automatically. In
23
+ the extension, add a `RULE_COMPAT` entry; for a *rename*, record the old code as
24
+ `previousCode` so the client can rewrite it for older servers, as
25
+ `invalid-target` → `invalid-hydra-parameter` did in v0.3.0.
26
+
27
+ **A behaviour the client must know about** — only needed when it depends on a
28
+ client capability, or the client has to branch on it. Read the client capability
29
+ in `initialize` and store the flag, add a field to `NegotiatedFeatures` and a
30
+ `(name, gate)` pair to `SUPPORTED_FEATURES`, and gate the behaviour on that same
31
+ flag so the advertised name is never a promise the session will not keep. Cover
32
+ it both ways in [tests/capabilities.rs](tests/capabilities.rs). In the extension,
33
+ add a `FEATURE_COMPAT` entry; names become `hydrust.supports.<name>` context keys.
34
+
35
+ Anything the server always does and can advertise through a standard LSP
36
+ capability field needs none of this.
37
+
38
+ ### Rules
39
+
40
+ - Bump `HYDRUST_PROTOCOL_VERSION` only when something already in the block
41
+ changes meaning: a key that starts doing something different, a repurposed
42
+ feature name, a field that changes type. Additions never need a bump.
43
+ - Never remove or repurpose a name quietly — a client may still send it.
44
+ - Unknown settings keys stay ignored, never rejected.
45
+ - `features` is always an array, even when empty; clients test membership on it.
46
+ - Bump the crate version and add a CHANGELOG entry. The client's fallback table
47
+ is keyed on release versions.
48
+
49
+ ### Checking it
50
+
51
+ `cargo test --test capabilities` covers the block's shape. In the extension repo,
52
+ `npm run test:contract` checks the client against a real running binary, and
53
+ `npm run test:table-audit` re-verifies the fallback table against tagged sources.
54
+
55
+ ## Threading
56
+
57
+ The server runs its analysis on two `rayon` pools — a latency pool for hover,
58
+ completion and semantic tokens, and a worker pool for diagnostics — alongside a
59
+ single-threaded tokio runtime that handles the protocol itself. The `numThreads`
60
+ setting is the total across all three, and defaults to a size the server picks to
61
+ fit the machine.
62
+
63
+ [docs/threading-model.md](docs/threading-model.md) is the reference for this:
64
+ where each request handler does its work, why the counts are what they are, and
65
+ which alternatives were tried and rejected. Read it before changing a thread
66
+ count, the concurrency level, or where a handler runs.
@@ -0,0 +1,109 @@
1
+ # Changelog
2
+
3
+ ## [0.5.0]
4
+
5
+ ### Breaking
6
+
7
+ - **One binary.** The `hydra-lsp` and `hydra-check` binaries are gone. Everything is now `hydrust`, with two subcommands: `hydrust check` and `hydrust server`. An editor that used to launch `hydra-lsp` with no arguments must launch `hydrust server`; the VSCode extension does this from v0.1.7 onwards.
8
+ - **The crate is renamed `hydra-lsp` → `hydrust`**, so the release archives are now `hydrust-<target>.<ext>` and contain a `hydrust` executable. A VSCode extension older than v0.1.7 does not recognise the new asset name and silently stays on v0.4.2. `use hydra_lsp::` becomes `use hydrust::` for anything depending on the library.
9
+ - **Removed `server` cargo feature**, along with `--no-default-features`.
10
+ - `serverInfo.name` in the `initialize` response is now `"hydrust"`.
11
+ - **`hydrust check --disable-rule` rejects an unknown rule** as a usage error (exit 2) instead of warning and continuing.
12
+ - **`hydrust check` without `--workspace` resolves Python modules against the current directory**, even for a single file. `hydra-check` previously used the file's own directory.
13
+
14
+ ### Other changes
15
+
16
+ - **Published to PyPI as `hydrust`.** e.g. `pip install hydrust`, `uv tool install hydrust`.
17
+ - `hydrust check` now accepts multiple files and directories. Directories are walked recursively for `.yaml` and `.yml` files, honouring `.gitignore`; discovered files that carry no Hydra markers are skipped silently.
18
+ - Added `--output-format github`, emitting GitHub Actions workflow commands so diagnostics render as inline annotations.
19
+ - Renamed `--format` to `--output-format`.
20
+ - JSON output is now a single document covering every checked file, rather than one document per file.
21
+ - The JSON `summary` now counts diagnostics only in `total`, reports `other`, and counts files that could not be read or parsed under a separate `failed_files` field.
22
+ - Reported paths always use `/` separators, so `--output-format github` annotations attach on Windows runners.
23
+ - Directory walks no longer apply the user's global git excludes (`core.excludesFile`), so a local run and a CI run check the same files.
24
+ - An unreadable directory or a file that disappears mid-walk is now logged and skipped, rather than aborting the whole run.
25
+ - Finding no YAML files to check now warns on stderr and exits 0, rather than being a fatal error (exit 2).
26
+ - The JSON `end_column` is now an inclusive 1-based column, matching `endColumn` in the github format; it was previously exclusive, so single-line values are one lower than before. A multi-line range that ends at the start of a line is reported as ending on the previous line, with `end_column` null (and `endColumn` omitted).
27
+ - The workspace root falls back to the canonicalized current directory, so it matches the paths reported for each file.
28
+
29
+ ## [0.4.2]
30
+
31
+ - Fixed lazy package exports declared under `if TYPE_CHECKING:` (or `if typing.TYPE_CHECKING:`) not resolving when combined with a module-level `__getattr__` and `__all__` (fixes #43)
32
+
33
+ ## [0.4.1]
34
+
35
+ - Fixed relative re-exports failing to resolve when a package sits under more than one search root, such as a virtual environment stored inside the workspace. The most specific containing root is now used to convert a relative import to an absolute module name.
36
+
37
+ ## [0.4.0]
38
+
39
+ - Added an incremental cache built on salsa (`HydraDatabase`), so YAML parses, Python target resolutions, and diagnostics are reused between requests instead of being recomputed on every keystroke
40
+ - Cached YAML parsing per document version through the `DocumentInput`/`ParsedYaml` salsa inputs, replacing the previous `DocumentStore`
41
+ - Cached Python definition lookups in `python_cache`, keyed on the target string and the resolved search paths
42
+ - Routed Python source reads through `ruff_db::source_text` so resolved Python definitions participate in salsa's dependency graph
43
+ - Removed the `FileCache` wrapper from `PythonAnalyzer` and `ImportResolver` in favour of a single `read_source` helper backed by salsa
44
+ - Moved analysis off the async runtime onto two `rayon` pools (a latency pool for interactive requests, a worker pool for diagnostics), sized by the new `numThreads` initialization option
45
+ - Answered `textDocument/semanticTokens/full` from a database snapshot on the latency pool instead of inline under the database lock
46
+ - Sized the thread pools to a fixed 2 latency + 3 worker by default, rather than scaling the worker pool with the CPU count
47
+ - Fixed the server hanging instead of exiting when the client's pipe closes while a handler is talking to it
48
+ - Raised `tower-lsp`'s concurrency level from its default of 4 to 8
49
+ - Clamped `numThreads` to 11 rather than to the CPU count. Beyond that the threads are unreachable rather than merely oversubscribed.
50
+ - Registered `workspace/didChangeWatchedFiles` dynamically for `**/*.{py,pyi,pth}`, covering the workspace folders and — where the client supports relative patterns — each out-of-workspace site-packages root
51
+ - Replaced the `PythonConfig::cache_revision` global counter with per-file `ruff_db::files::File::sync_path` invalidation in `did_change_watched_files`, so editing one Python file no longer evicts every cached resolution
52
+ - Added per-directory `PthInventory` salsa input so `.pth` create/delete events invalidate editable-install resolution without flushing every cache entry
53
+ - Added pull diagnostics (`textDocument/diagnostic`), returning unchanged reports via result IDs when nothing has changed, and falling back to push publishing for clients without pull support
54
+ - Sent `workspace/diagnostic/refresh` after watched Python files change, so open configs pick up edits made outside the editor
55
+ - Cleared diagnostics when a document stops being a Hydra file or is closed, instead of leaving stale entries in the client
56
+ - Returned `ServerCancelled` with `retrigger_request` when a pull-diagnostic round is superseded by a newer edit
57
+ - Fixed server panics caused by salsa cancellation escaping into the rayon pools
58
+ - Fixed UTF-16 position handling for non-ASCII content, so positions match the encoding advertised to the client
59
+ - Fixed `.pth` parsing to follow Python's lexical rules, and to only cache `.pth` files on the search path
60
+ - Added `--version` and `--help` flags to the server binary, so a client can identify a binary before launching it; any other invocation still starts the stdio language server
61
+ - Added a self-describing `capabilities.experimental.hydrust` block to the `initialize` response, listing the protocol version, the settings keys and diagnostic rules this build understands, and the coarse features actually switched on for the session after negotiating against the client's capabilities
62
+
63
+ ## [0.3.0]
64
+
65
+ - Added class name for `__init__` diagnostics
66
+ - Implemented `signature_help` for parameters
67
+ - Added support for `_args_`, `_convert_`, and `_recursive_`
68
+ - Renamed `invalid-target` diagnostic to `invalid-hydra-parameter` and included other checks within that rule
69
+
70
+ ## [0.2.0]
71
+
72
+ - Refactored `yaml` parsing from `serde_yaml` to `saphyr`
73
+ - Added suppression comments
74
+ - Fixed issue where `missing-argument` diagnostic appeared for `cls` in class methods
75
+ - Fixed issue whereby non-conventionally named first arguments would not be filtered out in instance and class methods
76
+
77
+ ## [0.1.5]
78
+
79
+ - Added support for `_partial_`
80
+ - Fixed issue of finding parent class docstring and signature when not overridden by child class
81
+ - Fixed module resolution for `classmethod`s and `staticmethod`s
82
+ - Refactored `PythonAnalyzer` to cache file reads
83
+ - Fixed parameter placement issue when parameter's were above `_target_`
84
+
85
+ ## [0.1.4]
86
+
87
+ - Fixed issue with `goto_definition` filepath for re-exported modules
88
+ - Improved docstring rendering on hover
89
+
90
+ ## [0.1.3]
91
+
92
+ - Fixed issue with `python` reimports not being found by `PythonAnalyzer`
93
+ - Created `hydra-check` CLI tool
94
+ - Removed dummy `CompletionResponse`s
95
+ - Fixed issue in `YamlParser` whereby parameters weren't being fully recursively searched
96
+ - Fixed issue with incorrect semantic token handling for sequences
97
+ - Fixed issue of `.pth` files not being used for python import resolution
98
+
99
+ ## [0.1.2]
100
+
101
+ - Refactor of `YamlParser::find_valid_target_key` to simplify implementation
102
+
103
+ ## [0.1.1]
104
+
105
+ - Fixes to `YamlParser` when encountering commented out `_target_` key or values
106
+
107
+ ## [0.1.0]
108
+
109
+ - Initial release