diff --git a/api/py/.gitignore b/api/py/.gitignore index 0c0190c6d7..ddf184b451 100644 --- a/api/py/.gitignore +++ b/api/py/.gitignore @@ -4,4 +4,6 @@ __pycache__ *.onnx build mobilenet_v2_1.0.onnx.nnef.tgz +rust-workspace +dist diff --git a/api/py/MANIFEST.in b/api/py/MANIFEST.in new file mode 100644 index 0000000000..4ec41f1db1 --- /dev/null +++ b/api/py/MANIFEST.in @@ -0,0 +1,2 @@ +graft rust-workspace +graft docs diff --git a/api/py/requirements.txt b/api/py/requirements.txt index ad35afec1f..77bfb1649e 100644 --- a/api/py/requirements.txt +++ b/api/py/requirements.txt @@ -1,4 +1,4 @@ -numpy==1.25.2 -setuptools==68.1.2 -setuptools_rust==1.6.0 +numpy==1.26.4 +setuptools==69.1.1 +setuptools_rust==1.9.0 toml==0.10.2 diff --git a/api/py/setup.py b/api/py/setup.py index 3ca3a97d42..2baa5f1ab1 100644 --- a/api/py/setup.py +++ b/api/py/setup.py @@ -1,9 +1,18 @@ from setuptools import setup from setuptools_rust import Binding, RustExtension +import shutil import toml import re +import os -version = toml.load("../Cargo.toml")["package"]["version"] +if not os.path.exists("rust-workspace"): + shutil.copytree( + "../..", + "rust-workspace", + ignore = shutil.ignore_patterns(".cached", "target", ".git", "issue-*", ".travis", "assets", ".github", "py") + ) + +version = toml.load("rust-workspace/api/Cargo.toml")["package"]["version"] version = re.sub("\-alpha\.", "a", version) version = re.sub("\-.*", ".dev", version) @@ -38,7 +47,7 @@ "License :: OSI Approved :: Apache Software License", "License :: OSI Approved :: MIT License" ], - rust_extensions=[RustExtension("tract.tract", binding=Binding.NoBinding, path="../ffi/Cargo.toml")], + rust_extensions=[RustExtension("tract.tract", binding=Binding.NoBinding, path="rust-workspace/api/ffi/Cargo.toml")], packages=["tract"], zip_safe=False, python_requires=">=3.7",