Skip to content

fix(python): remove stale _native extension from repo (#75)#83

Merged
zackees merged 1 commit intomainfrom
fix/issue-75-stale-native-pyd
Apr 18, 2026
Merged

fix(python): remove stale _native extension from repo (#75)#83
zackees merged 1 commit intomainfrom
fix/issue-75-stale-native-pyd

Conversation

@zackees
Copy link
Copy Markdown
Member

@zackees zackees commented Apr 18, 2026

Summary

  • Removes python/fbuild/_native.pyd, a checked-in PyO3 extension that went stale against crates/fbuild-python/src/lib.rs and caused AttributeError: SerialMonitor.reset_device when running Python tests that import fbuild._native.
  • Adds python/fbuild/_native.{pyd,abi3.so,so,dylib} to .gitignore so a freshly-built artifact cannot be accidentally re-committed.
  • Documents the local build step in the top-level README (under Development) and in python/README.md / python/fbuild/README.md:
    uv run cargo build --release -p fbuild-python --features extension-module
    # then copy target/release/_native.{dll,so,dylib} -> python/fbuild/_native.{pyd,abi3.so}

Published PyPI wheels are unaffected — ci/publish.py already pulls fresh per-platform extensions from the build.yml GitHub Actions run. The committed binary was only ever used for local in-tree Python tests.

Fixes #75.

Test plan

  • uv run cargo build --release -p fbuild-python --features extension-module succeeds
  • After copying the fresh artifact to python/fbuild/_native.pyd, from fbuild._native import SerialMonitor exposes reset_device (previously missing on the stale binary)
  • git check-ignore python/fbuild/_native.pyd matches the new .gitignore entry
  • CI: build.yml still produces _native.pyd / _native.abi3.so artifacts (workflow unchanged)
  • CI: ./publish wheel assembly still finds the extensions (publish.py unchanged)

Summary by CodeRabbit

  • Documentation

    • Added local build instructions for the Python native extension with platform-specific guidance (Windows, Linux, macOS)
    • Clarified that compiled extensions are not version-controlled and must be rebuilt locally when source changes occur
  • Chores

    • Added patterns to .gitignore for platform-specific native extension artifacts

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 18, 2026

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 4382130f-3498-486a-b07f-8f8d155a188d

📥 Commits

Reviewing files that changed from the base of the PR and between 39e7dcc and 56036ac.

⛔ Files ignored due to path filters (1)
  • python/fbuild/_native.pyd is excluded by !**/*.pyd
📒 Files selected for processing (4)
  • .gitignore
  • docs/DEVELOPMENT.md
  • python/README.md
  • python/fbuild/README.md

📝 Walkthrough

Walkthrough

This pull request addresses stale PyO3 native extension binaries by adding .gitignore rules to prevent committing platform-specific compiled artifacts and updating documentation to clarify that the _native extension must be rebuilt locally whenever Rust sources change.

Changes

Cohort / File(s) Summary
Configuration
.gitignore
Added ignore patterns for locally-built PyO3 native extension binaries across multiple platforms (_native.pyd, _native.abi3.so, _native.so, _native.dylib).
Documentation
docs/DEVELOPMENT.md, python/README.md, python/fbuild/README.md
Added and updated guidance explaining that the compiled _native extension is not committed to the repo, must be rebuilt locally when Rust source changes, and provided platform-specific build/copy instructions for Windows, Linux, and macOS.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Possibly related PRs

Poem

🐰 A binary so stale, left here in the fold,
No more shall we keep what grows old and cold!
Rebuild when it changes, the docs now make clear—
Fresh native extensions, rebuilt every year! 🔨✨

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/issue-75-stale-native-pyd

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 and usage tips.

The compiled PyO3 extension `python/fbuild/_native.pyd` was checked into
the repo and went out of sync with `crates/fbuild-python/src/lib.rs`.
Running tests that import `fbuild._native` (e.g. `test_serial_reset.py`)
failed with AttributeError for symbols like `SerialMonitor.reset_device`
because the committed binary predated the Rust source.

- Remove the stale Windows binary so the working tree never ships a
  pre-built extension.
- Gitignore `_native.{pyd,abi3.so,so,dylib}` under `python/fbuild/` so a
  freshly-built artifact can never be accidentally committed again.
- Document the local build step in the top-level README and in
  `python/README.md` / `python/fbuild/README.md`:
  `uv run cargo build --release -p fbuild-python --features extension-module`
  followed by copying the artifact into `python/fbuild/`.

Published PyPI wheels are unaffected: `ci/publish.py` already downloads
fresh per-platform extensions from the `build.yml` GitHub Actions run,
so the checked-in binary was only used for local in-tree Python tests.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@zackees zackees force-pushed the fix/issue-75-stale-native-pyd branch from 1265b7c to 56036ac Compare April 18, 2026 14:11
@zackees zackees merged commit f86d17a into main Apr 18, 2026
74 of 76 checks passed
@zackees zackees deleted the fix/issue-75-stale-native-pyd branch April 18, 2026 14:12
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.

Python reset tests use stale _native.pyd in repo checkout

1 participant