PyO3 / PyO3/pyo3

Extend Python Class from Rust

Open
#991 20 comments 36 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

1.0-candidate needs-design
Dominant language
Rust
Stars
16.2k
Forks
1k
Avg merge
2d 6h
Merged PRs (30d)
66

Description

A user asked a question on Gitter just now about extending a Python class from Rust.

While I think it's possible to do this by hand with a lot of unsafe code by implementing PyTypeInfo for the base type manually, it's pretty complicated.

This is an issue to think one day about how to make this easier. Possibly it's good enough to document the current process, or maybe there are design changes we can make internally.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing PyTypeInfo and the manual process for extending a Python class from Rust described in the issue. Determine whether the project should document that process or pursue internal design changes; the work is done when one direction is agreed and its scope is clearly defined.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, rust
Domain
api, backend-api-design
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.