Skip to content

feat: added python 3.14 support#30

Open
mplemay wants to merge 9 commits intopiercefreeman:mainfrom
mplemay:upgrade
Open

feat: added python 3.14 support#30
mplemay wants to merge 9 commits intopiercefreeman:mainfrom
mplemay:upgrade

Conversation

@mplemay
Copy link
Copy Markdown

@mplemay mplemay commented Mar 31, 2026

  • build: updated the python and rust dependencies
  • build: set the python abi version
  • build: updated the rust edition to 2024
  • build: pinned the local python version to the minimum supported version
  • build: improved the python version range
  • fix: update pyo3 bindings and python harness
  • refactor: moved python source into the src directory

Copy link
Copy Markdown
Owner

@piercefreeman piercefreeman left a comment

Choose a reason for hiding this comment

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

I'm noticing a lot more robustness was added here to the python path handling / generation... was this motivated by some wild cases that weren't covered in the previous code? Would want more test coverage that helps justify the additional complexity by reproducing the underlying bugs.

"""

from typing import TypedDict
from typing import Optional, TypedDict
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

nit: prefer | None for Optional types, unless targeting python versions that didn't yet have the pipe operator.

Copy link
Copy Markdown
Author

@mplemay mplemay Mar 31, 2026

Choose a reason for hiding this comment

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

Changed this. We now target Python 3.10+ for the abi.

// If PYTHONPATH doesn't exist, create it with just the temp dir
env::set_var("PYTHONPATH", &container_path);
}
crate::python::add_python_path(PathBuf::from(&container_path));
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

What was the motivation for this refactor? Easier testability?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Main reason was to stop relying on a process-wide PYTHONPATH change in tests. The temp module path now stays scoped to the test, but child Python processes still get that path when they start.

Ok(child)
}

fn build_pythonpath(project_name: &str, project_path: &str) -> Result<OsString> {
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

What class of issues does this address that weren't covered by the previous implementation? Can we add test cases for them?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

This covers two real cases. First, the test harness creates temp modules outside the environment project root, and child imports fail without that extra path. Second, Python gives Rust the package directory, so child imports also need the package parent path. I added direct Rust and Python tests for both cases.

@mplemay mplemay requested a review from piercefreeman March 31, 2026 21:36
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