-
Notifications
You must be signed in to change notification settings - Fork 178
Recipe to build pydantic-core (required for Pydantic 2) #1413
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
base: master
Are you sure you want to change the base?
Conversation
|
@freakboy3742: I haven't looked at this yet, but it might be relevant to what you're working on. |
|
Great job @pax0r! I can’t wait for it to be merged. |
|
Thanks for the PR. To add a new package, we need a test script to verify that it works. Please do the following:
|
| `fortran` subdirectory in the same directory as this README, and unpack the .bz2 files | ||
| into it. | ||
| * `rust`: `rustup` must be on the PATH. | ||
| * `rust`: `rustup` must be on the PATH. One can set `PYO3_NO_PYTHON=1` in `script_env:` to build without a Python interpreter (https://pyo3.rs/main/building-and-distribution#building-abi3-extensions-without-a-python-interpreter). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please wrap at 88 columns.
| # available in the `target` packages for Python 3.12 and older, but are available on Python 3.13. | ||
| # However, since PyO3 0.16.4, it's possible to compile abi3 modules without sysconfig |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please wrap at 88 columns.
| build: | ||
| script_env: | ||
| - PYO3_NO_PYTHON=1 | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove the cryptography changes from this PR; we can do that in #1375.
| host: | ||
| - python |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
host: python is unnecessary, as this is the default for all packages whose source is downloaded from PyPI.
| if "rust" in self.non_python_build_reqs: | ||
| self.get_rust_env_vars(env) | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add a comment explaining why this needs to be done after script_env.
| run(f"{os.environ['AR']} rc {self.host_env}/chaquopy/lib/lib{name}.a") | ||
|
|
||
| def extract_stdlib(self): | ||
| run(f"unzip -q -d {self.chaquopy_dir}/lib {self.std_lib_zip}") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Directly under lib is the wrong place for the Python standard library; it should be under lib/python3.13, for example. So are you sure this is actually having any effect? Maybe the build would work fine without it.
If it's really necessary, then please do the following:
- Change
std_libtostdlib, which is the more conventional spelling. - Merge
extract_stdlibintoextract_target, because making it a separate function is taking up more space for no benefit.
As for Python 3.13 now includes sysconfig in Chaquopy build it is possible to directly build rust packages like pydantic-core.
This should fix #1017 at least for Python 3.13
In fact we should be able to build any rust-based package for Android this way.