-
Notifications
You must be signed in to change notification settings - Fork 793
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
Commits on Jun 5, 2024
-
Configuration menu - View commit details
-
Copy full SHA for de50aa9 - Browse repository at this point
Copy the full SHA de50aa9View commit details -
Configuration menu - View commit details
-
Copy full SHA for e019f17 - Browse repository at this point
Copy the full SHA e019f17View commit details -
Configuration menu - View commit details
-
Copy full SHA for 54815ce - Browse repository at this point
Copy the full SHA 54815ceView commit details -
ci: add unfixable
RUF
rules toignore
[RUF002](https://docs.astral.sh/ruff/rules/ambiguous-unicode-character-docstring/) may be avoidable during schema generation, so I'm not doing any manual fixes right now.
Configuration menu - View commit details
-
Copy full SHA for 1effcb1 - Browse repository at this point
Copy the full SHA 1effcb1View commit details -
Configuration menu - View commit details
-
Copy full SHA for a3fd77a - Browse repository at this point
Copy the full SHA a3fd77aView commit details -
Configuration menu - View commit details
-
Copy full SHA for b6190f2 - Browse repository at this point
Copy the full SHA b6190f2View commit details -
ci: enable
tool.ruff.lint.preview
Testing the effect this has with existing rules, prior to adding `pylint`, `refurb`
Configuration menu - View commit details
-
Copy full SHA for 0c57781 - Browse repository at this point
Copy the full SHA 0c57781View commit details -
fix: replace [F841](https://docs.astral.sh/ruff/rules/unused-variable/)…
… violations with dummy variable
Configuration menu - View commit details
-
Copy full SHA for 3171a3d - Browse repository at this point
Copy the full SHA 3171a3dView commit details -
Configuration menu - View commit details
-
Copy full SHA for 5ba210d - Browse repository at this point
Copy the full SHA 5ba210dView commit details -
Configuration menu - View commit details
-
Copy full SHA for 8ef6184 - Browse repository at this point
Copy the full SHA 8ef6184View commit details -
ci: add
preview
categoryFURB
rulesAlmost all have autofixes, splitting out from [pylint](https://docs.astral.sh/ruff/rules/#pylint-pl) which is much larger in scope + fewer fixes
Configuration menu - View commit details
-
Copy full SHA for a16b292 - Browse repository at this point
Copy the full SHA a16b292View commit details -
Configuration menu - View commit details
-
Copy full SHA for 7fff541 - Browse repository at this point
Copy the full SHA 7fff541View commit details -
Configuration menu - View commit details
-
Copy full SHA for 217208b - Browse repository at this point
Copy the full SHA 217208bView commit details -
Across the 4 `PL.` categories, there are over 50 rules, with a mix of fixable, preview. Tried to be picky with what is added, because adding even 1 of the groups would generate a lot of manual fixes.
Configuration menu - View commit details
-
Copy full SHA for 1e17533 - Browse repository at this point
Copy the full SHA 1e17533View commit details -
Configuration menu - View commit details
-
Copy full SHA for 007b8b3 - Browse repository at this point
Copy the full SHA 007b8b3View commit details -
refactor: apply
pylint
rule fixes, add an inline optimization for `……_selection` `param_kwds` in `_selection` triggered `PLR6201`. Instead rewrote as a dictcomp.
Configuration menu - View commit details
-
Copy full SHA for 10eb5d5 - Browse repository at this point
Copy the full SHA 10eb5d5View commit details -
Configuration menu - View commit details
-
Copy full SHA for e1ab766 - Browse repository at this point
Copy the full SHA e1ab766View commit details -
Configuration menu - View commit details
-
Copy full SHA for f3f6196 - Browse repository at this point
Copy the full SHA f3f6196View commit details -
Configuration menu - View commit details
-
Copy full SHA for d4a554b - Browse repository at this point
Copy the full SHA d4a554bView commit details
Commits on Jun 6, 2024
-
`flake8-use-pathlib` rules all require manual fixes. > Found 70 errors. <details> <summary>Details</summary> ```md 20 PTH118 `os.path.join()` should be replaced by `Path` with `/` operator 12 PTH120 `os.path.dirname()` should be replaced by `Path.parent` 11 PTH100 `os.path.abspath()` should be replaced by `Path.resolve()` 11 PTH123 `open()` should be replaced by `Path.open()` 7 PTH110 `os.path.exists()` should be replaced by `Path.exists()` 6 PTH107 `os.remove()` should be replaced by `Path.unlink()` 3 PTH103 `os.makedirs()` should be replaced by `Path.mkdir(parents=True)` ```
Configuration menu - View commit details
-
Copy full SHA for d584e08 - Browse repository at this point
Copy the full SHA d584e08View commit details -
Configuration menu - View commit details
-
Copy full SHA for ed2528b - Browse repository at this point
Copy the full SHA ed2528bView commit details -
fix: Use safer
inspect.getattr_static
inupdate_init_file
Avoids [triggering](https://docs.python.org/3/library/inspect.html#inspect.getattr_static) on objects like `datum`, `expr`
Configuration menu - View commit details
-
Copy full SHA for 8393a5a - Browse repository at this point
Copy the full SHA 8393a5aView commit details -
Configuration menu - View commit details
-
Copy full SHA for 38a3280 - Browse repository at this point
Copy the full SHA 38a3280View commit details -
fix: Resolve
doc:build-html
error```log Extension error (sphinxext.altairgallery): Handler <function main at 0x7f0873471ab0> for event 'builder-inited' threw an exception (exception: unsupported operand type(s) for +: 'PosixPath' and 'str') ```
Configuration menu - View commit details
-
Copy full SHA for c7485dc - Browse repository at this point
Copy the full SHA c7485dcView commit details -
Configuration menu - View commit details
-
Copy full SHA for 626bc20 - Browse repository at this point
Copy the full SHA 626bc20View commit details -
Update sphinxext/altairgallery.py
Co-authored-by: Stefan Binder <binder_stefan@outlook.com>
Configuration menu - View commit details
-
Copy full SHA for 8e6a523 - Browse repository at this point
Copy the full SHA 8e6a523View commit details
Commits on Jun 7, 2024
-
Configuration menu - View commit details
-
Copy full SHA for e935ad9 - Browse repository at this point
Copy the full SHA e935ad9View commit details -
Configuration menu - View commit details
-
Copy full SHA for 9073a1f - Browse repository at this point
Copy the full SHA 9073a1fView commit details -
Configuration menu - View commit details
-
Copy full SHA for de01aa5 - Browse repository at this point
Copy the full SHA de01aa5View commit details -
refactor: remove need for exception handling in `utils._vegafusion_da…
…ta.get_inline_tables` I'm happy to revert back to the original `try-catch`, but think it was less both less efficient and understandable. If I've understood correctly: - Every time this was called, all tables would be iterated over - On the first call, tables processed by the `vegafusion_data_transformer` would popped and returned - On all calls, other tables would be ignored but always trigger exceptions - On any call other than the first, every table triggers an exception This behaviour is easily reduced using [set methods](https://docs.python.org/3/library/stdtypes.html#set) directly, as an empty `set` would produce an empty `dict` during the `dictcomp`. vega#3431 (comment)
Configuration menu - View commit details
-
Copy full SHA for 80a7a22 - Browse repository at this point
Copy the full SHA 80a7a22View commit details -
refactor: remove
python<3.3
compat code inutils.core.use_signature
Was replaced with `contextlib.suppress` in a3fd77a but targets long-unsupported python versions. For future reference, there are also related `stdlib` functions that may have not been available when this was written: - [inspect.getdoc](https://docs.python.org/3/library/inspect.html#inspect.getdoc) - [functools.wraps](https://docs.python.org/3/library/functools.html#functools.wraps) Wouldn't cover everything there, but may replace the need for some parts. vega#3431 (comment)
Configuration menu - View commit details
-
Copy full SHA for b96c4e9 - Browse repository at this point
Copy the full SHA b96c4e9View commit details -
revert: replace
PLW1514
fixes with "utf-8"The rule remains in `pyproject.toml`, but is no longer autofixed with undesirable `locale.getprefferedencoding(False)`. vega#3431 (comment)
Configuration menu - View commit details
-
Copy full SHA for 88ec5c8 - Browse repository at this point
Copy the full SHA 88ec5c8View commit details -
Configuration menu - View commit details
-
Copy full SHA for 59893bd - Browse repository at this point
Copy the full SHA 59893bdView commit details -
docs:
FA100
on most oftools/
*`The start of a cautious introduction of `from __future__ import annotations`. Excludes `schemaapi.schemaapi.py` for now, but I think that would be safe as well.
Configuration menu - View commit details
-
Copy full SHA for 03b4d09 - Browse repository at this point
Copy the full SHA 03b4d09View commit details -
Configuration menu - View commit details
-
Copy full SHA for e17382a - Browse repository at this point
Copy the full SHA e17382aView commit details -
Configuration menu - View commit details
-
Copy full SHA for 6f02e2e - Browse repository at this point
Copy the full SHA 6f02e2eView commit details -
Configuration menu - View commit details
-
Copy full SHA for 12a9bea - Browse repository at this point
Copy the full SHA 12a9beaView commit details
Commits on Jun 8, 2024
-
docs:
FA100
onalt.vegalite
, excludingv5.api
,v5.schema/*
- Covers non-autogenerated code. - `api` is being special-cased for now. - Will be a great candidate for these fixes, but there are many simpler modules in `alt.utils` that I'm priotizing in case they highlight issues
Configuration menu - View commit details
-
Copy full SHA for c378b65 - Browse repository at this point
Copy the full SHA c378b65View commit details -
Configuration menu - View commit details
-
Copy full SHA for f6da84e - Browse repository at this point
Copy the full SHA f6da84eView commit details -
docs(typing): Add annotations for
sphinxext
- Making use of `FA100` enabled syntax - Eventually would like to improve the performance of this, since `sphinxext` is by far the longest build step - Towards that end, the annotations give a contextual starting point
Configuration menu - View commit details
-
Copy full SHA for 185f2fd - Browse repository at this point
Copy the full SHA 185f2fdView commit details -
docs:
FA100
on publicalt.utils
modules, excludingschemapi
- Also did made some improvements to annotations more broadly, now that the newer syntax is allowed
Configuration menu - View commit details
-
Copy full SHA for e52e414 - Browse repository at this point
Copy the full SHA e52e414View commit details -
ci: update
pyproject.toml
, add new granular `tool.ruff.lint.per-fil……e-ignores` setting - So far been making the changes one file at a time, followed by tests - Not encountered any runtime issues - `mypy` has complained occasionally, but has been resolvable
Configuration menu - View commit details
-
Copy full SHA for 811d566 - Browse repository at this point
Copy the full SHA 811d566View commit details -
Configuration menu - View commit details
-
Copy full SHA for dba02c9 - Browse repository at this point
Copy the full SHA dba02c9View commit details -
docs:
FA100
ontools.schemapi.schemapi
Also adds some annotations that are now possible without circular import concerns
Configuration menu - View commit details
-
Copy full SHA for a8597cb - Browse repository at this point
Copy the full SHA a8597cbView commit details -
feat(typing): add
from __future__ import annotations
for each file ……in `generate_schema_wrapper` Also: - ensure `annotations` excluded from `__all__` - minor standardizing import order - adjust `ruff` rules to correct schemagen
Configuration menu - View commit details
-
Copy full SHA for 6cfc769 - Browse repository at this point
Copy the full SHA 6cfc769View commit details
Commits on Jun 9, 2024
-
ci(typing): adds
generate-schema-wrapper
script tohatch
Rewrites and reformats all annotations in `altair/vegalite/v?/schema` - Meaning that the original code stays the same: ``` >>> ruff check altair/vegalite/v?/schema --fix --exit-zero Found 13006 errors (13006 fixed, 0 remaining). >>> ruff format altair/vegalite/v?/schema 4 files reformatted >>> ruff check altair/vegalite/v?/schema --statistics ```
Configuration menu - View commit details
-
Copy full SHA for 2a06b2e - Browse repository at this point
Copy the full SHA 2a06b2eView commit details -
refactor(typing): Improve annotations and narrowing in
schemapi
- Changes are mainly on `_FromDict.from_dict` - Avoids type errors due to multiple reassignments - Adds a range of overloads that preserve the `SchemaBase` subclass - Not possible in all cases - replacing `cls` with `tp` - when used in an instance method - The former is quite strange to see outside of a `@classmethod` - Especially in a class that has a `@classmethod` - updated `_default_wrapper_classes` to match `_subclasses` return type in `generate_schema_wrapper`
Configuration menu - View commit details
-
Copy full SHA for 337d844 - Browse repository at this point
Copy the full SHA 337d844View commit details -
build: run
generate-schema-wrapper
The cumulative effect of `FA100`, `UP`, `TCH` rules applied to `v5.schema`. All tests pass!
Configuration menu - View commit details
-
Copy full SHA for 76bc00b - Browse repository at this point
Copy the full SHA 76bc00bView commit details
Commits on Jun 10, 2024
-
revert(typing): Roll back runtime evaluated types not possible on old…
…er python `from __future__ import annotations` applies in annotation scope, but not in aliases. Until `altair` requires `python>=3.9-10`, some syntax will need to differ - like many of the changes seen in this commit. # Note The current `ruff` config will only upgrade syntax in annotation scope, until `tool.ruff.target-version` "unlocks" new features. These were changes I made manually, not having tested against all versions - which are being reverted.
Configuration menu - View commit details
-
Copy full SHA for ece2e85 - Browse repository at this point
Copy the full SHA ece2e85View commit details -
fix(typing): Adds overloads and reduce ignore comments relating to `s…
…pec_to_mimebundle` The repetition in `utils.save` is unfortunate, but is required to satisfy mypy. The issues are from overloading `spec_to_mimebundle` with `tuple/dict` as each has different indexing constraints. A longer term solution would be to adding an intermediate function to return the nested value. Due to `spec_to_mimebundle`'s use elsewhere operating directly on the full output.
Configuration menu - View commit details
-
Copy full SHA for 62f5eeb - Browse repository at this point
Copy the full SHA 62f5eebView commit details -
Configuration menu - View commit details
-
Copy full SHA for eb5b30d - Browse repository at this point
Copy the full SHA eb5b30dView commit details -
fix(typing): Use
...
forDataTransformerType
Original `pass` keyword was equivalent to a `None` return
Configuration menu - View commit details
-
Copy full SHA for d8a36e6 - Browse repository at this point
Copy the full SHA d8a36e6View commit details -
docs(typing):
FA100
onalt.vegalite.v5.api
and manual annotation ……rewrites ### `api` A unique, but significant, difference to the other commits is the large number of module prefixed annotations that can be shortened. `TopLevelMixin.project` shows the greatest reduction in combined characters for annotations, but there are small improvements throughout. I've made all of these `TYPE_CHECKING`-only imports explicit, to highlight a new path forward this opens up. There are many repeat/similar `Union` types, which can now be declared in another module - without concern for circular import issues. ### `v5.__init__` These changes have also removed the need for both the import of `expr` in `api`, and the `# type: ignore[no-redef]` in `v5.__init__`.
Configuration menu - View commit details
-
Copy full SHA for ea5a3d4 - Browse repository at this point
Copy the full SHA ea5a3d4View commit details -
Configuration menu - View commit details
-
Copy full SHA for 70e8e95 - Browse repository at this point
Copy the full SHA 70e8e95View commit details -
test: add ignores for
PT011
on existing testsProbably useful to enforce on new code, https://docs.astral.sh/ruff/rules/pytest-raises-too-broad/
Configuration menu - View commit details
-
Copy full SHA for 8bbb78e - Browse repository at this point
Copy the full SHA 8bbb78eView commit details -
Configuration menu - View commit details
-
Copy full SHA for cd56353 - Browse repository at this point
Copy the full SHA cd56353View commit details -
Configuration menu - View commit details
-
Copy full SHA for 27aab26 - Browse repository at this point
Copy the full SHA 27aab26View commit details -
test: add ignore for
PT012
violationNot sure how this could be rewritten. https://docs.astral.sh/ruff/rules/pytest-raises-with-multiple-statements/
Configuration menu - View commit details
-
Copy full SHA for a820ed1 - Browse repository at this point
Copy the full SHA a820ed1View commit details -
test: add
pytest.mark.xfail
for flaky `scatter_with_layered_histogr……am` test Struggling to find the source of the failure, the `mark` is my best guess but currently can't reproduce the following error: ``` ___________________________________________ test_compound_chart_examples[False-scatter_with_layered_histogram.py-all_rows18-all_cols18] ___________________________________________ [gw2] win32 -- Python 3.8.19 C:\Users\*\AppData\Local\hatch\env\virtual\altair\CXM7NV9I\hatch-test.py3.8\Scripts\python.exe filename = 'scatter_with_layered_histogram.py', all_rows = [2, 17], all_cols = [['gender'], ['__count']], to_reconstruct = False @pytest.mark.skipif(vf is None, reason="vegafusion not installed") # fmt: off @pytest.mark.parametrize("filename,all_rows,all_cols", [ ("errorbars_with_std.py", [10, 10], [["upper_yield"], ["extent_yield"]]), ("candlestick_chart.py", [44, 44], [["low"], ["close"]]), ("co2_concentration.py", [713, 7, 7], [["first_date"], ["scaled_date"], ["end"]]), ("falkensee.py", [2, 38, 38], [["event"], ["population"], ["population"]]), ("heat_lane.py", [10, 10], [["bin_count_start"], ["y2"]]), ("histogram_responsive.py", [20, 20], [["__count"], ["__count"]]), ("histogram_with_a_global_mean_overlay.py", [9, 1], [["__count"], ["mean_IMDB_Rating"]]), ("horizon_graph.py", [20, 20], [["x"], ["ny"]]), ("interactive_cross_highlight.py", [64, 64, 13], [["__count"], ["__count"], ["Major_Genre"]]), ("interval_selection.py", [123, 123], [["price_start"], ["date"]]), ("layered_chart_with_dual_axis.py", [12, 12], [["month_date"], ["average_precipitation"]]), ("layered_heatmap_text.py", [9, 9], [["Cylinders"], ["mean_horsepower"]]), ("multiline_highlight.py", [560, 560], [["price"], ["date"]]), ("multiline_tooltip.py", [300, 300, 300, 0, 300], [["x"], ["y"], ["y"], ["x"], ["x"]]), ("pie_chart_with_labels.py", [6, 6], [["category"], ["value"]]), ("radial_chart.py", [6, 6], [["values"], ["values_start"]]), ("scatter_linked_table.py", [392, 14, 14, 14], [["Year"], ["Year"], ["Year"], ["Year"]]), ("scatter_marginal_hist.py", [34, 150, 27], [["__count"], ["species"], ["__count"]]), ("scatter_with_layered_histogram.py", [2, 17], [["gender"], ["__count"]]), ("scatter_with_minimap.py", [1461, 1461], [["date"], ["date"]]), ("scatter_with_rolling_mean.py", [1461, 1461], [["date"], ["rolling_mean"]]), ("seattle_weather_interactive.py", [1461, 5], [["date"], ["__count"]]), ("select_detail.py", [20, 1000], [["id"], ["x"]]), ("simple_scatter_with_errorbars.py", [5, 5], [["x"], ["upper_ymin"]]), ("stacked_bar_chart_with_text.py", [60, 60], [["site"], ["site"]]), ("us_employment.py", [120, 1, 2], [["month"], ["president"], ["president"]]), ("us_population_pyramid_over_time.py", [19, 38, 19], [["gender"], ["year"], ["gender"]]), ]) # fmt: on @pytest.mark.parametrize("to_reconstruct", [True, False]) def test_compound_chart_examples(filename, all_rows, all_cols, to_reconstruct): source = pkgutil.get_data(examples_methods_syntax.__name__, filename) chart = eval_block(source) if to_reconstruct: # When reconstructing a Chart, Altair uses different classes # then what might have been originally used. See # vega/vegafusion#354 for more info. chart = alt.Chart.from_dict(chart.to_dict()) dfs = chart.transformed_data() if not to_reconstruct: # Only run assert statements if the chart is not reconstructed. Reason # is that for some charts, the original chart contained duplicated datasets # which disappear when reconstructing the chart. assert len(dfs) == len(all_rows) for df, rows, cols in zip(dfs, all_rows, all_cols): > assert len(df) == rows E assert 19 == 17 E + where 19 = len( bin_step_5_age bin_step_5_age_end gender __count\n0 45.0 50.0 M 247\n1 ... 11\n17 30.0 35.0 F 5\n18 70.0 75.0 F 1) tests\test_transformed_data.py:132: AssertionError ```
Configuration menu - View commit details
-
Copy full SHA for 4b38b87 - Browse repository at this point
Copy the full SHA 4b38b87View commit details -
ci: tidy up
ruff
section ofpyproject.toml
- removed `SIM` rules from `extend-safe-fixes`, only 1 required it and manual fixes should be fine for new code - Provided links for new config groups/settings vega#3431 (comment)
Configuration menu - View commit details
-
Copy full SHA for 25ce09b - Browse repository at this point
Copy the full SHA 25ce09bView commit details -
perf: adds config
pyproject.toml
for faster build, test runs- `pip` -> `uv` - `pytest` single-core -> logical max https://hatch.pypa.io/latest/how-to/environment/select-installer/#enabling-uv https://pytest-xdist.readthedocs.io/en/latest/distribution.html#running-tests-across-multiple-cpus Should speed up CI, although GitHub Actions only runs on 4 cores iirc
Configuration menu - View commit details
-
Copy full SHA for fd20f00 - Browse repository at this point
Copy the full SHA fd20f00View commit details -
Configuration menu - View commit details
-
Copy full SHA for ad9e70c - Browse repository at this point
Copy the full SHA ad9e70cView commit details -
ci: adds newer-style
hatch
test configI've attempted to recreate the existing `test` scripts, but haven't quite worked out the `coverage` parts. This provides: matrix python version testing, parallel tests (within a python version), and slightly shorter commands: ```bash >>> hatch run test >>> hatch test >>> hatch run test-coverage >>> hatch test --cover ```
Configuration menu - View commit details
-
Copy full SHA for 8308b6e - Browse repository at this point
Copy the full SHA 8308b6eView commit details -
feat(typing): Use
TYPE_CHECKING
block forschema
modules- Removes the need for `_Parameter` protocol - Reduce lines of code by more than 5000, by removing prefix for `SchemaBase`, `Parameter`
Configuration menu - View commit details
-
Copy full SHA for 36da1c7 - Browse repository at this point
Copy the full SHA 36da1c7View commit details
Commits on Jun 11, 2024
-
test: use a more reliable
xfail
condition for flaky testThe difficulty in reproducing came from the python debugger disabling `xdist`.
Configuration menu - View commit details
-
Copy full SHA for 538b527 - Browse repository at this point
Copy the full SHA 538b527View commit details -
build: Embed extra
ruff
calls ingenerate-schema-wrapper
into the…… python script Hopefully solves: https://github.com/vega/altair/actions/runs/9456437889/job/26048327764?pr=3431
Configuration menu - View commit details
-
Copy full SHA for 9582971 - Browse repository at this point
Copy the full SHA 9582971View commit details -
build: Manually rewrite certain exceptions with flaky autofix
These were previously fixed by `EM` rules, but seem to not always occur - leading to CI fail https://github.com/vega/altair/actions/runs/9466550650/job/26078482982#step:8:60
Configuration menu - View commit details
-
Copy full SHA for 33056a2 - Browse repository at this point
Copy the full SHA 33056a2View commit details -
Configuration menu - View commit details
-
Copy full SHA for 5244100 - Browse repository at this point
Copy the full SHA 5244100View commit details -
Configuration menu - View commit details
-
Copy full SHA for 4dba0a6 - Browse repository at this point
Copy the full SHA 4dba0a6View commit details -
Configuration menu - View commit details
-
Copy full SHA for 03c217c - Browse repository at this point
Copy the full SHA 03c217cView commit details -
feat(typing): Adds dedicated
Optional
alias for `Union[..., Undefin……edType]` `typing.Optional` is deprecated and is no longer needed in `altair`. The new alias improves the readability of generated signatures, by reducing noise (repeating `UndefinedType`) and clearly grouping together the options for an argument.
Configuration menu - View commit details
-
Copy full SHA for fbc02e2 - Browse repository at this point
Copy the full SHA fbc02e2View commit details
Commits on Jun 12, 2024
-
Configuration menu - View commit details
-
Copy full SHA for f8aa86f - Browse repository at this point
Copy the full SHA f8aa86fView commit details -
Configuration menu - View commit details
-
Copy full SHA for 046faa8 - Browse repository at this point
Copy the full SHA 046faa8View commit details -
refactor(typing): Remove annotation scope
UndefinedType
dependency ……in `api` Aligns `api` with `schema` changes in fbc02e2
Configuration menu - View commit details
-
Copy full SHA for 05ae13f - Browse repository at this point
Copy the full SHA 05ae13fView commit details -
Configuration menu - View commit details
-
Copy full SHA for 30ff371 - Browse repository at this point
Copy the full SHA 30ff371View commit details -
refactor: define non-relevant attributes closer to imports in `update…
…_init_file` Will make it easier to keep the two in sync, and now they can be copy/pasted - rather than adding an `or attr is _` expression
Configuration menu - View commit details
-
Copy full SHA for dc98ae1 - Browse repository at this point
Copy the full SHA dc98ae1View commit details -
feat(typing): Adds
_TypeAliasTracer
and reorders `generate_schema_w……rapper` to collect unique `Literal` types The next commit will show the changes from build
Configuration menu - View commit details
-
Copy full SHA for f82adbd - Browse repository at this point
Copy the full SHA f82adbdView commit details -
build: run
generate-schema-wrapper
using_TypeAliasTracer
This commit reduces the length of each module in `schema` by ~50-70% and provides the each alias in the new `_typing` module. ## Existing art [`pandas`](https://github.com/pandas-dev/pandas/blob/main/pandas/core/frame.py#L199) and [`polars`](https://github.com/pola-rs/polars/blob/faf0f061eead985a8b29e4584b619fb5d8647e31/py-polars/polars/dataframe/frame.py#L105) similarly define a large number of `TypeAlias`, `Union`, `Literal` types in a single file. These definitions can be imported anywhere in the project - without concern for circular dependencies. It helps keep signatures consistent, and in many cases, simplifies those signatures such that the user can quickly understand what they represent. ## Future config The generated names are currently: ```py f"{SchemaInfo.title}_T" ``` so as to not conflict with the names defined in `core`/`channels`. I have left this configurable via: ```py _TypeAliasTracer(fmt=...) ``` Personally don't mind what the aliases are called, so if anyone has any ideas please feel free to change.
Configuration menu - View commit details
-
Copy full SHA for a7b0ab5 - Browse repository at this point
Copy the full SHA a7b0ab5View commit details -
Configuration menu - View commit details
-
Copy full SHA for 4593796 - Browse repository at this point
Copy the full SHA 4593796View commit details
Commits on Jun 13, 2024
-
test: add
pytest.mark.filterwarnings
for tests that cannot avoid them- `pandas` warnings cannot trivially be avoided, as they need to be compatible with `pandas~=0.25` and are used in examples. - I have been unable to track down what specific calls are triggering the `traitlets` warnings. There seems to be multiple levels of indirection, but the stacklevel reported is external to `altair`.
Configuration menu - View commit details
-
Copy full SHA for 3e07902 - Browse repository at this point
Copy the full SHA 3e07902View commit details -
refactor(typing): Replace
Literal[None]
->None
Came across [Literal[None] conversion](https://typing.readthedocs.io/en/latest/spec/literal.html#legal-parameters-for-literal-at-type-check-time) during vega#3426 (comment)
Configuration menu - View commit details
-
Copy full SHA for 7cf20c0 - Browse repository at this point
Copy the full SHA 7cf20c0View commit details -
test: Change
skipif
->xfail
for `test_sanitize_pyarrow_table_col……umns` on `win32` Seems to be a better fit, considering this would fail for `win32` devs not using `pyarrow` but have it installed. This could be removed in the future if installing/confirming install `tzdata` to the correct location was handled during environment activation. Possibly resolves: vega#3431 (comment)
Configuration menu - View commit details
-
Copy full SHA for 65e3279 - Browse repository at this point
Copy the full SHA 65e3279View commit details
Commits on Jun 14, 2024
-
ci: bump
actions/setup-python
,python-version
, useuv
in `lint.……yml` I've made quite a few improvements to performance locally like fd20f00, but only `docbuild.yml` uses `hatch` so they haven't reduced CI run time. This is more of a test run on the simplest workflow to identify any issues.
Configuration menu - View commit details
-
Copy full SHA for 60b40a5 - Browse repository at this point
Copy the full SHA 60b40a5View commit details -
Configuration menu - View commit details
-
Copy full SHA for ce7c95b - Browse repository at this point
Copy the full SHA ce7c95bView commit details -
Configuration menu - View commit details
-
Copy full SHA for 50cd1e3 - Browse repository at this point
Copy the full SHA 50cd1e3View commit details -
Configuration menu - View commit details
-
Copy full SHA for 330f638 - Browse repository at this point
Copy the full SHA 330f638View commit details -
ci: testing
pytest-xdist
inbuild
workflowWould be faster if using `uv`/`hatch` instead of `pip` - but I'm not sure how to untangle `pip` from this yet.
Configuration menu - View commit details
-
Copy full SHA for 237079f - Browse repository at this point
Copy the full SHA 237079fView commit details -
Configuration menu - View commit details
-
Copy full SHA for 3ec3e6a - Browse repository at this point
Copy the full SHA 3ec3e6aView commit details
Commits on Jun 15, 2024
-
refactor, perf: reduce
sys.path
usage, use dictcomp in `update_init……_file` # `sys.path` Mainly modules in `tools`, but also `tests`, `sphinxext` repeat the same pattern of manipulating `sys.path` to find imports. In some cases, I think this wasn't need at all - but others were resolves by adding `tools.__init__.py`. - Aligns with many of the other sub/packages - Removes need for ignoring `E402` - Makes many of the imports in these modules explicit, and therefore easier to follow. # `update_init_file` While rewriting the imports here, I saw an opportunity to simplify gathering relevant attributes. - `attr = getattr(alt, attr_name)` using the keys of `__dict__`, was a slow equivalent of a dictionary comprehension. - `str(Path(alt.__file__).parent)` is a verbose `str(Path.cwd())` - An earlier commit of mine used this instead of `os.path` - This version is much shorter and obvious in what it does
Configuration menu - View commit details
-
Copy full SHA for 0da50cc - Browse repository at this point
Copy the full SHA 0da50ccView commit details -
build: adding debug message to help with build failure
The previous run worked locally due to `hatch` managing `sys.path` - but not in CI, which doesn't use hatch yet https://github.com/vega/altair/actions/runs/9527747043/job/26264700374
Configuration menu - View commit details
-
Copy full SHA for 686a84b - Browse repository at this point
Copy the full SHA 686a84bView commit details -
Configuration menu - View commit details
-
Copy full SHA for 5da0207 - Browse repository at this point
Copy the full SHA 5da0207View commit details -
Configuration menu - View commit details
-
Copy full SHA for eede0f4 - Browse repository at this point
Copy the full SHA eede0f4View commit details -
Configuration menu - View commit details
-
Copy full SHA for 89ab1f3 - Browse repository at this point
Copy the full SHA 89ab1f3View commit details -
Configuration menu - View commit details
-
Copy full SHA for 87a686c - Browse repository at this point
Copy the full SHA 87a686cView commit details -
Merge branch 'update-ruff-rules' of https://github.com/dangotbanned/a…
…ltair into update-ruff-rules
Configuration menu - View commit details
-
Copy full SHA for 2122dd2 - Browse repository at this point
Copy the full SHA 2122dd2View commit details
Commits on Jun 19, 2024
-
Configuration menu - View commit details
-
Copy full SHA for 580c9f6 - Browse repository at this point
Copy the full SHA 580c9f6View commit details -
Configuration menu - View commit details
-
Copy full SHA for d0c01eb - Browse repository at this point
Copy the full SHA d0c01ebView commit details
Commits on Jun 21, 2024
-
Configuration menu - View commit details
-
Copy full SHA for ca961c0 - Browse repository at this point
Copy the full SHA ca961c0View commit details -
Intended to discard the changes, but accidentally pushed
Configuration menu - View commit details
-
Copy full SHA for 26df622 - Browse repository at this point
Copy the full SHA 26df622View commit details
Commits on Jun 27, 2024
-
Configuration menu - View commit details
-
Copy full SHA for bb32cd3 - Browse repository at this point
Copy the full SHA bb32cd3View commit details -
Configuration menu - View commit details
-
Copy full SHA for 89e1029 - Browse repository at this point
Copy the full SHA 89e1029View commit details