PyO3 / PyO3/pyo3

Ability to include bare ffi methods in a `#[pyclass]`

Open
#3,949 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

As described in issues #3827 and #3843 there is some (unavoidable) overhead in calling PyO3 wrapped functions. An idea: the ability to fall back on lower level pyo3_ffi code for certain methods where you'd like to avoid this overhead.

Why is this important? Often, classes have small methods that are called a lot (e.g. magic methods). In my case, I'm porting Python classes with many such short methods.

related: this thread on discord

davidhewitt: Perhaps worth opening as a PyO3 issue? I could at least spitball some ideas on syntax and implementation and then maybe someone is interested in giving it a crack

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 reading related issues #3827 and #3843, then review the linked Discord discussion for proposed syntax and implementation ideas. The issue names no files or tests and does not define acceptance criteria, so the desired #[pyclass] and pyo3_ffi behavior needs to be established before implementation.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.