Skip to content

Commit

Permalink
v2: Remove altair functionality from vegafusion package (#510)
Browse files Browse the repository at this point in the history
* Remove altair functionality from vegafusion package

* remove altair dep

* Install altair when testing
  • Loading branch information
jonmmease committed Nov 16, 2024
1 parent 3996f21 commit 11f4718
Show file tree
Hide file tree
Showing 14 changed files with 31 additions and 585 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/build_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ jobs:
python -m pip install polars-lts-cpu "duckdb>=1.0" "vl-convert-python>=1.0.1rc1" scikit-image "pandas>=2.2" jupytext voila anywidget ipywidgets chromedriver-binary-auto
# Test dependencies
python -m pip install pytest vega-datasets scikit-image jupytext voila ipykernel anywidget ipywidgets selenium flaky tenacity chromedriver-binary-auto
python -m pip install pytest altair vega-datasets scikit-image jupytext voila ipykernel anywidget ipywidgets selenium flaky tenacity chromedriver-binary-auto
- name: Test lazy imports
working-directory: python/vegafusion/
run: python checks/check_lazy_imports.py
Expand Down Expand Up @@ -347,7 +347,7 @@ jobs:
python -m pip install polars "duckdb>=1.0" vl-convert-python "pandas>=2.2"
# Test dependencies
python -m pip install pytest vega-datasets scikit-image
python -m pip install pytest altair vega-datasets scikit-image
- name: Test vegafusion
working-directory: python/vegafusion/
Expand Down Expand Up @@ -392,7 +392,7 @@ jobs:
python -m pip install pyarrow==10.0 altair==5.1.2 polars[timezone] "duckdb>=1.0" vl-convert-python
# Test dependencies
python -m pip install pytest vega-datasets scikit-image
python -m pip install pytest altair vega-datasets scikit-image
- name: Test vegafusion
working-directory: python/vegafusion/
run: pytest --ignore=tests/test_altair_mocks.py
Expand Down
50 changes: 22 additions & 28 deletions pixi.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions pixi.toml
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ ipywidgets = "8.1.0.*"
rust = "1.80.*"
vl-convert-python = "1.6.*"
anywidget = ">=0.9.6,<0.10"
polars = "1.8.*"

[target.osx-arm64.build-dependencies]
# These dependencies are for building node canvas from source on apple silicon
Expand Down
1 change: 0 additions & 1 deletion python/vegafusion/setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ packages = find:
python_requires = >=3.7
include_package_data = True
install_requires =
altair>=5.2.0
pyarrow>=5
pandas
psutil
Expand Down
34 changes: 0 additions & 34 deletions python/vegafusion/tests/test_context_manager.py

This file was deleted.

32 changes: 0 additions & 32 deletions python/vegafusion/tests/test_row_limit.py

This file was deleted.

59 changes: 0 additions & 59 deletions python/vegafusion/tests/test_save.py

This file was deleted.

10 changes: 5 additions & 5 deletions python/vegafusion/tests/test_transformed_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ def test_transformed_data_for_mock(mock_name, expected_len, expected_cols, conne
mock_path = altair_mocks_dir / mock_name / "mock.py"
mock_src = mock_path.read_text("utf8")
chart = eval_block(mock_src)
df = vf.transformed_data(chart)
df = chart.transformed_data()

# Check that a DataFrame was returned
assert isinstance(df, pd.DataFrame)
Expand Down Expand Up @@ -182,7 +182,7 @@ def test_multi_transformed_data_for_mock(mock_name, expected_lens, all_expected_
mock_path = altair_mocks_dir / mock_name / "mock.py"
mock_src = mock_path.read_text("utf8")
chart = eval_block(mock_src)
dfs = vf.transformed_data(chart)
dfs = chart.transformed_data()

for df, expected_len, expected_cols in zip(dfs, expected_lens, all_expected_cols):
# Check that a DataFrame was returned
Expand Down Expand Up @@ -211,7 +211,7 @@ def test_transformed_data_exclude():
)

chart = (bar + rule + some_annotation).properties(width=600)
datasets = vf.transformed_data(chart, exclude=["some_annotation"])
datasets = chart.transformed_data(exclude=["some_annotation"])

assert len(datasets) == 2
assert len(datasets[0]) == 52
Expand All @@ -234,7 +234,7 @@ def test_gh_286():
y='count():Q',
color='weather:N'
)
transformed = vf.transformed_data(chart)
transformed = chart.transformed_data()
assert isinstance(transformed, pl.DataFrame)
assert len(transformed) == 53

Expand All @@ -251,6 +251,6 @@ def test_categorical_columns(connection):
chart = alt.Chart(df).mark_bar().encode(
alt.X("categorical:N"), alt.Y("sum(a):Q")
)
transformed = vf.transformed_data(chart)
transformed = chart.transformed_data()
expected = pd.DataFrame({"categorical": ["A", "BB"], "sum_a": [7, 8]})
pd.testing.assert_frame_equal(transformed, expected)
Loading

0 comments on commit 11f4718

Please sign in to comment.