Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: Add ruff rules, improve type annotations, improve ci performance #3431

Merged
merged 101 commits into from
Jun 27, 2024
Merged
Changes from 1 commit
Commits
Show all changes
101 commits
Select commit Hold shift + click to select a range
de50aa9
ci: Add additional `ruff` rules to `pyproject.toml`
dangotbanned Jun 5, 2024
e019f17
fix: add item to `pyproject.toml` to silence import errors for `pylan…
dangotbanned Jun 5, 2024
54815ce
ci: add subset of `SIM` to `extend-safe-fixes`
dangotbanned Jun 5, 2024
1effcb1
ci: add unfixable `RUF` rules to `ignore`
dangotbanned Jun 5, 2024
a3fd77a
refactor: apply new `ruff` rules, fix and reformat
dangotbanned Jun 5, 2024
b6190f2
test: Skip tests on Win that require a tz database
dangotbanned Jun 5, 2024
0c57781
ci: enable `tool.ruff.lint.preview`
dangotbanned Jun 5, 2024
3171a3d
fix: replace [F841](https://docs.astral.sh/ruff/rules/unused-variable…
dangotbanned Jun 5, 2024
5ba210d
ci: add additional `preview` fixes to `extend-safe-fixes`
dangotbanned Jun 5, 2024
8ef6184
refactor: apply `preview` fixes for existing `ruff` rules, reformat
dangotbanned Jun 5, 2024
a16b292
ci: add `preview` category `FURB` rules
dangotbanned Jun 5, 2024
7fff541
refactor: apply `FURB` rule fixes, manually fix `FURB101/3`
dangotbanned Jun 5, 2024
217208b
fix: Revert newer fstring syntax, not available to `sphinx`
dangotbanned Jun 5, 2024
1e17533
ci: add fixable `pylint` rules
dangotbanned Jun 5, 2024
007b8b3
ci: add `pylint` fixes to `extend-safe-fixes`
dangotbanned Jun 5, 2024
10eb5d5
refactor: apply `pylint` rule fixes, add an inline optimization for `…
dangotbanned Jun 5, 2024
e1ab766
fix: Recover comments lost during linting
dangotbanned Jun 5, 2024
f3f6196
fix: Replace sources of `RUF002` violations
dangotbanned Jun 5, 2024
d4a554b
fix: manual fix `RUF002` in `api`
dangotbanned Jun 5, 2024
d584e08
ci: add `PTH` rules
dangotbanned Jun 6, 2024
ed2528b
refactor: Manually fix `PTH` rule violations
dangotbanned Jun 6, 2024
8393a5a
fix: Use safer `inspect.getattr_static` in `update_init_file`
dangotbanned Jun 6, 2024
38a3280
fix: Use correct f-string `!s` modifier
dangotbanned Jun 6, 2024
c7485dc
fix: Resolve `doc:build-html` error
dangotbanned Jun 6, 2024
626bc20
fix: Resolve utf-8 error for [emoji example](https://altair-viz.githu…
dangotbanned Jun 6, 2024
8e6a523
Update sphinxext/altairgallery.py
dangotbanned Jun 6, 2024
e935ad9
build: bump `docbuild.yml` python `3.10` -> `3.12`
dangotbanned Jun 7, 2024
9073a1f
style: Simplify `PluginRegistry` repr
dangotbanned Jun 7, 2024
de01aa5
revert: ignore `suppressible-exception` rule in `pyproject.toml`
dangotbanned Jun 7, 2024
80a7a22
refactor: remove need for exception handling in `utils._vegafusion_da…
dangotbanned Jun 7, 2024
b96c4e9
refactor: remove `python<3.3` compat code in `utils.core.use_signature`
dangotbanned Jun 7, 2024
88ec5c8
revert: replace `PLW1514` fixes with "utf-8"
dangotbanned Jun 7, 2024
59893bd
refactor: minor simplify and sort `__all__` from `generate_schema_wra…
dangotbanned Jun 7, 2024
03b4d09
docs: `FA100` on most of `tools/`*`
dangotbanned Jun 7, 2024
e17382a
docs: `FA100` on `sphinxext/*`
dangotbanned Jun 7, 2024
6f02e2e
docs: `FA100` on `alt.jupyter`
dangotbanned Jun 7, 2024
12a9bea
docs: `FA100` on `alt.expr`
dangotbanned Jun 7, 2024
c378b65
docs: `FA100` on `alt.vegalite`, excluding `v5.api`, `v5.schema/*`
dangotbanned Jun 8, 2024
f6da84e
docs: `FA100` on private `alt.utils` modules
dangotbanned Jun 8, 2024
185f2fd
docs(typing): Add annotations for `sphinxext`
dangotbanned Jun 8, 2024
e52e414
docs: `FA100` on public `alt.utils` modules, excluding `schemapi`
dangotbanned Jun 8, 2024
811d566
ci: update `pyproject.toml`, add new granular `tool.ruff.lint.per-fil…
dangotbanned Jun 8, 2024
dba02c9
revert: Change `write_file_or_filename` default `encoding` to `None`
dangotbanned Jun 8, 2024
a8597cb
docs: `FA100` on `tools.schemapi.schemapi`
dangotbanned Jun 8, 2024
6cfc769
feat(typing): add `from __future__ import annotations` for each file …
dangotbanned Jun 8, 2024
2a06b2e
ci(typing): adds `generate-schema-wrapper` script to `hatch`
dangotbanned Jun 9, 2024
337d844
refactor(typing): Improve annotations and narrowing in `schemapi`
dangotbanned Jun 9, 2024
76bc00b
build: run `generate-schema-wrapper`
dangotbanned Jun 9, 2024
ece2e85
revert(typing): Roll back runtime evaluated types not possible on old…
dangotbanned Jun 10, 2024
62f5eeb
fix(typing): Adds overloads and reduce ignore comments relating to `s…
dangotbanned Jun 10, 2024
eb5b30d
revert(typing): Roll back additional runtime evaluated types for `pyt…
dangotbanned Jun 10, 2024
d8a36e6
fix(typing): Use `...` for `DataTransformerType`
dangotbanned Jun 10, 2024
ea5a3d4
docs(typing): `FA100` on `alt.vegalite.v5.api` and manual annotation …
dangotbanned Jun 10, 2024
70e8e95
test: add pytest rules `PT` and fix `PT001` violations
dangotbanned Jun 10, 2024
8bbb78e
test: add ignores for `PT011` on existing tests
dangotbanned Jun 10, 2024
cd56353
test: fix `PT018` violation
dangotbanned Jun 10, 2024
27aab26
test: fix `PT006` violations
dangotbanned Jun 10, 2024
a820ed1
test: add ignore for `PT012` violation
dangotbanned Jun 10, 2024
4b38b87
test: add `pytest.mark.xfail` for flaky `scatter_with_layered_histogr…
dangotbanned Jun 10, 2024
25ce09b
ci: tidy up `ruff` section of `pyproject.toml`
dangotbanned Jun 10, 2024
fd20f00
perf: adds config `pyproject.toml` for faster build, test runs
dangotbanned Jun 10, 2024
ad9e70c
ci: adds `update-init-file` hatch script
dangotbanned Jun 10, 2024
8308b6e
ci: adds newer-style `hatch` test config
dangotbanned Jun 10, 2024
36da1c7
feat(typing): Use `TYPE_CHECKING` block for `schema` modules
dangotbanned Jun 10, 2024
538b527
test: use a more reliable `xfail` condition for flaky test
dangotbanned Jun 11, 2024
9582971
build: Embed extra `ruff` calls in `generate-schema-wrapper` into the…
dangotbanned Jun 11, 2024
33056a2
build: Manually rewrite certain exceptions with flaky autofix
dangotbanned Jun 11, 2024
5244100
refactor: remove now-unneeded `PARAMETER_PROTOCOL`
dangotbanned Jun 11, 2024
4dba0a6
refactor: replace existing references to `typing.Optional`
dangotbanned Jun 11, 2024
03c217c
refactor(typing): rename `T` TypeVar to `TSchemaBase`
dangotbanned Jun 11, 2024
fbc02e2
feat(typing): Adds dedicated `Optional` alias for `Union[..., Undefin…
dangotbanned Jun 11, 2024
f8aa86f
refactor(typing): Remove `UndefinedType` dependency in `api`
dangotbanned Jun 12, 2024
046faa8
refactor(typing): Remove `UndefinedType` dependency in `api`
dangotbanned Jun 12, 2024
05ae13f
refactor(typing): Remove annotation scope `UndefinedType` dependency …
dangotbanned Jun 12, 2024
30ff371
ci: add `W291` to ensure trailing whitespace is autofixed
dangotbanned Jun 12, 2024
dc98ae1
refactor: define non-relevant attributes closer to imports in `update…
dangotbanned Jun 12, 2024
f82adbd
feat(typing): Adds `_TypeAliasTracer` and reorders `generate_schema_w…
dangotbanned Jun 12, 2024
a7b0ab5
build: run `generate-schema-wrapper` using `_TypeAliasTracer`
dangotbanned Jun 12, 2024
4593796
fix: Add missing `LiteralString` import
dangotbanned Jun 12, 2024
3e07902
test: add `pytest.mark.filterwarnings` for tests that cannot avoid them
dangotbanned Jun 13, 2024
7cf20c0
refactor(typing): Replace `Literal[None]` -> `None`
dangotbanned Jun 13, 2024
65e3279
test: Change `skipif` -> `xfail` for `test_sanitize_pyarrow_table_col…
dangotbanned Jun 13, 2024
60b40a5
ci: bump `actions/setup-python`, `python-version`, use `uv` in `lint.…
dangotbanned Jun 14, 2024
ce7c95b
ci: create venv before uv pip install
dangotbanned Jun 14, 2024
50cd1e3
ci: ensure venv is activated after install
dangotbanned Jun 14, 2024
330f638
ci: use environment provided by `hatch`
dangotbanned Jun 14, 2024
237079f
ci: testing `pytest-xdist` in `build` workflow
dangotbanned Jun 14, 2024
3ec3e6a
test(perf): adds significant parallelism for slow `test_examples`
dangotbanned Jun 14, 2024
0da50cc
refactor, perf: reduce `sys.path` usage, use dictcomp in `update_init…
dangotbanned Jun 15, 2024
686a84b
build: adding debug message to help with build failure
dangotbanned Jun 15, 2024
5da0207
build: add cwd to debug message
dangotbanned Jun 15, 2024
eede0f4
fix: possibly fix cwd not on path
dangotbanned Jun 15, 2024
89ab1f3
ci: testing invoking script with `-m` for cwd
dangotbanned Jun 15, 2024
87a686c
fix: remove debug code
dangotbanned Jun 15, 2024
2122dd2
Merge branch 'update-ruff-rules' of https://github.com/dangotbanned/a…
dangotbanned Jun 15, 2024
580c9f6
Merge branch 'main' into update-ruff-rules
dangotbanned Jun 19, 2024
d0c01eb
fix: resolve lint, format, type conflicts following rebase
dangotbanned Jun 19, 2024
ca961c0
DO NOT MERGE - TESTING DOC PERF
dangotbanned Jun 21, 2024
26df622
revert: undo last commit
dangotbanned Jun 21, 2024
bb32cd3
refactor: Remove commented out dead code
dangotbanned Jun 27, 2024
89e1029
ci: Remove extra whitespace in `build.yml`
dangotbanned Jun 27, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion sphinxext/altairgallery.py
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@ def main(app):
example["prev_ref"] = "gallery_{name}".format(**prev_ex)
if next_ex:
example["next_ref"] = "gallery_{name}".format(**next_ex)
Path(target_dir, f"{example["name"]}.rst").write_text(
Path(target_dir, example["name"] + ".rst").write_text(
dangotbanned marked this conversation as resolved.
Show resolved Hide resolved
EXAMPLE_TEMPLATE.render(example), encoding="utf-8"
)

Expand Down
Loading