Skip to content

Modernize package and move to Python 3.14 - #56

Merged
fsargent merged 1 commit into
mainfrom
codex/uv
Jul 17, 2026
Merged

Modernize package and move to Python 3.14#56
fsargent merged 1 commit into
mainfrom
codex/uv

Conversation

@fsargent

@fsargent fsargent commented Jul 14, 2026

Copy link
Copy Markdown
Member

Summary

  • reorganize the legacy modules into an installable src/vse_sim package
  • move scripts, tests, documentation assets, experiments, analysis, and retained artifacts into explicit directories
  • move the supported runtime and CI environment to Python 3.14
  • refresh the UV lockfile and adopt NumPy 2.5, SciPy 1.18, and pytest 9
  • preserve Python-native scalar results across NumPy 2 representation changes

Why

The repository previously mixed production modules, scripts, tests, and historical artifacts at its root and targeted Python 3.10–3.12. This modernizes the package layout and establishes one current Python 3.14 development and CI environment with a reproducible UV lockfile.

Impact

Development now uses Python 3.14 and uv sync --locked. Imports use the installed vse_sim package. NumPy 2 is now supported while method results and voter utilities exposed by the package retain Python scalar conventions.

Validation

  • uv run python -m pytest — 43 passed on Python 3.14.6
  • trunk check — no issues
  • git diff --check

Summary by Sourcery

Modernize the project into an installable vse_sim package, standardize the repository layout, and move the supported runtime and tooling to Python 3.14 with updated scientific Python dependencies.

New Features:

  • Introduce an installable src/vse_sim package that exposes the core simulation, methods, strategies, diagnostics, and decorators as a cohesive API.
  • Add structured directories for scripts, tests, artifacts, experiments, and ancillary analysis code with clear separation from production modules.

Bug Fixes:

  • Ensure voter utilities, social utility calculations, and method result sequences return Python-native scalars despite NumPy 2 representation changes, preserving existing result conventions.
  • Adjust doctests to assert on boolean expressions explicitly to remain compatible with updated NumPy and pytest behavior.

Enhancements:

  • Update documentation and examples to use the vse_sim package imports, module-based script execution, and the new repository layout.
  • Refresh dependency versions to support NumPy 2.x, newer SciPy, and pytest 9 while tightening pytest test discovery to the package and tests directories.
  • Pin CI GitHub Action versions and align local tooling configs with the new Python 3.14 runtime.

Build:

  • Configure setuptools-based packaging for vse-sim and package discovery under src in pyproject.toml.
  • Update Python version constraints and dependency bounds in pyproject.toml to target Python 3.14 and newer NumPy/SciPy releases.

CI:

  • Switch the GitHub Actions workflow to Python 3.14, pin action revisions, and keep uv-based installation with a locked dependency set.
  • Remove the dedicated Python runtime from Trunk configuration to defer to the project-level Python tooling.

Deployment:

  • Align mise Python version and documentation instructions with the new Python 3.14 development and CI environment.

Documentation:

  • Revise README.md and AGENTS.md to describe the installable package layout, new import paths, Python 3.14 support, and updated script invocation patterns.
  • Document the roles of the artifacts, analysis, and experiments directories and clarify that retained outputs and exploratory code are outside the supported package API.

Tests:

  • Move tests into a dedicated tests/ package, update imports to use vse_sim and script modules, and narrow pytest discovery to the package and tests directories.
  • Remove obsolete top-level test modules that are no longer relevant under the new package layout.

Chores:

  • Clean up legacy root-level modules and project metadata now superseded by the src/vse_sim package and new directory structure.

@coderabbitai

coderabbitai Bot commented Jul 14, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@fsargent, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 39 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 21c8e9c2-0e30-4b8f-955f-b10120a27442

📥 Commits

Reviewing files that changed from the base of the PR and between 4820ee4 and f77a30f.

⛔ Files ignored due to path filters (5)
  • artifacts/ksMoreResults3.csv.zip is excluded by !**/*.zip
  • artifacts/ksresults3.csv.zip is excluded by !**/*.zip
  • docs/assets/brochures/brochureVSE.svg is excluded by !**/*.svg
  • docs/assets/brochures/vseBrochure.svg is excluded by !**/*.svg
  • uv.lock is excluded by !**/*.lock
📒 Files selected for processing (28)
  • .github/workflows/python-app.yml
  • .project
  • .trunk/trunk.yaml
  • AGENTS.md
  • README.md
  • analysis/README.md
  • analysis/vse_check.R
  • artifacts/README.md
  • artifacts/newResults.txt
  • artifacts/tenK.txt
  • experiments/README.md
  • experiments/soda.py
  • mise.toml
  • pyproject.toml
  • scripts/__init__.py
  • scripts/recalculate_irv_pages.py
  • scripts/regenerate_pages_images.py
  • src/vse_sim/__init__.py
  • src/vse_sim/core.py
  • src/vse_sim/decorators.py
  • src/vse_sim/diagnostics.py
  • src/vse_sim/methods.py
  • src/vse_sim/simulation.py
  • src/vse_sim/strategies.py
  • src/vse_sim/voter_models.py
  • test/test_binop.py
  • tests.py
  • tests/test_regressions.py
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/uv

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.

@sourcery-ai

sourcery-ai Bot commented Jul 14, 2026

Copy link
Copy Markdown

Reviewer's Guide

Modernizes the project into an installable src-based vse_sim package targeting Python 3.14, updates scientific and tooling dependencies and CI, and normalizes NumPy 2 outputs to preserve prior Python-scalar result conventions across the simulation code, scripts, and tests.

File-Level Changes

Change Details Files
Reorganize legacy flat modules into an installable src/vse_sim package and clarify repository layout.
  • Move core simulation modules (vse.py, methods.py, dataClasses.py, voterModels.py, stratFunctions.py, mydecorators.py) into src/vse_sim with renamed, namespaced equivalents (simulation.py, methods.py, core.py, voter_models.py, strategies.py, decorators.py, diagnostics.py).
  • Introduce dedicated top-level directories for scripts, tests, experiments, analysis, and historical artifacts, including package init files and README documents describing their roles.
  • Update AGENTS.md and README.md to document the new package layout, import paths, and how to run simulations and scripts via the installed vse_sim package.
src/vse_sim/simulation.py
src/vse_sim/methods.py
src/vse_sim/core.py
src/vse_sim/voter_models.py
src/vse_sim/strategies.py
src/vse_sim/decorators.py
src/vse_sim/__init__.py
scripts/__init__.py
experiments/soda.py
artifacts/README.md
analysis/README.md
experiments/README.md
AGENTS.md
README.md
Adopt Python 3.14 and refresh dependency and tooling configuration for NumPy 2 and modern CI.
  • Change project Python requirement to 3.14.x in pyproject.toml, update dev dependencies (pytest range) and configure setuptools to find packages under src/.
  • Update uv.lock (not shown in detail), mise.toml, and trunk runtime configuration to align local tooling and project runtime with Python 3.14.
  • Pin and update GitHub Actions workflow versions and switch CI to use Python 3.14 with cached uv-based dependency installation.
pyproject.toml
uv.lock
.github/workflows/python-app.yml
mise.toml
.trunk/trunk.yaml
Normalize method and voter outputs to Python-native scalars for NumPy 2 compatibility while preserving prior conventions.
  • Wrap Voter.new in voter_models to coerce per-utility values via .item() when available, ensuring tuple contents are Python scalars rather than NumPy scalars.
  • Change Voter.socUtils and selected scoreboard/method result paths (e.g., in methods.Srv and other results) to convert NumPy scalar results to Python scalars via .item().
  • Adjust doctests throughout voter_models and related code to assert boolean conditions explicitly using bool(...) to remain robust under NumPy 2 behavior.
src/vse_sim/voter_models.py
src/vse_sim/methods.py
Update scripts and tests to use the installed vse_sim package and the new structure, maintaining regression coverage.
  • Change scripts/recalculate_irv_pages.py and scripts/regenerate_pages_images.py to import vse_sim.* modules instead of manipulating sys.path and importing from flat files, and adjust documentation to reference vse_sim.simulation.
  • Move tests from test/ and tests.py into tests/ package, update pytest configuration testpaths, and rewrite imports in tests to reference vse_sim.core, vse_sim.methods, vse_sim.simulation, vse_sim.strategies, and vse_sim.voter_models.
  • Update README usage examples and script invocation patterns to call modules via uv run python -m scripts.* rather than path-based script execution.
scripts/recalculate_irv_pages.py
scripts/regenerate_pages_images.py
tests/test_regressions.py
pyproject.toml
README.md

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@fsargent
fsargent marked this pull request as ready for review July 17, 2026 22:09
@fsargent
fsargent merged commit 605e6c4 into main Jul 17, 2026
5 checks passed

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Hey - I've found 3 issues, and left some high level feedback:

  • The GitHub Actions workflow changes appear to have inlined two versions of the uses: lines (e.g., actions/checkout, actions/setup-python, astral-sh/setup-uv are duplicated on the same line), which will likely break YAML parsing—clean those up so each step has a single uses entry.
  • You now coerce NumPy scalars to Python scalars in multiple places using the same hasattr(x, "item") pattern; consider introducing a small helper (e.g., to_python_scalar) and using it consistently to avoid duplication and make future representation changes easier.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The GitHub Actions workflow changes appear to have inlined two versions of the `uses:` lines (e.g., `actions/checkout`, `actions/setup-python`, `astral-sh/setup-uv` are duplicated on the same line), which will likely break YAML parsing—clean those up so each step has a single `uses` entry.
- You now coerce NumPy scalars to Python scalars in multiple places using the same `hasattr(x, "item")` pattern; consider introducing a small helper (e.g., `to_python_scalar`) and using it consistently to avoid duplication and make future representation changes easier.

## Individual Comments

### Comment 1
<location path=".github/workflows/python-app.yml" line_range="20" />
<code_context>
-      - uses: actions/checkout@v4
-      - name: Set up Python 3.12
-        uses: actions/setup-python@v5
+      - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1      - uses: actions/checkout@v4
+      - name: Set up Python 3.14
+        uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0        uses: actions/setup-python@v5
</code_context>
<issue_to_address>
**issue (bug_risk):** The checkout step line is malformed and will break the workflow YAML.

This line combines two `uses:` declarations (`@34e... # v4.3.1` and `@v4`) on a single entry, which produces invalid YAML and stops the workflow from running. Please split this into separate steps or keep only the pinned SHA form, e.g.

```yaml
      - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
```
</issue_to_address>

### Comment 2
<location path=".github/workflows/python-app.yml" line_range="21-22" />
<code_context>
-      - name: Set up Python 3.12
-        uses: actions/setup-python@v5
+      - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1      - uses: actions/checkout@v4
+      - name: Set up Python 3.14
+        uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0        uses: actions/setup-python@v5
         with:
-          python-version: "3.12"
</code_context>
<issue_to_address>
**issue (bug_risk):** The setup-python step mixes two `uses` clauses on one line, making the YAML invalid.

This step currently has two `uses` declarations on the same line (`actions/setup-python@... # v5.6.0        uses: actions/setup-python@v5`), which is not valid for YAML or GitHub Actions. Please keep a single, pinned `uses` entry, for example:

```yaml
      - name: Set up Python 3.14
        uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
        with:
          python-version: "3.14"
```

As-is, the workflow will not load successfully.
</issue_to_address>

### Comment 3
<location path=".github/workflows/python-app.yml" line_range="26-27" />
<code_context>
-          python-version: "3.12"
+          python-version: "3.14"

       - name: Install uv
-        uses: astral-sh/setup-uv@v6
+        uses: astral-sh/setup-uv@d0cc045d04ccac9d8b7881df0226f9e82c39688e # v6.8.0        uses: astral-sh/setup-uv@v6
         with:
           enable-cache: true
</code_context>
<issue_to_address>
**issue (bug_risk):** The uv setup step also has two `uses` values merged into one line, which will break the workflow.

This step is invalid because two `uses` entries are on the same line; GitHub Actions only allows one `uses` per step. Please keep a single, pinned `uses` value, e.g.:

```yaml
      - name: Install uv
        uses: astral-sh/setup-uv@d0cc045d04ccac9d8b7881df0226f9e82c39688e # v6.8.0
        with:
          enable-cache: true
          cache-dependency-glob: "uv.lock"
```
Otherwise the workflow will fail to run.
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

- uses: actions/checkout@v4
- name: Set up Python 3.12
uses: actions/setup-python@v5
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1 - uses: actions/checkout@v4

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

issue (bug_risk): The checkout step line is malformed and will break the workflow YAML.

This line combines two uses: declarations (@34e... # v4.3.1 and @v4) on a single entry, which produces invalid YAML and stops the workflow from running. Please split this into separate steps or keep only the pinned SHA form, e.g.

      - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1

Comment on lines +21 to +22
- name: Set up Python 3.14
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0 uses: actions/setup-python@v5

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

issue (bug_risk): The setup-python step mixes two uses clauses on one line, making the YAML invalid.

This step currently has two uses declarations on the same line (actions/setup-python@... # v5.6.0 uses: actions/setup-python@v5), which is not valid for YAML or GitHub Actions. Please keep a single, pinned uses entry, for example:

      - name: Set up Python 3.14
        uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
        with:
          python-version: "3.14"

As-is, the workflow will not load successfully.

Comment on lines 26 to +27
- name: Install uv
uses: astral-sh/setup-uv@v6
uses: astral-sh/setup-uv@d0cc045d04ccac9d8b7881df0226f9e82c39688e # v6.8.0 uses: astral-sh/setup-uv@v6

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

issue (bug_risk): The uv setup step also has two uses values merged into one line, which will break the workflow.

This step is invalid because two uses entries are on the same line; GitHub Actions only allows one uses per step. Please keep a single, pinned uses value, e.g.:

      - name: Install uv
        uses: astral-sh/setup-uv@d0cc045d04ccac9d8b7881df0226f9e82c39688e # v6.8.0
        with:
          enable-cache: true
          cache-dependency-glob: "uv.lock"

Otherwise the workflow will fail to run.

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.

1 participant