tur-packages/python-orjson: add version 3.10.18#2308
Open
shaheen-coder wants to merge 2 commits into
Open
Conversation
| termux_step_make_install() { | ||
| WHEEL=$(find "$TERMUX_PKG_BUILDDIR/wheels" -name "orjson-*.whl" | head -1) | ||
| echo "Installing wheel: $WHEEL" | ||
| unzip -o "$WHEEL" -d "$TERMUX_PREFIX/lib/python3.13/site-packages/" |
Member
There was a problem hiding this comment.
The .whl file should be installed using the pip install --force-reinstall --no-deps --prefix="$TERMUX_PREFIX" "$_whl" command where $_whl contains the path to the .whl file
| "$MATURIN_BIN" build \ | ||
| --release \ | ||
| --target aarch64-linux-android \ | ||
| --strip \ |
Member
There was a problem hiding this comment.
--strip is not necessary to specify since termux_step_strip_elf_symbols() will do that afterward automatically
|
|
||
| PYO3_CROSS=1 \ | ||
| PYO3_CROSS_LIB_DIR="$TERMUX_PREFIX/lib" \ | ||
| PYO3_CROSS_PYTHON_VERSION="3.13" \ |
Member
There was a problem hiding this comment.
It should be $TERMUX_PYTHON_VERSION rather than hardcoded 3.13
|
|
||
| termux_step_make() { | ||
| termux_setup_rust | ||
| rustup target add aarch64-linux-android |
Member
There was a problem hiding this comment.
This line is not necessary - termux_setup_rust should be sufficient
| TERMUX_PKG_DESCRIPTION="Fast, correct Python JSON library supporting dataclasses, datetimes, and numpy" | ||
| TERMUX_PKG_LICENSE="Apache-2.0, MIT" | ||
| TERMUX_PKG_MAINTAINER="Shaheen <shaheenvsa@gmail.com>" | ||
| TERMUX_PKG_VERSION=3.10.18 |
Member
There was a problem hiding this comment.
Please try TERMUX_PKG_VERSION="3.11.7" instead
| TERMUX_PKG_LICENSE="Apache-2.0, MIT" | ||
| TERMUX_PKG_MAINTAINER="Shaheen <shaheenvsa@gmail.com>" | ||
| TERMUX_PKG_VERSION=3.10.18 | ||
| TERMUX_PKG_SRCURL=https://files.pythonhosted.org/packages/source/o/orjson/orjson-3.10.18.tar.gz |
Member
There was a problem hiding this comment.
Please try using this TERMUX_PKG_SRCURL instead:
TERMUX_PKG_SRCURL="https://github.com/ijl/orjson/archive/refs/tags/$TERMUX_PKG_VERSION.tar.gz"
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
packages/python-orjson: add version 3.10.18
What is this?
Adding
python-orjson— a fast JSON library for Python built with Rust and PyO3.Why orjson?
Anyone doing serious data work in Termux hits the same wall — Python's built-in
jsonmodule is slow.orjsonfixes that. It serializes common types likedatetime,numpyarrays,dataclassesandUUIDout of the box with no extra code, and it's consistently the fastest JSON library available for Python.For Termux users running data pipelines, scraping scripts, or API tools on their phone — this matters.
Build notes
This was not a straightforward package to build.
orjsonusesmaturinas its build backend (Rust + PyO3), which required careful cross-compilation setup for Android:maturintargetingaarch64-linux-android(API level 24)PYO3_CROSSenvironment used to point maturin at the Termux cross Python headerstermux_setup_rust+rustup target add$TERMUX_PREFIXsince host pip cannot installcp313wheelsTested on
Note to reviewers
This is my first contribution to TUR. I spent considerable time figuring out the maturin cross-compilation setup for Android — happy to refine anything in the
build.shbased on your feedback. If there are conventions I missed, please let me know and I'll fix them promptly.