Skip to content

Commit 63082c4

Browse files
authored
Enabling static interpreter embedding for manylinux. (#1064)
* Removing dead file. * Checking that we can distribute with static python embedding for manylinux * Many linux embed interpreter. * Building wheels manylinux with static embedding * Better script. * typo. * Using a dummy feature? * default features ? * Back into order. * Fixing manylinux ??. * Local dir. * Missing star. * Makedir ? * Monkey coding this. * extension module ? * Building with default features `RustExtension`. * bdist_wheel + rustextension any better ? * update rust-py version. * Forcing extension module. * No default features. * Remove py37 out of spite * Revert "Remove py37 out of spite" This reverts commit 6ab7fac. * Really extraneous feature. * Fix build wheels. * Putting things back in place.
1 parent 655f405 commit 63082c4

File tree

7 files changed

+35
-28
lines changed

7 files changed

+35
-28
lines changed

bindings/python/Cargo.lock

Lines changed: 18 additions & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

bindings/python/Cargo.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "tokenizers-python"
3-
version = "0.11.0"
3+
version = "0.13.0"
44
authors = ["Anthony MOI <m.anthony.moi@gmail.com>"]
55
edition = "2018"
66

@@ -14,7 +14,7 @@ serde = { version = "1.0", features = [ "rc", "derive" ]}
1414
serde_json = "1.0"
1515
libc = "0.2"
1616
env_logger = "0.7.1"
17-
pyo3 = "0.16.2"
17+
pyo3 = { version = "0.16.2", features = ["extension-module"] }
1818
numpy = "0.16.2"
1919
ndarray = "0.13"
2020
onig = { version = "6.0", default-features = false }
@@ -26,7 +26,7 @@ path = "../../tokenizers"
2626

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

3130
[features]
32-
default = ["pyo3/extension-module"]
31+
test = ["pyo3/auto-initialize"]
32+

bindings/python/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ TESTS_RESOURCES = $(DATA_DIR)/small.txt $(DATA_DIR)/roberta.json
2020
test: $(TESTS_RESOURCES)
2121
pip install pytest requests setuptools_rust numpy pyarrow datasets
2222
python -m pytest -s -v tests
23-
cargo test --no-default-features
23+
cargo test --features test
2424

2525
$(DATA_DIR)/big.txt :
2626
$(dir_guard)

bindings/python/build-wheels.sh

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,28 @@
11
#!/bin/bash
22
set -ex
33

4-
curl https://sh.rustup.rs -sSf | sh -s -- -y
4+
if ! command -v cargo &> /dev/null
5+
then
6+
curl https://sh.rustup.rs -sSf | sh -s -- -y
7+
fi
8+
59
export PATH="$HOME/.cargo/bin:$PATH"
610

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

10-
"${PYBIN}/pip" install -U setuptools-rust==0.11.3
14+
"${PYBIN}/pip" install -U setuptools-rust setuptools wheel
1115
"${PYBIN}/python" setup.py bdist_wheel
1216
rm -rf build/*
1317
done
1418

15-
for whl in dist/*.whl; do
19+
for whl in ./dist/*.whl; do
1620
auditwheel repair "$whl" -w dist/
1721
done
1822

1923
# Keep only manylinux wheels
20-
rm dist/*-linux_*
24+
rm ./dist/*-linux_*
25+
2126

2227
# Upload wheels
2328
/opt/python/cp37-cp37m/bin/pip install -U awscli

bindings/python/py_src/tokenizers/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
__version__ = "0.13.0.dev0"
1+
__version__ = "0.13.0"
22

33
from typing import Tuple, Union, Tuple, List
44
from enum import Enum

bindings/python/setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
setup(
1010
name="tokenizers",
11-
version="0.13.0.dev0",
11+
version="0.13.0",
1212
description="Fast and Customizable Tokenizers",
1313
long_description=open("README.md", "r", encoding="utf-8").read(),
1414
long_description_content_type="text/markdown",

bindings/python/test2.py

Lines changed: 0 additions & 4 deletions
This file was deleted.

0 commit comments

Comments
 (0)