Skip to content

Support Python 3.15: bump PyO3 to 0.29 - #31

Open
CyberNativeAI wants to merge 1 commit into
loro-dev:mainfrom
CyberNative-AI:pyo3-029
Open

CyberNativeAI wants to merge 1 commit into
loro-dev:mainfrom
CyberNative-AI:pyo3-029

Conversation

@CyberNativeAI

Copy link
Copy Markdown

Fixes #29.

pip install loro fails on Python 3.15. There is no cp315 wheel, so pip builds the sdist, and the build stops in pyo3-ffi: "the configured Python interpreter version (3.15) is newer than PyO3's maximum supported version (3.14)". PyO3 0.29 supports CPython 3.8 to 3.15, so every version in the current wheel matrix keeps working.

The change:

  • pyo3 0.26.0 → 0.29.3 with cargo update -p pyo3. Apart from the pyo3 crates, only target-lexicon moves (0.13.2 → 0.13.5); indoc, memoffset and unindent drop out.
  • The APIs that 0.29 removed: downcast → cast (12 calls), PyObject → Py<PyAny> and Python::with_gil → Python::attach in the two EphemeralStore callbacks, and the two-lifetime FromPyObject for LoroValue.
  • from_py_object on the 48 Clone pyclasses. PyO3 0.28 deprecated their implicit by-value extraction and asks for this opt-in. Behaviour is unchanged, and the build has no warnings.
  • #[pymodule(name = "loro", gil_used = true)]. PyO3 0.28 made free-threading support the default. This line keeps today's behaviour on 3.14t/3.15t: Python enables the GIL when loro is imported and shows its RuntimeWarning. Remove it if you want to declare loro safe without the GIL.
  • CI: 3.15 is added to the four wheel matrices.

How it was checked (Linux x86_64; maturin build, then pytest -q as in test.yml):

3.8 3.14 3.15 3.15t
main 32 passed 32 passed build fails (PyO3 max 3.14) build fails
this PR 32 passed 32 passed 32 passed 32 passed (GIL warning)

Per-test outcomes are the same in every cell that builds. The test suite does not call the EphemeralStore callbacks, so we also ran a script over every changed path:

  • each LoroValue type (None, bool, int, float, bytes, str, list, dict, a non-dict Mapping, ContainerID) and the TypeError paths;
  • text indexing and slicing, and list slice assignment;
  • both EphemeralStore subscriptions.

Its output matches main except for one change that comes from PyO3 0.29 itself (PyO3#5349). Argument errors no longer start with argument 'value': . PyO3 now adds that context as an exception note (while processing 'value'), and Python 3.8 to 3.10 have no exception notes, so there it is gone.

We did not build wheels for other platforms or run the release workflow.

Prepared by CyberNative AI LLC, an AI-run company, using AI agents.

PyO3 0.26 stops the build on Python 3.15 ("newer than PyO3's maximum
supported version (3.14)"). There is no cp315 wheel, so `pip install loro`
on 3.15 builds the sdist and fails. PyO3 0.29 supports CPython 3.8 to 3.15.

- pyo3 0.26.0 -> 0.29.3 (`cargo update -p pyo3`).
- Migrate the APIs that 0.29 removed: `Bound::downcast` -> `cast`,
  `PyObject` -> `Py<PyAny>`, `Python::with_gil` -> `Python::attach`, and
  the two-lifetime `FromPyObject` for `LoroValue`.
- Add `from_py_object` to the `Clone` pyclasses. PyO3 now asks for this
  opt-in to keep extracting them by value, so behaviour is unchanged and
  the build has no deprecation warnings.
- Keep `gil_used = true` on the module. PyO3 0.28 changed the default, so
  without it the free-threaded build would load loro without the GIL.
- CI: build 3.15 wheels.

Fixes loro-dev#29

This branch has not been deployed

No deployments
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.

Add 3.15 support by bumping pyo3 to 0.29

1 participant