Skip to content
Closed
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
12 changes: 12 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,18 @@ jobs:
- name: Run tests with coverage
run: uv run --all-extras pytest --cov=centimators --cov-report=term

# The lockfile tracks latest narwhals; the declared floor is much older and
# narwhals 1.x exposes typing aliases as runtime strings, which annotations
# can trip on at import time. Smoke-test imports at the floor so a green
# lockfile can't hide a broken install for downstream pins.
test-narwhals-floor:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: astral-sh/setup-uv@v4
- name: Import smoke test on minimum supported narwhals
run: uv run --all-extras --with "narwhals==1.39.0" pytest tests/test_imports.py

lint:
runs-on: ubuntu-latest
steps:
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "centimators"
version = "0.3.4"
version = "0.3.5"
description = "essential data transformers and model estimators for ML and data science competitions"
readme = "README.md"
authors = [
Expand Down
2 changes: 2 additions & 0 deletions src/centimators/feature_transformers/neutralization.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
"""Neutralization transformers for reducing feature exposure."""

from __future__ import annotations

import warnings

import narwhals as nw
Expand Down
2 changes: 2 additions & 0 deletions src/centimators/feature_transformers/penalization.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
"""Feature penalization transformers using iterative optimization (requires JAX)."""

from __future__ import annotations

import warnings

import narwhals as nw
Expand Down
29 changes: 29 additions & 0 deletions tests/test_imports.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
"""Import smoke tests.

Every module must import cleanly (or fail only with ImportError for optional
dependencies) on every supported narwhals version. Regression guard for the
narwhals 1.x incident where ``IntoSeries | None`` in a runtime-evaluated
signature raised TypeError at import time: narwhals 1.x exposes
``narwhals.typing`` aliases as plain strings at runtime, so any module using
them in annotations must carry ``from __future__ import annotations``.
"""

import importlib
import pkgutil

import centimators


def test_top_level_import():
assert hasattr(centimators, "RankTransformer")


def test_all_modules_import():
prefix = centimators.__name__ + "."
for mod_info in pkgutil.walk_packages(centimators.__path__, prefix):
try:
importlib.import_module(mod_info.name)
except ImportError:
# Optional dependencies (jax, dspy, keras, umap) may be absent;
# anything else (e.g. TypeError from annotation evaluation) fails.
continue
2 changes: 1 addition & 1 deletion uv.lock

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

Loading