Skip to content

Conversation

@pax0r
Copy link

@pax0r pax0r commented Oct 30, 2025

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.

@mhsmith
Copy link
Member

mhsmith commented Oct 31, 2025

@freakboy3742: I haven't looked at this yet, but it might be relevant to what you're working on.

@Herklos
Copy link

Herklos commented Nov 28, 2025

Great job @pax0r! I can’t wait for it to be merged.

@mhsmith
Copy link
Member

mhsmith commented Nov 29, 2025

Thanks for the PR. To add a new package, we need a test script to verify that it works. Please do the following:

  • Follow the instructions in "Testing a package" in the README.
  • Push your test script to this PR.
  • Post a comment saying which Python versions and ABIs you have tested. You don't need to cover every combination, but you should get at least one of them passing.

`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).
Copy link
Member

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.

Comment on lines +675 to +676
# 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
Copy link
Member

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.

Comment on lines +5 to +8
build:
script_env:
- PYO3_NO_PYTHON=1

Copy link
Member

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.

Comment on lines +8 to +9
host:
- python
Copy link
Member

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.

Comment on lines +717 to +719
if "rust" in self.non_python_build_reqs:
self.get_rust_env_vars(env)

Copy link
Member

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}")
Copy link
Member

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_lib to stdlib, which is the more conventional spelling.
  • Merge extract_stdlib into extract_target, because making it a separate function is taking up more space for no benefit.

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

Labels

Development

Successfully merging this pull request may close these issues.

pydantic v2

3 participants