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

Issue while compiling pydantic-core for Chaquopy #1607

Open
FCare opened this issue Jan 27, 2025 · 4 comments
Open

Issue while compiling pydantic-core for Chaquopy #1607

FCare opened this issue Jan 27, 2025 · 4 comments

Comments

@FCare
Copy link

FCare commented Jan 27, 2025

Hi, I am trying to make pydantic-core to work with Chaquopy. I am progressing, but I face an issue I do not understand.

Maybe you have some clues on what I am facing.

I am adding the;logs of the error here

log.zip

It looks like some API relative to pyDateTime are not found:

Compiling pydantic-core v2.27.2 (/Work/Inno/sandbox/pr/chaquopy/server/pypi/packages/pydantic-core/build/2.27.2/cp311-cp311-android_24_x86_64/src)
error[E0432]: unresolved imports pyo3::types::PyDate, pyo3::types::PyDateTime, pyo3::types::PyDelta, pyo3::types::PyDeltaAccess, pyo3::types::PyTime, pyo3::types::PyTzInfo
--> src/input/datetime.rs:6:19
|
6 | use pyo3::types::{PyDate, PyDateTime, PyDelta, PyDeltaAccess, PyDict, PyTime, PyTzInfo};
| ^^^^^^ ^^^^^^^^^^ ^^^^^^^ ^^^^^^^^^^^^^ ^^^^^^ ^^^^^^^^ no PyTzInfo in types
| | | | | |
| | | | | no PyTime in types
| | | | | help: a similar name exists in the module: PyType
| | | | no PyDeltaAccess in types
| | | no PyDelta in types
| | no PyDateTime in types
| no PyDate in types

Thanks a lot for your consideration.

@davidhewitt
Copy link
Contributor

It sounds like for some reason the abi3 PyO3 features are enabled. Can you please go into more detail about how you are configuring the build?

@FCare
Copy link
Author

FCare commented Jan 28, 2025

Yes, you are right, for chaquopy, we need to support multiple python version, so I have to add the abi3_py11 option. Patch I am working on is here: https://github.com/FCare/chaquopy/blob/pydantic-core/server/pypi/packages/pydantic-core/patches/pyo3_no_interpreter.patch

Does that mean that pydantic-core is not compatible with abi3 option anymore?

Thanks a lot for your support :-)

@davidhewitt
Copy link
Contributor

Does that mean that pydantic-core is not compatible with abi3 option anymore?

PyO3 has never exposed the datetime types with abi3 (their C API is not available on the limited API), so I don't think this would have ever worked.

If you are patching, you could modify pydantic-core in your patch to internally just use dynamic Python calls for these, which would be a performance hit. PyO3 does so internally for the chrono feature if you build for abi3, for example.

@FCare
Copy link
Author

FCare commented Jan 28, 2025

Ok thanks, I will give it a try.

I was suspecting issue with performance here, but that might be acceptable.

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

No branches or pull requests

2 participants