Skip to content

Commit d03e90c

Browse files
authored
Move packaging setup to pyproject.toml + fix installation errors (#177)
1 parent 4361747 commit d03e90c

File tree

4 files changed

+81
-84
lines changed

4 files changed

+81
-84
lines changed

.github/workflows/test_models.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,8 @@ jobs:
5555
if [ "${{ matrix.executorch-version }}" == "nightly" ]; then
5656
python install_dev.py
5757
else
58-
pip install '.[tests]'
58+
pip install '.[dev]'
5959
pip install executorch==${{ matrix.executorch-version }}
60-
pip install git+https://github.com/pytorch-labs/tokenizers
6160
fi
6261
pip list
6362
- name: Run tests

install_dev.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ def install_torch_nightly_deps():
77
"""Install torch related dependencies from pinned nightly"""
88
EXECUTORCH_NIGHTLY_VERSION = "dev20250916"
99
TORCHAO_NIGHTLY_VERSION = "dev20250916"
10-
# Torch nightly is aligned with pinned nightly in https://github.com/pytorch/executorch/blob/main/install_requirements.py#L74
10+
# Torch nightly is aligned with pinned nightly in https://github.com/pytorch/executorch/blob/main/torch_pin.py#L2
1111
TORCH_NIGHTLY_VERSION = "dev20250916"
1212
subprocess.check_call(
1313
[
@@ -43,7 +43,7 @@ def install_dep_from_source():
4343
"-m",
4444
"pip",
4545
"install",
46-
"git+https://github.com/pytorch-labs/tokenizers@fc32028858020c4fcafe37aaaeaf5d1b480336a2#egg=pytorch-tokenizers",
46+
"git+https://github.com/pytorch-labs/tokenizers@3aada3fe28c945d14d5ec62254eb56ccdf10eb11#egg=pytorch-tokenizers",
4747
]
4848
)
4949

pyproject.toml

Lines changed: 78 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,83 @@
1+
[project]
2+
name = "optimum-executorch"
3+
dynamic = ["version"]
4+
description = "Optimum Executorch is an interface between the Hugging Face libraries and ExecuTorch"
5+
readme = { file = "README.md", content-type = "text/markdown" }
6+
license = { text = "Apache" }
7+
authors = [
8+
{ name = "HuggingFace Inc. Special Ops Team", email = "hardware@huggingface.co" },
9+
]
10+
requires-python = ">=3.10.0"
11+
keywords = ["transformers", "quantization", "inference", "executorch"]
12+
classifiers = [
13+
"Development Status :: 2 - Pre-Alpha",
14+
"License :: OSI Approved :: Apache Software License",
15+
"Intended Audience :: Developers",
16+
"Intended Audience :: Education",
17+
"Intended Audience :: Science/Research",
18+
"Operating System :: OS Independent",
19+
"Programming Language :: Python :: 3",
20+
"Programming Language :: Python :: 3.10",
21+
"Programming Language :: Python :: 3.11",
22+
"Programming Language :: Python :: 3.12",
23+
"Topic :: Scientific/Engineering :: Artificial Intelligence",
24+
]
25+
26+
dependencies = [
27+
"optimum~=1.24",
28+
"executorch>=1.0.0",
29+
"transformers==4.56.1",
30+
"pytorch-tokenizers>=1.0.1",
31+
"accelerate>=0.26.0",
32+
]
33+
34+
[project.optional-dependencies]
35+
dev = [
36+
"accelerate>=0.26.0",
37+
"coremltools>=8.2.0",
38+
"datasets==3.6.0",
39+
"parameterized",
40+
"pytest",
41+
"safetensors",
42+
"sentencepiece",
43+
"numba!=0.58.0",
44+
"librosa",
45+
"soundfile",
46+
"tiktoken",
47+
"black~=23.1",
48+
"ruff==0.4.4",
49+
]
50+
51+
[project.urls]
52+
Homepage = "https://github.com/huggingface/optimum-executorch"
53+
54+
# ---- setuptools config ----
55+
56+
[tool.setuptools]
57+
# Equivalent of include_package_data=True
58+
include-package-data = true
59+
60+
[tool.setuptools.packages.find]
61+
# Mirrors find_namespace_packages(include=["optimum*"])
62+
include = ["optimum*"]
63+
namespaces = true
64+
65+
[tool.setuptools.dynamic]
66+
# Pull version from the Python attribute
67+
version = { attr = "optimum.executorch.version.__version__" }
68+
69+
# ---- your existing tool configs (kept, but one tweak suggested) ----
70+
171
[tool.black]
272
line-length = 119
3-
target-version = ['py37']
73+
# Recommended to match your supported interpreters:
74+
target-version = ["py310", "py311", "py312"]
475

576
[tool.ruff]
6-
# Never enforce `E501` (line length violations).
777
ignore = ["C901", "E501", "E741", "W605"]
878
select = ["C", "E", "F", "I", "W"]
979
line-length = 119
1080

11-
# Ignore import violations in all `__init__.py` files.
1281
[tool.ruff.per-file-ignores]
1382
"__init__.py" = ["E402", "F401", "F403", "F811"]
1483

@@ -18,6 +87,10 @@ known-first-party = ["optimum"]
1887

1988
[tool.pytest.ini_options]
2089
markers = [
21-
"run_slow",
22-
"portable",
90+
"run_slow",
91+
"portable",
2392
]
93+
94+
[build-system]
95+
requires = ["setuptools >= 77.0.3", "wheel"]
96+
build-backend = "setuptools.build_meta"

setup.py

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

0 commit comments

Comments
 (0)