PyO3 / PyO3/pyo3

Add '__pyo3_version__` to native modules compiled with PyO3

Open
#3,426 2 comments 3 reactions 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

From https://github.com/sphinx-doc/sphinx/issues/11662#issuecomment-1702462095

To be cheeky, could I ask if there is there a 'blessed' way to introspect if a module is PyO3 generated? It seems the variables mod.build_profile and mod.build_info might be heuristics, but a PYO3 = True flag or similar (a la 'pypy' in sys.modules) might be useful for future cases?

I can't think of one which exists right now, it seems like a practical improvement to have __pyo3_version__ as a standard attribute in compiled PyO3 modules?

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

The issue names no files, tests, or entry points. Start by locating how PyO3 generates native modules and where standard module attributes are defined; done means compiled PyO3 modules consistently expose a version attribute and the behavior is covered by tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, rust
Domain
api
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.