Update requirements and resolve version incompatibilities - #1927
Conversation
In Lark version 1.3.1, `common.py` introduced a runtime `TypeError`: 1. Line 21 defines `_LexerArgType` as a string forward reference: ```python _LexerArgType: 'TypeAlias' = 'Union[Literal[...], Type[Lexer]]' ``` 2. Line 37 inside class `LexerConf` evaluates `lexer_type: _LexerArgType | None` 3. Because the module does not use from `__future__ import annotations`, Python evaluates `'Union[...]' | None` at module import time, raising an exception: ```python TypeError: unsupported operand type(s) for |: 'str' and 'NoneType' ``` 4. During pytest test collection, lark is imported by rfc3987_syntax, which is imported by jsonschema, which is imported by nbformat, and this import would fail with the error above.
This is the result of running `uv sync` after the changes to `pyproject.toml`.
|
Check out this pull request on See visual diffs & provide feedback on Jupyter Notebooks. Powered by ReviewNB |
In Matplotlib 3.10+, `Axes.legend()` strictly enforces that handles and labels must both be passed positionally or both as keyword arguments. In Cell 12 of resource_estimation.ipynb, an array of integers (`handles = np.arange(...))` was passed positionally alongside `labels=labels` as a keyword argument, triggering `TypeError: When passing handles and labels, they must both be passed positionally or both as keywords`.
Belongs in a separate PR.
There was a problem hiding this comment.
Code Review
This pull request performs various cleanups and dependency updates, including fixing a relative link in the GitHub problem matchers documentation, pinning dash and lark versions in pyproject.toml to prevent import-time errors, removing unused imports across several modules, and updating a Jupyter Notebook to use matplotlib.colormaps instead of the deprecated matplotlib.cm.get_cmap. The reviewer pointed out critical syntax errors in the Jupyter Notebook's JSON structure where certain lines are missing opening double quotes, which would render the notebook file unparseable.
Per [PR review comment](quantumlib#1927 (comment)) by Matt H., the lark version restriction should be more flexible so that it doesn't cause problems in the future.
|
@mpharrigan Some further testing locally revealed that the changes to the imports had nothing to do with the requirements version changes, so I took them out of this PR completely and will put them in a separate PR. Mentioning this because I saw that you had just approved this PR, and these changes came after the approval. To be safe, I'm requesting re-review. |
Cloning the repository and doing a
uv syncproduced an environment where some tests failed locally. I suspect some third-party transitive dependencies may have changed recently. Resolving the failures required constraining two package versions inpyproject.toml. Following the addition of the constraints and refreshinguv.lock, a minor incompatibility arose involving a Matplotlib colormap function used in a notebook.