Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add '__pyo3_version__` to native modules compiled with PyO3 #3426

Open
davidhewitt opened this issue Sep 1, 2023 · 2 comments
Open

Add '__pyo3_version__` to native modules compiled with PyO3 #3426

davidhewitt opened this issue Sep 1, 2023 · 2 comments

Comments

@davidhewitt
Copy link
Member

From sphinx-doc/sphinx#11662 (comment)

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?

@jaraco
Copy link

jaraco commented Sep 3, 2023

In my experience, if a name is addressing two concerns (i.e. PyO3 and version), it's often wise to actually model those concerns separately, similar to how __spec__ models details about a modules spec. Please consider adding the detail as __pyo3__.version or similar.

@davidhewitt
Copy link
Member Author

Removing Good First Issue as this probably requires integration with the pyo3-runtime Python module to be completed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants