-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpyproject.toml
More file actions
244 lines (218 loc) · 6.4 KB
/
pyproject.toml
File metadata and controls
244 lines (218 loc) · 6.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
[project]
authors = [{ name = "Cody Fincher", email = "cody@litestar.dev" }]
classifiers = [
"Operating System :: MacOS",
"Operating System :: POSIX :: Linux",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Programming Language :: Python :: 3.14",
"Programming Language :: Python :: 3 :: Only",
"Typing :: Typed",
]
dependencies = [
"obstore",
"numpy",
"typing_extensions",
"safetensors",
"tensorstore",
]
description = "Python/Mojo interface for Google Gemma 4"
license = { file = "LICENSE" }
name = "mogemma"
readme = "README.md"
requires-python = ">=3.10"
version = "0.5.0"
[project.urls]
Issue = "https://github.com/cofin/mogemma/issues/"
Source = "https://github.com/cofin/mogemma"
[[tool.uv.index]]
name = "modular-nightly"
url = "https://whl.modular.com/nightly/simple/"
[project.optional-dependencies]
llm = ["sentencepiece"]
telemetry = ["opentelemetry-api"]
vision = ["pillow>=12.1.1", "sentencepiece"]
[build-system]
requires = [
"hatchling",
"hatch-mojo>=0.1.8",
"mojo>=0.26.1a1",
"patchelf>=0.17.2.4; platform_system == 'Linux'",
]
build-backend = "hatchling.build"
[tool.cibuildwheel]
build = "cp310-* cp311-* cp312-* cp313-* cp314-*"
build-frontend = "build[uv]"
skip = ["*-musllinux_*", "*-win*", "*_i686", "pp*"]
test-skip = "*-*aarch64* *-*arm64*"
test-command = "cd /tmp && pytest {project}/src/py/tests --import-mode=importlib"
test-requires = [
"pytest",
"pytest-asyncio",
"numpy",
"sentencepiece",
"obstore",
"opentelemetry-api",
"pillow>=12.1.1",
"tomli",
]
[tool.cibuildwheel.linux]
before-all = [
"dnf install -y zstd unzip",
"if [ $(uname -m) = x86_64 ]; then CONDA_SUBDIR=linux-64 CONDA_BUILD=h934c35e_18; else CONDA_SUBDIR=linux-aarch64 CONDA_BUILD=hef695bb_18; fi && curl -sL https://conda.anaconda.org/conda-forge/${CONDA_SUBDIR}/libstdcxx-14.3.0-${CONDA_BUILD}.conda -o /tmp/pkg.conda",
"cd /tmp && unzip -o pkg.conda",
"cd /tmp && zstd -d pkg-libstdcxx-14.3.0-*.tar.zst -o pkg.tar",
"mkdir -p /tmp/out && tar xf /tmp/pkg.tar -C /tmp/out",
"cp -a /tmp/out/lib/libstdc++.so* /lib64/ && ldconfig",
"pip install uv",
]
manylinux-x86_64-image = "quay.io/pypa/manylinux_2_34_x86_64"
manylinux-aarch64-image = "quay.io/pypa/manylinux_2_34_aarch64"
# Mojo runtime libs use GLIBCXX symbols newer than the manylinux_2_34
# baseline, so auditwheel repair refuses. Since hatch-mojo already bundles
# libs and patches RPATH, we just retag the wheel (same as official mojo pkg).
repair-wheel-command = "pip install wheel && python -m wheel tags --platform-tag manylinux_2_34_$(uname -m) {wheel} && cp $(dirname {wheel})/*manylinux*.whl {dest_dir}/"
[tool.hatch.build.targets.wheel]
packages = ["src/py/mogemma"]
[tool.hatch.build.targets.wheel.hooks.mojo]
# Canonical baseline across local and CI builds.
bundle-libs = true
[[tool.hatch.build.targets.wheel.hooks.mojo.jobs]]
name = "core-x86_64"
arch = ["x86_64", "amd64"]
input = "src/mo/mogemma/core.mojo"
emit = "python-extension"
module = "mogemma._core"
include-dirs = ["src/mo"]
flags = ["--target-cpu", "x86-64-v3"]
[[tool.hatch.build.targets.wheel.hooks.mojo.jobs]]
name = "core-aarch64"
arch = ["aarch64", "arm64"]
input = "src/mo/mogemma/core.mojo"
emit = "python-extension"
module = "mogemma._core"
include-dirs = ["src/mo"]
[tool.pytest.ini_options]
testpaths = ["src/py/tests", "src/mo/tests"]
pythonpath = ["src/py"]
markers = [
"gcs: live-network test against gs://gemma-data; skipped unless MOGEMMA_LIVE_GCS=1",
]
filterwarnings = [
"ignore:builtin type SwigPyPacked has no __module__ attribute:DeprecationWarning",
"ignore:builtin type SwigPyObject has no __module__ attribute:DeprecationWarning",
"ignore:builtin type swigvarlink has no __module__ attribute:DeprecationWarning",
]
[tool.ruff]
exclude = [".venv", "node_modules", "tmp", ".tmp"]
line-length = 120
src = ["src/py/mogemma", "src/py/tests", "src/mo/tests"]
target-version = "py310"
[tool.ruff.format]
docstring-code-format = true
docstring-code-line-length = 60
preview = true
skip-magic-trailing-comma = true
[tool.ruff.lint]
extend-safe-fixes = ["TC"]
fixable = ["ALL"]
ignore = ["COM812"]
select = ["ALL"]
[tool.ruff.lint.pydocstyle]
convention = "google"
[tool.ruff.lint.isort]
known-first-party = ["mogemma", "tests"]
split-on-trailing-comma = false
[tool.ruff.lint.per-file-ignores]
"src/py/tests/test_*.py" = [
"ANN202",
"ARG001",
"D100",
"D101",
"D102",
"D103",
"D107",
"E402",
"ERA001",
"PLR2004",
"PT011",
"S101",
"S105",
"S106",
"S108",
"S110",
"S603",
"SIM105",
"PLC0415",
"SLF001",
]
"src/py/mogemma/typing.py" = ["A005"]
"src/mo/tests/test_*.py" = [
"ARG001",
"D100",
"D101",
"D102",
"D103",
"D107",
"S101",
"S603",
]
[tool.mypy]
exclude = ["tmp/", ".tmp/"]
packages = ["mogemma", "tests"]
python_version = "3.10"
strict = true
warn_unused_ignores = false
[tool.pyright]
include = ["src/py/mogemma", "src/py/tests", "src/mo/tests"]
pythonVersion = "3.10"
venv = ".venv"
[dependency-groups]
dev = [
{ include-group = "lint" },
{ include-group = "test" },
{ include-group = "build" },
]
build = ["bump-my-version>=0.31.1", "mojo>=0.26.1a1"]
lint = ["mypy>=1.13.0", "pyright>=1.1.386", "ruff>=0.14.14"]
test = [
"obstore>=0.5.08",
"pillow>=12.1.1",
"pytest>=9.0.2",
"pytest-cov>=4.0.0",
"pytest-asyncio>=1.3.0",
"tomli>=2.0.0",
]
[tool.bumpversion]
allow_dirty = true
commit = false
commit_args = "--no-verify"
current_version = "0.5.0"
ignore_missing_files = false
ignore_missing_version = false
message = "chore(release): bump to v{new_version}"
parse = """(?x)
(?P<major>\\d+)\\.(?P<minor>\\d+)\\.(?P<patch>\\d+)
(-(?P<pre>alpha|beta|rc)\\.(?P<pre_n>\\d+))?
"""
regex = false
replace = "{new_version}"
search = "{current_version}"
serialize = ["{major}.{minor}.{patch}", "{major}.{minor}.{patch}-{pre}.{pre_n}"]
sign_tags = false
tag = false
tag_message = "chore(release): v{new_version}"
tag_name = "v{new_version}"
[tool.bumpversion.parts.pre]
first_value = "stable"
optional_value = "stable"
values = ["alpha", "beta", "rc", "stable"]
[tool.bumpversion.parts.pre_n]
first_value = "1"
[[tool.bumpversion.files]]
filename = "pyproject.toml"
[tool.cibuildwheel.macos]
repair-wheel-command = ""