Skip to content

Improve Python binding#86

Open
cmpute wants to merge 6 commits into
developfrom
python
Open

Improve Python binding#86
cmpute wants to merge 6 commits into
developfrom
python

Conversation

@cmpute

@cmpute cmpute commented Jun 27, 2026

Copy link
Copy Markdown
Owner

No description provided.

Jacob Zhong and others added 6 commits June 28, 2026 01:26
Covers 10 concrete steps: fix todo!() panics, add UniInput conversion helpers,
implement arithmetic/comparison/bool for FPy/DPy/RPy, complete integer methods,
add float/rational predicates and rounding, create math module for sin/cos/exp/sqrt
and gcd/lcm, fix __format__, update type stubs, and add tests.

Co-Authored-By: Claude <noreply@anthropic.com>
Choose PyO3 0.24 (not 0.29) because:
- 0.24 MSRV is 1.63 — dashu's MSRV 1.68 is preserved
- 0.26+ requires MSRV 1.74+ (hard constraint violation per AGENTS.md)
- 0.24 has the modern Bound API, IntoPyObject, and stable #[pymodule] form
- 0.26+ drops Python 3.7 support

Covers all breaking changes: #[pymodule] signature, FromPyObject→extract_bound,
#[pyclass(eq, eq_int)], .into_py()→.into_py_any(), and .downcast()→.cast().

Co-Authored-By: Claude <noreply@anthropic.com>
AGENTS.md: Clarify that MSRV policy applies only to core crates
(dashu meta-crate and its dependencies: base, int, float, ratio, macros).
Secondary crates (dashu-python, benchmark, fuzz tests) are exempt.

TODO-python.md: Update Step 0 to target PyO3 0.29 instead of 0.24.
Since dashu-python is not bounded by the workspace MSRV, we can use
the latest PyO3. Covers all breaking changes through 0.29:
- FromPyObject with Borrowed and dual lifetimes (0.27)
- .downcast() -> .cast() (0.27)
- extension-module feature removed (0.28+)
- rust-version bumped to 1.83, requires-python >= 3.8

Co-Authored-By: Claude <noreply@anthropic.com>
Edition 2024 requires Rust >= 1.85.

Co-Authored-By: Claude <noreply@anthropic.com>
…rsing

dashu-python uses edition 2024 which requires Rust >= 1.85. When the CI runs
with Rust 1.68, cargo fails to parse python/Cargo.toml even for workspace-level
commands like 'cargo update'. The fix removes the python member from the
workspace list via sed before any cargo commands run in the 1.68 job.

Co-Authored-By: Claude <noreply@anthropic.com>
parking_lot and lock_api are transitive deps of PyO3, which is only used by
dashu-python. Since dashu-python is removed from the workspace in the 1.68
MSRV job, these packages are no longer in the dependency tree and cargo update
fails trying to pin them.

Also apply cargo fmt.

Co-Authored-By: Claude <noreply@anthropic.com>
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