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

Enabling static interpreter embedding for manylinux. #1064

Merged
merged 25 commits into from
Sep 21, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 18 additions & 12 deletions bindings/python/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions bindings/python/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "tokenizers-python"
version = "0.11.0"
version = "0.13.0"
authors = ["Anthony MOI <m.anthony.moi@gmail.com>"]
edition = "2018"

Expand All @@ -14,7 +14,7 @@ serde = { version = "1.0", features = [ "rc", "derive" ]}
serde_json = "1.0"
libc = "0.2"
env_logger = "0.7.1"
pyo3 = "0.16.2"
pyo3 = { version = "0.16.2", features = ["extension-module"] }
numpy = "0.16.2"
ndarray = "0.13"
onig = { version = "6.0", default-features = false }
Expand All @@ -26,7 +26,7 @@ path = "../../tokenizers"

[dev-dependencies]
tempfile = "3.1"
pyo3 = { version = "0.16.2", features = ["auto-initialize"] }

[features]
default = ["pyo3/extension-module"]
test = ["pyo3/auto-initialize"]

2 changes: 1 addition & 1 deletion bindings/python/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ TESTS_RESOURCES = $(DATA_DIR)/small.txt $(DATA_DIR)/roberta.json
test: $(TESTS_RESOURCES)
pip install pytest requests setuptools_rust numpy pyarrow datasets
python -m pytest -s -v tests
cargo test --no-default-features
cargo test --features test

$(DATA_DIR)/big.txt :
$(dir_guard)
Expand Down
15 changes: 10 additions & 5 deletions bindings/python/build-wheels.sh
Original file line number Diff line number Diff line change
@@ -1,23 +1,28 @@
#!/bin/bash
set -ex

curl https://sh.rustup.rs -sSf | sh -s -- -y
if ! command -v cargo &> /dev/null
then
curl https://sh.rustup.rs -sSf | sh -s -- -y
fi

export PATH="$HOME/.cargo/bin:$PATH"

for PYBIN in /opt/python/{cp37-cp37m,cp38-cp38,cp39-cp39,cp310-cp310}/bin; do
for PYBIN in /opt/python/cp{37,38,39,310}*/bin; do
export PYTHON_SYS_EXECUTABLE="$PYBIN/python"

"${PYBIN}/pip" install -U setuptools-rust==0.11.3
"${PYBIN}/pip" install -U setuptools-rust setuptools wheel
"${PYBIN}/python" setup.py bdist_wheel
rm -rf build/*
done

for whl in dist/*.whl; do
for whl in ./dist/*.whl; do
auditwheel repair "$whl" -w dist/
done

# Keep only manylinux wheels
rm dist/*-linux_*
rm ./dist/*-linux_*


# Upload wheels
/opt/python/cp37-cp37m/bin/pip install -U awscli
Expand Down
2 changes: 1 addition & 1 deletion bindings/python/py_src/tokenizers/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
__version__ = "0.13.0.dev0"
__version__ = "0.13.0"

from typing import Tuple, Union, Tuple, List
from enum import Enum
Expand Down
2 changes: 1 addition & 1 deletion bindings/python/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

setup(
name="tokenizers",
version="0.13.0.dev0",
version="0.13.0",
description="Fast and Customizable Tokenizers",
long_description=open("README.md", "r", encoding="utf-8").read(),
long_description_content_type="text/markdown",
Expand Down
4 changes: 0 additions & 4 deletions bindings/python/test2.py

This file was deleted.