feat(python): add PyO3-based Python bindings#600
Open
4fuu wants to merge 2 commits into
Open
Conversation
- Add native PyO3 extension in crates/fff-python - Replace ctypes wrapper with maturin-built package in packages/fff-python - Expose FileFinder, search/glob/directory/mixed/grep APIs and result types - Use PyPI package name fff-python (import name remains fff) - Update workspace Cargo.toml/Cargo.lock and .gitignore for Python artifacts
- Add .github/workflows/python.yml to test bindings on Ubuntu/macOS/Windows - Extend release.yaml with Python wheel builds (x86_64/aarch64) and sdist - Add optional PyPI publish job using trusted publishing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds a new Python binding for FFF using PyO3, providing a native extension with a clean Pythonic API.
Changes
crates/fff-python/with PyO3 bindingsFileFinderclass exposing search, glob, directory search, mixed search, grep and multi-grep APIsFileItem,DirItem,GrepMatch,Score, etc.destroy()packages/fff-python/using thematurinbuild backendfff-python; import name remainsfff.github/workflows/python.ymlfor Ubuntu/macOS/Windows testingrelease.yamlto build Python wheels (x86_64/aarch64) and sdist, with optional PyPI publishing via trusted publishingcrates/fff-pythonto workspace members and updatedCargo.lock.gitignorefor Python build artifactsVerification
Tested on the fork repository; the relevant CI checks pass:
cargo check -p fff-python✅cargo clippy -p fff-python --no-deps -- -D warnings✅uv run pytest -v✅ (8 passed)uv run python examples/basic.py .✅Python CIpasses on Ubuntu, macOS and WindowsPrebuildPython wheel jobs build successfully across all target platforms