Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
3 changes: 2 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13", "3.14"]
required-dependencies: ["minimum", "latest"]

name: py ${{ matrix.python-version }} with ${{ matrix.required-dependencies }} required deps
steps:
- uses: actions/checkout@v5
Expand Down
9 changes: 5 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ all = [
dev = [
"hatch>=1.13.0",
"ruff>=0.9.5",
"duckdb>=1.0",
"duckdb>=1.0; python_version<\"3.14\"",
"ipython",
"ipykernel",
"pandas>=1.1.3",
Expand All @@ -82,7 +82,7 @@ dev = [
"pandas-stubs",
"types-jsonschema",
"types-setuptools",
"geopandas",
"geopandas>=0.14.3; python_version<\"3.14\"",
"polars>=0.20.3",
"taskipy>=1.14.1",
"tomli>=2.2.1",
Expand Down Expand Up @@ -127,7 +127,7 @@ doc = { features = ["all", "dev", "doc"] }
[tool.hatch.envs.hatch-test]
# https://hatch.pypa.io/latest/tutorials/testing/overview/
features = ["all", "dev", "doc"]
matrix = [{ python = ["3.9", "3.10", "3.11", "3.12", "3.13"] }]
matrix = [{ python = ["3.9", "3.10", "3.11", "3.12", "3.13", "3.14"] }]

[tool.ruff]
extend-exclude = [
Expand Down Expand Up @@ -319,7 +319,8 @@ addopts = [
markers = [
"slow: Label tests as slow (deselect with '-m \"not slow\"')",
"datasets_debug: Disabled by default due to high number of requests",
"no_xdist: Unsafe to run in parallel"
"no_xdist: Unsafe to run in parallel",
"geospatial: Tests that require geopandas (deselect with '-m \"not geospatial\"')"
]

[tool.mypy]
Expand Down
24 changes: 24 additions & 0 deletions tests/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,30 @@ def windows_has_tzdata() -> bool:
find_spec("scipy") is None, reason="`scipy` not installed."
)

skip_requires_geopandas: pytest.MarkDecorator = pytest.mark.skipif(
find_spec("geopandas") is None, reason="`geopandas` not installed."
)
"""
``pytest.mark.skipif`` decorator.

Applies when `geopandas`_ import would fail.

.. _geopandas:
https://geopandas.org/
"""

skip_requires_duckdb: pytest.MarkDecorator = pytest.mark.skipif(
find_spec("duckdb") is None, reason="`duckdb` not installed."
)
"""
``pytest.mark.skipif`` decorator.

Applies when `duckdb`_ import would fail.

.. _duckdb:
https://duckdb.org/
"""


@overload
def skip_requires_pyarrow(
Expand Down
4 changes: 3 additions & 1 deletion tests/test_datasets.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
from altair.datasets import Loader
from altair.datasets._exceptions import AltairDatasetsError
from altair.datasets._typing import Dataset, Metadata
from tests import no_xdist, skip_requires_pyarrow
from tests import no_xdist, skip_requires_geopandas, skip_requires_pyarrow

if TYPE_CHECKING:
from collections.abc import Mapping
Expand Down Expand Up @@ -548,6 +548,8 @@ def test_pyarrow_read_json(

@datasets_spatial
@backends_no_polars
@pytest.mark.geospatial
@skip_requires_geopandas
def test_spatial(backend: _Backend, name: Dataset) -> None:
load = Loader.from_backend(backend)

Expand Down
16 changes: 14 additions & 2 deletions tests/vegalite/v6/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
from importlib.util import find_spec
from typing import TYPE_CHECKING

import duckdb
import jsonschema
import narwhals.stable.v1 as nw
import pandas as pd
Expand All @@ -28,11 +27,18 @@
import altair as alt
from altair.utils.core import use_signature
from altair.utils.schemapi import Optional, SchemaValidationError, Undefined
from tests import skip_requires_pyarrow, skip_requires_vl_convert, slow
from tests import (
skip_requires_duckdb,
skip_requires_pyarrow,
skip_requires_vl_convert,
slow,
)

if TYPE_CHECKING:
from typing import Any

import duckdb

from altair.vegalite.v6.api import _Conditional, _Conditions
from altair.vegalite.v6.schema._typing import Map

Expand Down Expand Up @@ -1824,9 +1830,12 @@ def test_polars_date_32():


@skip_requires_pyarrow(requires_tzdata=True)
@skip_requires_duckdb
def test_interchange_with_date_32():
# Test that objects which Narwhals only supports at the interchange
# level can be plotted when they contain date32 columns.
import duckdb

df = pl.DataFrame( # noqa: F841
{"a": [1, 2, 3], "b": [date(2020, 1, 1), date(2020, 1, 2), date(2020, 1, 3)]}
)
Expand All @@ -1840,13 +1849,16 @@ def test_interchange_with_date_32():


@skip_requires_pyarrow(requires_tzdata=True)
@skip_requires_duckdb
def test_interchange_with_vegafusion(monkeypatch: pytest.MonkeyPatch):
# Test that objects which Narwhals only supports at the interchange
# level don't get converted to PyArrow unnecessarily when plotted
# with the vegafusion transformer.
# TODO: this test can be drastically simplified when some level of
# DuckDB support in VegaFusion, as it can then just be `alt.Chart(rel_df)`
# without DuckDBWithInterchangeSupport.
import duckdb

df = pl.DataFrame( # noqa: F841
{
"a": [1, 2, 3],
Expand Down
Loading