-
Notifications
You must be signed in to change notification settings - Fork 0
feat(moonshine): upgrade PyO3 to 0.27 for Python 3.13 compatibility #294
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
- Add .envrc for direnv auto-activation with uv sync - Add .python-version pinned to 3.12 (avoids PyO3/Py3.13 issues) - Fix duplicate .venv/ in .gitignore, add .bmad/ and .claude/ - Add justfile recipes: setup-moonshine, build-moonshine, verify-moonshine - Add verify_moonshine.rs example for isolated STT testing - Document PyO3 instability issue in docs/issues/
- Upgrade pyo3 from 0.24.1 to 0.27 - Remove auto-initialize feature, use explicit Python::initialize() - Migrate API: with_gil() → attach() per PyO3 0.27 migration guide - Resolves Python 3.13 free-threading compatibility issues Addresses: docs/issues/pyo3_instability.md 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]>
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
qodo-code-review
bot
commented
Dec 12, 2025
•
edited by qodo-free-for-open-source-projects
bot
Loading
edited by qodo-free-for-open-source-projects
bot
PR Compliance Guide 🔍Below is a summary of compliance checks for this PR:
Compliance status legend🟢 - Fully Compliant🟡 - Partial Compliant 🔴 - Not Compliant ⚪ - Requires Further Human Verification 🏷️ - Compliance label |
||||||||||||||||||||||||
PR Compliance Guide 🔍Below is a summary of compliance checks for this PR:
Compliance status legend🟢 - Fully Compliant🟡 - Partial Compliant 🔴 - Not Compliant ⚪ - Requires Further Human Verification 🏷️ - Compliance label |
|||||||||||||||||||||||||
qodo-code-review
bot
commented
Dec 12, 2025
•
edited by qodo-free-for-open-source-projects
bot
Loading
edited by qodo-free-for-open-source-projects
bot
PR Code Suggestions ✨Explore these optional code suggestions:
|
|||||||||
PR Code Suggestions ✨Explore these optional code suggestions:
|
||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR upgrades PyO3 from version 0.24.1 to 0.27 to resolve Python 3.13 compatibility issues, specifically around free-threading support. The upgrade includes migrating all GIL interaction code from the deprecated Python::with_gil() API to the new Python::attach() API, and adds development tooling to streamline Moonshine STT testing.
Key Changes:
- PyO3 upgraded to 0.27 with
auto-initializefeature for Python 3.13 compatibility - Migrated all Python GIL interactions from
with_gil()toattach()in moonshine.rs - Added development infrastructure: justfile recipes, verification example, .envrc for direnv, and comprehensive documentation
Reviewed changes
Copilot reviewed 6 out of 8 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
| crates/coldvox-stt/Cargo.toml | Updated PyO3 dependency from 0.24.1 to 0.27 with auto-initialize feature |
| Cargo.lock | Dependency lock file updates for PyO3 0.27 and transitive dependencies |
| crates/coldvox-stt/src/plugins/moonshine.rs | Migrated 4 instances of Python::with_gil() to Python::attach() |
| crates/coldvox-stt/examples/verify_moonshine.rs | New example for isolated Moonshine STT testing with synthetic audio |
| justfile | Added 3 recipes for Moonshine setup, build, and verification |
| docs/issues/pyo3_instability.md | Documented PyO3 Python 3.13 compatibility issues and migration rationale |
| .envrc | Added direnv configuration for automatic venv activation and dependency sync |
| .gitignore | Added AI agent framework directories (.bmad/, .claude/) to ignore list |
| 1. **Free-Threading (3.13t)**: Python 3.13 supports experimental free-threading. PyO3 0.24 requires `Sync` implementation for all `#[pyclass]` types to support this. | ||
| 2. **API Churn**: `Python::with_gil` is conceptually deprecated in favor of `Python::attach` in free-threaded contexts, though 0.24 still supports it. | ||
| 3. **Build Tooling**: Attempting to build against Python 3.13 with older versions (or mismatched feature flags) fails. | ||
| 4. **Current Config**: `coldvox-stt` uses `pyo3 = "0.24.1"`. |
Copilot
AI
Dec 12, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This line states "Current Config: coldvox-stt uses pyo3 = "0.24.1"" but the PR updates it to 0.27. This should be updated to reflect the new configuration, or reframed as "Previous Config" if documenting the historical issue.
| 4. **Current Config**: `coldvox-stt` uses `pyo3 = "0.24.1"`. | |
| 4. **Previous Config**: `coldvox-stt` used `pyo3 = "0.24.1"`. |
| let spec = hound::WavSpec { | ||
| channels: 1, | ||
| sample_rate, | ||
| bits_per_sample: 16, | ||
| sample_format: hound::SampleFormat::Int, | ||
| }; |
Copilot
AI
Dec 12, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The spec variable is declared but never used. Consider removing it or using it to write a WAV file for debugging purposes.
| // 5. Generate Test Audio (1s of 440Hz sine wave @ 16kHz) | ||
| println!("🎵 Generating test audio..."); | ||
| let sample_rate = 16000; | ||
| let duration_secs = 2; |
Copilot
AI
Dec 12, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The comment states "1s of 440Hz sine wave" but the code sets duration_secs = 2, which generates 2 seconds of audio, not 1 second.
| let duration_secs = 2; | |
| let duration_secs = 1; |
| source .venv/bin/activate | ||
|
|
||
| # Ensure dependencies are synced | ||
| uv sync --quiet |
Copilot
AI
Dec 12, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The comment states "Ensure dependencies are synced" but uv sync --quiet could fail silently. Consider removing the --quiet flag or adding error handling to ensure failures are visible to the developer.
| uv sync --quiet | |
| uv sync |
| mic-probe duration="30": | ||
| cd crates/app && cargo run --bin mic_probe -- --duration {{duration}} | ||
|
|
||
| # Install Moonshine Python dependencies (transformers, torch, librosa via uv) |
Copilot
AI
Dec 12, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The comment states "Install Moonshine Python dependencies (transformers, torch, librosa via uv)" but this recipe doesn't install dependencies directly - it delegates to a shell script. Consider updating to "Run Moonshine dependency installation script" or similar to better reflect what this recipe does.
| # Install Moonshine Python dependencies (transformers, torch, librosa via uv) | |
| # Run Moonshine dependency installation script (installs transformers, torch, librosa via uv) |
|
|
||
| # Moonshine STT via PyO3/HuggingFace | ||
| pyo3 = { version = "0.24.1", optional = true, features = ["auto-initialize"] } | ||
| # Moonshine STT via PyO3/HuggingFace - Fixed auto-initialize |
Copilot
AI
Dec 12, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The comment "Fixed auto-initialize" is unclear. The feature was already present in 0.24.1, so this isn't fixing it. Consider clarifying what was fixed or just stating "Updated to 0.27 with auto-initialize".
| # Moonshine STT via PyO3/HuggingFace - Fixed auto-initialize | |
| # Moonshine STT via PyO3/HuggingFace - Updated to 0.27 with auto-initialize |
| # Issue: PyO3 0.24 Instability on Python 3.13 (Moonshine Backend) | ||
|
|
||
| **Status**: DRAFT (Local) | ||
| **Created**: 2025-12-10 | ||
| **Priority**: High (Blocks stable build on modern Linux distros) | ||
|
|
||
| ## Problem | ||
| PyO3 0.24 introduces breaking changes and strict requirements for Python 3.13 compatibility, specifically regarding free-threaded builds (GIL removal). This impacts the `moonshine` STT plugin in ColdVox. | ||
|
|
||
| ## Symptoms | ||
| - Build errors on systems with Python 3.13 default (e.g., Arch, Fedora Rawhide). | ||
| - Potential runtime panics if `#[pyclass]` structs do not implement `Sync`. | ||
| - API deprecations/renames (`Python::with_gil` semantics shifting). | ||
|
|
||
| ## Findings from Research | ||
| 1. **Free-Threading (3.13t)**: Python 3.13 supports experimental free-threading. PyO3 0.24 requires `Sync` implementation for all `#[pyclass]` types to support this. | ||
| 2. **API Churn**: `Python::with_gil` is conceptually deprecated in favor of `Python::attach` in free-threaded contexts, though 0.24 still supports it. | ||
| 3. **Build Tooling**: Attempting to build against Python 3.13 with older versions (or mismatched feature flags) fails. | ||
| 4. **Current Config**: `coldvox-stt` uses `pyo3 = "0.24.1"`. |
Copilot
AI
Dec 12, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The documentation states "PyO3 0.24 introduces breaking changes" but this PR is upgrading to PyO3 0.27, not documenting issues with 0.24. The title also references 0.24. Since the code has moved to 0.27, this documentation should either be updated to reflect that 0.27 is now being used, or the issue should be reframed to explain the historical context of why the upgrade was necessary.
| # Issue: PyO3 0.24 Instability on Python 3.13 (Moonshine Backend) | |
| **Status**: DRAFT (Local) | |
| **Created**: 2025-12-10 | |
| **Priority**: High (Blocks stable build on modern Linux distros) | |
| ## Problem | |
| PyO3 0.24 introduces breaking changes and strict requirements for Python 3.13 compatibility, specifically regarding free-threaded builds (GIL removal). This impacts the `moonshine` STT plugin in ColdVox. | |
| ## Symptoms | |
| - Build errors on systems with Python 3.13 default (e.g., Arch, Fedora Rawhide). | |
| - Potential runtime panics if `#[pyclass]` structs do not implement `Sync`. | |
| - API deprecations/renames (`Python::with_gil` semantics shifting). | |
| ## Findings from Research | |
| 1. **Free-Threading (3.13t)**: Python 3.13 supports experimental free-threading. PyO3 0.24 requires `Sync` implementation for all `#[pyclass]` types to support this. | |
| 2. **API Churn**: `Python::with_gil` is conceptually deprecated in favor of `Python::attach` in free-threaded contexts, though 0.24 still supports it. | |
| 3. **Build Tooling**: Attempting to build against Python 3.13 with older versions (or mismatched feature flags) fails. | |
| 4. **Current Config**: `coldvox-stt` uses `pyo3 = "0.24.1"`. | |
| # Issue: PyO3 0.27 Instability on Python 3.13 (Moonshine Backend) | |
| **Status**: DRAFT (Local) | |
| **Created**: 2025-12-10 | |
| **Priority**: High (Blocks stable build on modern Linux distros) | |
| ## Problem | |
| PyO3 0.27 introduces breaking changes and strict requirements for Python 3.13 compatibility, specifically regarding free-threaded builds (GIL removal). This impacts the `moonshine` STT plugin in ColdVox. | |
| > **Note:** This document was originally written for PyO3 0.24, but has been updated to reflect the upgrade to 0.27. The upgrade was necessary due to ongoing Python 3.13 compatibility issues and continued API changes in PyO3. | |
| ## Symptoms | |
| - Build errors on systems with Python 3.13 default (e.g., Arch, Fedora Rawhide). | |
| - Potential runtime panics if `#[pyclass]` structs do not implement `Sync`. | |
| - API deprecations/renames (`Python::with_gil` semantics shifting). | |
| ## Findings from Research | |
| 1. **Free-Threading (3.13t)**: Python 3.13 supports experimental free-threading. PyO3 0.27 requires `Sync` implementation for all `#[pyclass]` types to support this. | |
| 2. **API Churn**: `Python::with_gil` is conceptually deprecated in favor of `Python::attach` in free-threaded contexts, though 0.27 still supports it. | |
| 3. **Build Tooling**: Attempting to build against Python 3.13 with older versions (or mismatched feature flags) fails. | |
| 4. **Current Config**: `coldvox-stt` uses `pyo3 = "0.27.x"`. |
| @@ -0,0 +1,27 @@ | |||
| # Issue: PyO3 0.24 Instability on Python 3.13 (Moonshine Backend) | |||
Copilot
AI
Dec 12, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The title references "PyO3 0.24 Instability" but the PR upgrades to PyO3 0.27. Consider updating the title to "PyO3 0.27 Upgrade for Python 3.13 Compatibility" or similar to better reflect the resolution rather than the problem.
| # Issue: PyO3 0.24 Instability on Python 3.13 (Moonshine Backend) | |
| # Issue: PyO3 0.27 Upgrade for Python 3.13 Compatibility (Moonshine Backend) |
- Add required frontmatter to docs/issues/pyo3_instability.md
- Fix .envrc to use ${PWD} instead of $(pwd) for robustness
- Run cargo fmt to fix formatting issues in moonshine plugin files
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
⚠️ Critical Issue Found
I found a critical compilation error in the new verify_moonshine.rs example that prevents it from building.
Issue: Missing tokio dependency
The example uses #[tokio::main] but doesn't import or depend on tokio. This will cause a compilation failure.
Files affected:
crates/coldvox-stt/examples/verify_moonshine.rs
Location: Line 1 (import section)
Fix: Add tokio to the dev-dependencies section of crates/coldvox-stt/Cargo.toml:
[dev-dependencies]
tokio = { version = "1.35", features = ["rt-multi-thread", "macros"] }
serial_test = "3.2"
hound = "3.5"Without this fix, cargo run -p coldvox-stt --example verify_moonshine will fail with a compilation error.
Additional Minor Issues
I've reviewed the changes and identified several minor issues that should be addressed:
1. Outdated comments in moonshine.rs
Files affected: crates/coldvox-stt/src/plugins/moonshine.rs
The comments on lines 80 and 90 still reference Python::with_gil() but the code now uses Python::attach(). Update these comments to reflect the current API:
/// SAFETY: `Py<PyAny>` is `Send` but requires Python GIL for all access.
/// All methods that access `cached_model` must use `Python::attach()`.
#[cfg(feature = "moonshine")]
cached_model: Option<Py<PyAny>>,
/// SAFETY: `Py<PyAny>` is `Send` but requires Python GIL for all access.
/// All methods that access `cached_processor` must use `Python::attach()`.
#[cfg(feature = "moonshine")]
cached_processor: Option<Py<PyAny>>,2. Improve error visibility in .envrc
Files affected: .envrc
The --quiet flag on uv sync could hide important errors during development. Consider removing it or adding explicit error handling:
# Ensure dependencies are synced
uv sync || {
echo "Error: Failed to sync dependencies"
exit 1
}3. Remove unused variable in verify_moonshine.rs
Files affected: crates/coldvox-stt/examples/verify_moonshine.rs
The spec variable is declared but never used (line 32-37). Either use it or remove it:
// Remove this if not needed:
let spec = hound::WavSpec {
channels: 1,
sample_rate,
bits_per_sample: 16,
sample_format: hound::SampleFormat::Int,
};4. Clarify duration in verify_moonshine.rs
Files affected: crates/coldvox-stt/examples/verify_moonshine.rs
The comment says "1s of 440Hz sine wave" but duration_secs = 2. Either update the comment or the variable:
// Generate Test Audio (2s of 440Hz sine wave @ 16kHz)
let duration_secs = 2;5. Update documentation accuracy
Files affected: docs/issues/pyo3_instability.md
The documentation still references PyO3 0.24 but the upgrade is to 0.27. Consider updating to:
# Issue: PyO3 0.27 Upgrade for Python 3.13 Compatibility (Moonshine Backend)
**Status**: RESOLVED
**Created**: 2025-12-10
**Resolved**: 2025-12-12
**Priority**: High (Blocks stable build on modern Linux distros)
## Problem
PyO3 0.24 introduced breaking changes and strict requirements for Python 3.13 compatibility. This PR upgrades to PyO3 0.27 to resolve these issues and ensure forward compatibility with Python 3.13 free-threading support.Summary
Critical: 1 issue (missing tokio dependency)
Minor: 5 issues (comments, documentation, minor code improvements)
The PR addresses the core requirement of upgrading PyO3 for Python 3.13 compatibility, and the API migration from with_gil() to attach() appears correct. However, the verify_moonshine.rs example needs the tokio dependency added to compile successfully.
Recommendation: Address the critical tokio dependency issue before merge. The minor issues can be addressed in a follow-up or as part of this PR based on team preference.
The example uses moonshine-specific types that aren't available when building without the moonshine feature, causing clippy to fail in CI. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]>
The test was only clearing the `CI` variable but not other CI indicators like `GITHUB_ACTIONS`, `GITLAB_CI`, etc. This caused the test to fail in GitHub Actions where `GITHUB_ACTIONS=true` is set. Now clears all CI-related variables consistent with other tests like `test_detect_function_basic`. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]>
qodo-code-review
bot
commented
Dec 12, 2025
•
edited by qodo-free-for-open-source-projects
bot
Loading
edited by qodo-free-for-open-source-projects
bot
CI Feedback 🧐(Feedback updated until commit c27f96b)A test triggered by this PR failed. Here is an AI-generated analysis of the failure:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
✅ No Critical Issues Found
I've reviewed PR #294 and found no critical issues. The PyO3 upgrade from 0.24.1 to 0.27 and API migration from with_gil() to attach() appear to be implemented correctly.
Note: The previous review incorrectly flagged a missing tokio dependency. The verify_moonshine.rs example compiles successfully because tokio is already present in the [dev-dependencies] section of Cargo.toml.
Minor Issues Found
I identified 4 minor issues that should be addressed:
| Issue | Location | Severity |
|---|---|---|
| Unused variable in example | verify_moonshine.rs:32-37 |
SUGGESTION |
| Comment duration mismatch | verify_moonshine.rs:39 |
SUGGESTION |
| Documentation needs update | pyo3_instability.md:1-10 |
SUGGESTION |
| Error visibility in .envrc | .envrc:16 |
SUGGESTION |
Key Changes Reviewed
✅ PyO3 Upgrade: Correctly upgraded from 0.24.1 to 0.27 with auto-initialize feature
✅ API Migration: All 4 instances of Python::with_gil() properly migrated to Python::attach()
✅ Dependency Updates: Cargo.lock updated correctly for PyO3 0.27 and transitive dependencies
✅ Development Tools: Added .envrc, justfile recipes, and verification example
✅ Documentation: Comprehensive documentation of PyO3/Python 3.13 issues
Recommendation: These changes address the core requirement of upgrading PyO3 for Python 3.13 compatibility. The API migration is correct and the new development tooling will be helpful for testing. Address the minor issues at your discretion.
| let spec = hound::WavSpec { | ||
| channels: 1, | ||
| sample_rate, | ||
| bits_per_sample: 16, | ||
| sample_format: hound::SampleFormat::Int, | ||
| }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 SUGGESTION: Remove unused variable
The spec variable is declared but never used (lines 32-37). Either use it or remove it:
// Remove this if not needed:
let spec = hound::WavSpec {
channels: 1,
sample_rate,
bits_per_sample: 16,
sample_format: hound::SampleFormat::Int,
};| // We create a buffer of samples | ||
| let mut samples = Vec::new(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 SUGGESTION: Fix comment accuracy
The comment says "1s of 440Hz sine wave" but duration_secs = 2. Either update the comment or the variable:
// Generate Test Audio (2s of 440Hz sine wave @ 16kHz)
let duration_secs = 2;| --- | ||
| doc_type: troubleshooting | ||
| subsystem: stt | ||
| version: 1.0.0 | ||
| status: draft | ||
| owners: Documentation Working Group | ||
| last_reviewed: 2025-12-12 | ||
| --- | ||
|
|
||
| # Issue: PyO3 0.24 Instability on Python 3.13 (Moonshine Backend) | ||
|
|
||
| **Status**: DRAFT (Local) | ||
| **Created**: 2025-12-10 | ||
| **Priority**: High (Blocks stable build on modern Linux distros) | ||
|
|
||
| ## Problem | ||
| PyO3 0.24 introduces breaking changes and strict requirements for Python 3.13 compatibility, specifically regarding free-threaded builds (GIL removal). This impacts the `moonshine` STT plugin in ColdVox. | ||
|
|
||
| ## Symptoms | ||
| - Build errors on systems with Python 3.13 default (e.g., Arch, Fedora Rawhide). | ||
| - Potential runtime panics if `#[pyclass]` structs do not implement `Sync`. | ||
| - API deprecations/renames (`Python::with_gil` semantics shifting). | ||
|
|
||
| ## Findings from Research | ||
| 1. **Free-Threading (3.13t)**: Python 3.13 supports experimental free-threading. PyO3 0.24 requires `Sync` implementation for all `#[pyclass]` types to support this. | ||
| 2. **API Churn**: `Python::with_gil` is conceptually deprecated in favor of `Python::attach` in free-threaded contexts, though 0.24 still supports it. | ||
| 3. **Build Tooling**: Attempting to build against Python 3.13 with older versions (or mismatched feature flags) fails. | ||
| 4. **Current Config**: `coldvox-stt` uses `pyo3 = "0.24.1"`. | ||
|
|
||
| ## Impact on ColdVox | ||
| `moonshine.rs` uses `Python::with_gil` extensively. If the system Python is 3.13, the build may produce unstable binaries or fail link checks because our `MoonshinePlugin` struct holds `Py<PyAny>` fields that might need `Sync` guards in the new model. | ||
|
|
||
| ## Recommendation | ||
| 1. **Short Term**: Pin Python to 3.12 for stability via `.python-version` or `pyenv`. | ||
| 2. **Code Change**: Audit all `Py<T>` usage in `moonshine.rs` for `Sync` compliance. | ||
| 3. **Configuration**: Consider enabling `abi3-py313` feature in `Cargo.toml` or setting `PYO3_USE_ABI3_FORWARD_COMPATIBILITY=1`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 SUGGESTION: Update documentation to reflect current state
The documentation still references PyO3 0.24 but the upgrade is to 0.27. Consider updating to:
# Issue: PyO3 0.27 Upgrade for Python 3.13 Compatibility (Moonshine Backend)
**Status**: RESOLVED
**Created**: 2025-12-10
**Resolved**: 2025-12-12
**Priority**: High (Blocks stable build on modern Linux distros)
## Problem
PyO3 0.24 introduced breaking changes and strict requirements for Python 3.13 compatibility. This PR upgrades to PyO3 0.27 to resolve these issues and ensure forward compatibility with Python 3.13 free-threading support.|
|
||
| # Set PYO3 to use this venv's Python |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 SUGGESTION: Improve error visibility
The --quiet flag on uv sync could hide important errors during development. Consider removing it or adding explicit error handling:
# Ensure dependencies are synced
uv sync || {
echo "Error: Failed to sync dependencies"
exit 1
}|
Closing as superseded - the PyO3 0.27 upgrade was merged as part of PR #296 (feat: upgrade PyO3 0.27, stabilize CI, and fix real injection tests). |
User description
Summary
auto-initializefeaturewith_gil()toattach()per PyO3 0.27 migration guidePython::initialize()calls (handled by auto-initialize).envrcfor direnv,.python-versionpinned to 3.12setup-moonshine,build-moonshine,verify-moonshineverify_moonshine.rsexample for isolated STT testingdocs/issues/Motivation
Resolves Python 3.13 free-threading compatibility issues documented in
docs/issues/pyo3_instability.md. PyO3 0.24 requiresSyncfor#[pyclass]structs in free-threaded Python 3.13, causing build failures on modern Linux distros.Test plan
cargo check -p coldvox-stt --features moonshinepasses with no warningsjust verify-moonshinepasses with Python 3.12🤖 Generated with Claude Code
PR Type
Enhancement, Tests
Description
Upgrade PyO3 from 0.24.1 to 0.27 for Python 3.13 compatibility
Migrate API from
with_gil()toattach()per PyO3 0.27 migration guideAdd development tooling:
.envrcfor direnv,.python-versionpinned to 3.12Add justfile recipes and
verify_moonshine.rsexample for isolated STT testingDocument PyO3/Python 3.13 free-threading compatibility issues
Diagram Walkthrough
File Walkthrough
Cargo.toml
Upgrade PyO3 dependency to 0.27crates/coldvox-stt/Cargo.toml
pyo3dependency from 0.24.1 to 0.27auto-initializefeature enabled for automatic Pythoninitialization
moonshine.rs
Migrate PyO3 API from with_gil to attachcrates/coldvox-stt/src/plugins/moonshine.rs
Python::with_gil()calls withPython::attach()(4occurrences)
verify_python_environment(),load_model_and_processor(),transcribe(), andcheck_moonshine_available()functionssupport
verify_moonshine.rs
Add Moonshine verification example for isolated testingcrates/coldvox-stt/examples/verify_moonshine.rs
audio generation, processing, and transcription
emoji indicators
.envrc
Add direnv configuration for venv automation.envrc
.venvusinguvif not presentPYO3_PYTHONenvironment variable to use venv's Python interpreterjustfile
Add justfile recipes for Moonshine setup and testingjustfile
setup-moonshinerecipe to install Python dependencies via scriptbuild-moonshinerecipe to build with Moonshine feature enabledverify-moonshinerecipe to run the verification examplepyo3_instability.md
Document PyO3 0.24 Python 3.13 compatibility issuesdocs/issues/pyo3_instability.md
free-threaded builds
recommendations
Syncrequirement changes and API deprecations in PyO3 0.24+