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__ attribute to native modules #3449

Closed
wants to merge 2 commits into from

Conversation

ongchi
Copy link
Contributor

@ongchi ongchi commented Sep 12, 2023

Closes #3426

@ongchi ongchi marked this pull request as draft September 12, 2023 14:57
@mejrs
Copy link
Member

mejrs commented Sep 12, 2023

Thanks!

What is your motivation for using a (handwritten?) pyclass for this? We've so far avoided this because pyo3 is linked statically; when two users write their own pyo3 modules, they'll have two different PyO3Attr types. (See the discussion around PanicException for why this can be problematic).

@adamreichold
Copy link
Member

We've so far avoided this because pyo3 is linked statically; when two users write their own pyo3 modules, they'll have two different PyO3Attr types. (See the discussion around PanicException for why this can be problematic).

I think the consensus reached so far is that we should ship a separate (pure Python for now) package called something like pyo3_runtime on PyPI which would contain shared types like PanicException and PyO3Attr, c.f. the discussion in the (eventually rejected) approach proposed in #3073 .

@davidhewitt
Copy link
Member

Agreed, I've been meaning to do that for aaaaages, and finally did it! 😂

#3450
https://pypi.org/project/pyo3-runtime

@ongchi
Copy link
Contributor Author

ongchi commented Sep 13, 2023

What is your motivation for using a (handwritten?) pyclass for this?

All because I'm noob.🤡

BTW, I think it will be nice if pyo3 modules include some build information (e.g. rust version, build target, features...) automatically with a general interface to fetch this info. This shall benefit both developers and users who install packages from pypi, could providing useful context for debugging/issue tracking.

@adamreichold
Copy link
Member

BTW, I think it will be nice if pyo3 modules include some build information (e.g. rust version, build target, features...) automatically with a general interface to fetch this info. This shall benefit both developers and users who install packages from pypi, could providing useful context for debugging/issue tracking.

I think https://github.com/PyO3/pyo3-built might be what you are looking for?

@ongchi
Copy link
Contributor Author

ongchi commented Sep 14, 2023

Cool! I'm not aware of that. Thanks for pointing this out.

@ongchi ongchi closed this Sep 14, 2023
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 '__pyo3_version__` to native modules compiled with PyO3
4 participants