fix: type issues with Chart mark methods.#3936
Conversation
mark_* methods.
9140413 to
51c0ddb
Compare
|
@mattijn the builds are failing with my latest commit, likely due to changes I've made in the schemapi code and generated schema python files (the builds fail on "Test that schema generation has no effect"). The tests pass on my system -- are there additional steps I need to take to pass the pull-request build process when the generated files change? |
f0768ac to
bffbeca
Compare
|
Great that you are making progress! No problem! I might have a clue how to approach this. It's in the contributing docs:
Once you have done that you also shall commit these changed files. The Github CI is doing this too, and errors when there are changes after generation. |
|
I've run Interestingly, the CI error message indicates ruff has a problem with the Here is the CI output: RUF067 `__init__` module should only contain docstrings and re-exports
--> altair/vegalite/v6/schema/__init__.py:9:1
|
7 | from altair.vegalite.v6.schema.core import *
8 |
9 | SCHEMA_VERSION = 'v6.1.0'
| ^^^^^^^^^^^^^^^^^^^^^^^^^
10 |
11 | SCHEMA_URL = 'https://vega.github.io/schema/vega-lite/v6.1.0.json'
|
RUF067 `__init__` module should only contain docstrings and re-exports
--> altair/vegalite/v6/schema/__init__.py:11:1
|
9 | SCHEMA_VERSION = 'v6.1.0'
10 |
11 | SCHEMA_URL = 'https://vega.github.io/schema/vega-lite/v6.1.0.json'
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
12 |
13 | __all__ = ['SCHEMA_URL', 'SCHEMA_VERSION', 'channels', 'core']
|
...
subprocess.CalledProcessError:
Command '('ruff', 'check',
PosixPath('/home/runner/work/altair/altair/altair/vegalite/v6/schema/__init__.py'), '--fix')'
returned non-zero exit status 1.
Error: Process completed with exit code 1.I checked the "Install dependencies" CI step and indeed the latest ruff is installed: Run uv pip install -e ".[dev, all]"
...
+ ruff==0.14.11On my system version 0.12.3 is installed: uv sync --all-extras
uv tree --outdated -d1
...
── ruff v0.12.3 (extra: dev) (latest: v0.14.11) |
|
I believe the regression is from ruff 0.14.10 to 0.14.11. My previous PR built fine with ruff 0.14.10 but this one fails with ruff 0.14.11. When I manually set these versions locally, I can reproduce this: ❯ uv sync --all-extras -P ruff==0.14.10
❯ uv run ruff check altair/vegalite/v6/schema/__init__.py
All checks passed!❯ uv sync --all-extras -P ruff==0.14.11
❯ uv run ruff check altair/vegalite/v6/schema/__init__.py
RUF067 `__init__` module should only contain docstrings and re-exports
--> altair/vegalite/v6/schema/__init__.py:9:1
|
7 | from altair.vegalite.v6.schema.core import *
8 |
9 | SCHEMA_VERSION = "v6.1.0"
| ^^^^^^^^^^^^^^^^^^^^^^^^^
10 |
11 | SCHEMA_URL = "https://vega.github.io/schema/vega-lite/v6.1.0.json"
|
RUF067 `__init__` module should only contain docstrings and re-exports
--> altair/vegalite/v6/schema/__init__.py:11:1
|
9 | SCHEMA_VERSION = "v6.1.0"
10 |
11 | SCHEMA_URL = "https://vega.github.io/schema/vega-lite/v6.1.0.json"
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
12 |
13 | __all__ = [
|
Found 2 errors.It looks like the CI build grabs the latest ruff, while my local build pegs to 0.12.3. Looking into ruff |
4e1a7e5 to
636261b
Compare
|
Note:
Probably both CI steps should use |
|
The latest build works when I peg the max ruff version to 0.12.3 in This fixes the build error, but does not address the dependency inconsistency between "build" and "lint" steps. |
86016a4 to
f3fec33
Compare
mark_* methods.|
Great research! Good idea to align lint and build process using One question regarding current code diff, why is this |
|
The Setting Existing preview options do trigger a warning during warning: Selection `PLC2801` has no effect because preview is not enabled.
warning: Selection `PLR6201` has no effect because preview is not enabled.
warning: Selection `PLW1514` has no effect because preview is not enabled.These ruff options are commented out in Footnotes
|
1bb0056 to
3240941
Compare
3240941 to
2862eec
Compare
|
CI has been stable since disabling ruff preview. PR is ready for review/merge. |
|
Looks great! One last question: Why is this change in |
|
Good eyes👍 Merged and thanks again for working on this |
Chart
mark_lineand similar methods trigger a basedpyright type check warning for unknown argument. This PR adds type annotations to remove the warning. It also fixes some minor type warnings raised by ty and basedpyright.Resolves #3870.