Skip to content

chore: raise minimum Python version to 3.11 - #137

Merged
d33bs merged 4 commits into
mainfrom
chore/python-311-minimum
Oct 19, 2026
Merged

d33bs merged 4 commits into
mainfrom
chore/python-311-minimum

Conversation

@d33bs

@d33bs d33bs commented Oct 5, 2026 •

Copy link
Copy Markdown
Member

Summary

  • Raise the minimum supported Python version to 3.11 and update CI and the README.
  • Regenerate the uv lockfile for the supported range.
  • Refresh the Ruff hook version required by pre-commit CI.

Validation

  • Python 3.11.11: 15 tests passed.
  • Ruff check, package build, and all pre-commit hooks passed locally.

Summary by CodeRabbit

  • Compatibility
    • Python 3.10 is no longer supported; the package supports Python 3.11–3.14.

@coderabbitai

coderabbitai Bot commented Oct 5, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: b1cb3020-e1ec-4e4b-bc78-5d66dc960e71
📥 Commits

Reviewing files that changed from the base of the PR and between 39c764a and 8f36968.

📒 Files selected for processing: 2
  • .pre-commit-config.yaml
  • tests/test_metrics.py
📝 Walkthrough

The package minimum supported Python version changes to 3.11. CI and the README list Python 3.11–3.14. Ruff’s target changes to Python 3.11, three pre-commit tool revisions are updated, and four analytical EMD tests are added.

Changes: Python Support and Tooling

Layer / File(s) Summary
Align the supported Python versions
pyproject.toml, .github/workflows/ci.yml, README.md
The package minimum changes to Python 3.11. The CI matrix and README badge list Python 3.11–3.14. Ruff’s target Python version changes to 3.11.
Update pre-commit tool revisions
.pre-commit-config.yaml
The pinned revisions of pyupgrade, Ruff, and pre-commit-update are updated.

Earth Mover’s Distance Tests

Layer / File(s) Summary
Add analytical EMD cases
tests/test_metrics.py
Four parameterized cases compare computed EMD with analytical squared-distance transport costs for different sample configurations.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Other

Suggested reviewers: axiomcura

Merge Risk: ⚪ Minimal · up to 8f369

No merge-blocking issue is established; the change is ready for normal checks.

Security architecture risk: 🔵 Low · up to 39c76

The changes align package requirements, documentation, testing, and linting around Python 3.11–3.14. No application authority or deployment-control change was identified. Consumers still using Python 3.10 cannot normally install the updated package; their migration status is unknown.

Retained concerns
No architecture-level concerns identified.

Security review details

Security Blast Radius

  • inferred — The demonstrated change surface is package installation compatibility and development-tool execution. The full PR changes no application implementation or deployment declaration, and the inspected changes establish no expansion of tenant, data-store, credential, or infrastructure access.

Trust Boundaries and Controls

  • observed — CI continues to execute pre-commit before tests. The Ruff update selects a new revision from the existing upstream repository without changing the hook commands, workflow triggers, runner selection, or permissions configuration. Trust in executable upstream tooling predates this PR.
Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 66.67% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 3 functions across 1 files. (1 skipped: 1… Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly and concisely describes the main change: raising the minimum supported Python version to 3.11.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

Docstring coverage is 66.67% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 3 functions across 1 files. (1 skipped: 1 unsupported.)

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

  • Fix all pre-merge checks with AI
✨ Finishing Touches: 💡 1
📝 Generate docstrings: 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@d33bs
d33bs marked this pull request as ready for review October 5, 2026 22:46
@d33bs
d33bs requested review from gwaybio and wli51 October 5, 2026 22:46

@wli51 wli51 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Min python version bump LGTM!

I have a nitpick on the existing suite of pytests. None actually tests the specific EMD output value against a simple EMD problem that has deterministic and analytical solution.

Adding something like:

import polars as pl
import pytest

from buscar.metrics import compute_earth_movers_distance


@pytest.mark.parametrize(
    ("target", "treated", "expected"),
    [
        pytest.param(
            [[0], [1], [3]],
            [[3], [0], [1]],
            0.0,  # Squared Euclidean: 0.0
            id="1d-identical-reordered",
        ),
        pytest.param(
            [[0], [0], [2]],
            [[0], [2], [2], [2]],
            5 / 6,  # Squared Euclidean: 5 / 3
            id="1d-unequal-sample-sizes",
        ),
        pytest.param(
            [[0, 0], [0, 1], [0, 2]],
            [[3, 4], [3, 5], [3, 6]],
            5.0,  # Squared Euclidean: 25.0
            id="2d-translation",
        ),
        pytest.param(
            [[0, 0], [2, 2], [0, 0], [2, 2]],
            [[0, 2], [2, 0], [0, 2], [2, 0]],
            2.0,  # Squared Euclidean: 4.0
            id="2d-same-marginals-different-joint",
        ),
    ],
)
def test_compute_earth_movers_distance_matches_analytic_solution(
    target, treated, expected
):
    """Check EMD against analytical costs for empirical distributions."""
    features = [f"Feature_{i}" for i in range(len(target[0]))]
    schema = {feature: pl.Float64 for feature in features}

    target_df = pl.DataFrame(target, schema=schema, orient="row")
    treated_df = pl.DataFrame(treated, schema=schema, orient="row")

    actual = compute_earth_movers_distance(
        target_df,
        treated_df,
        subsample_size=max(len(target), len(treated)),
    )

    assert actual == pytest.approx(expected, rel=1e-9, abs=1e-12)

can help flag potential erratic behavior under various dependency resolution.

@d33bs

d33bs commented Oct 19, 2026

Copy link
Copy Markdown
Member Author

Thanks @wli51 ! I added in some changes based on what you suggested. Merging this in now.

@d33bs
d33bs merged commit 8e49ad0 into main Oct 19, 2026
15 checks passed
@d33bs
d33bs deleted the chore/python-311-minimum branch October 19, 2026 13:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants