-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathpyproject.toml
More file actions
170 lines (158 loc) · 5.88 KB
/
Copy pathpyproject.toml
File metadata and controls
170 lines (158 loc) · 5.88 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
[tool.althaia]
upstream_version = "4.3.0"
[project]
name = "althaia"
version = "4.3.0"
requires-python = ">=3.10,<4.0"
description = "Marshmallow fork optimized for dumping speed."
authors = [
{ name = "Dusko Simidzija", email = "dusko.simidzija@gmail.com" },
]
maintainers = [
{ name = "Dusko Simidzija", email = "dusko.simidzija@gmail.com" },
]
homepage = "https://dsimidzija.github.io"
repository = "https://github.com/dsimidzija/python-althaia"
license = "MIT"
readme = "README.md"
keywords = [
"serialization",
"rest",
"json",
"api",
"marshal",
"marshalling",
"deserialization",
"validation",
"schema",
]
classifiers = [
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Developers",
"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",
]
packages = [
{ include = 'althaia/**/*.py' },
]
include = [
{ path = "README.md" },
{ path = "althaia/**/*.py" },
{ path = "althaia/**/*.so", format = "wheel" },
{ path = "althaia/**/*.pyd", format = "wheel" },
]
exclude = [
"**/.gitignore",
"althaia/**/*.orig",
"althaia/**/*.rej",
"upstream",
]
# facepalm: poetry ignores these in the project section...
# TODO: migrate to uv
[tool.poetry]
packages = [
{ include = 'althaia/**/*.py' },
]
include = [
{ path = "README.md" },
{ path = "althaia/**/*.py" },
{ path = "althaia/**/*.so", format = "wheel" },
{ path = "althaia/**/*.pyd", format = "wheel" },
]
exclude = [
"**/.gitignore",
"althaia/**/*.orig",
"althaia/**/*.rej",
"upstream",
]
[tool.poetry.group.dev.dependencies]
cython = "3.2.4"
dsi-utils = {git = "https://github.com/dsimidzija/python-dsi-utils.git", rev = "master"}
pep440 = "^0.1.0"
taskipy = "^1.9.0"
toml = "^0.10.2"
twine = "^3.7.1"
# everything below is needed by upstream marshmallow tests
pytest = "*"
simplejson = "*"
[tool.poetry.build]
script = "builder.py"
generate-setup-file = false
[build-system]
requires = [
"Cython==3.2.4",
"poetry",
"poetry_core>=1.0.0",
"setuptools>=83",
]
build-backend = "poetry.core.masonry.api"
[tool.pytest.ini_options]
minversion = "6.0"
testpaths = [
"tests",
]
[tool.taskipy.tasks]
version-check = { cmd = "./scripts/version_check.sh" }
build = { cmd = "task upstream-reset && task build-wheel", help = "Full build, resets upstream submodule, applies patches, builds wheel." }
build-wheel = { cmd = "poetry build --format wheel", help = "Build a python wheel using the current state of the repo." }
build-sdist = { cmd = "poetry build --format sdist", help = "Build a sdist package using the current state of the repo." }
clean = { cmd = "rm -rf ./althaia/marshmallow/*.so", help = "Clean compiled modules." }
inspect = { cmd = "unzip -l 'dist/*.whl'", help = "List the content of all wheels in dist/ folder." }
upstream-performance = { cmd = "./scripts/upstream_performance.sh", help = "Run upstream marshmallow performance benchmark on top of Althaia." }
upstream-reset = { cmd = "./scripts/upstream_reset.sh", help = "Reset upstream submodule to the version defined in pyproject.toml." }
upstream-test = { cmd = "./scripts/upstream_test.sh", help = "Run upstream marshmallow tests on top of Althaia to check if we're 100% compatible." }
publish-test = { cmd = "twine upload --skip-existing --repository testpypi dist/*.whl", help = "Publishing dry-run to test PyPI."}
[tool.cibuildwheel]
build-frontend = "build"
build-verbosity = 3
# before-build is necessary, but I'm not sure why, as
# cibuildwheel is not picking up cython from `build-system.requires`
before-build = "python -m pip install cython==3.2.4"
manylinux-x86_64-image = "manylinux_2_28"
musllinux-x86_64-image = "musllinux_1_2"
test-command = [
"mkdir -p /tmp/tests",
"cp {project}/upstream/tests/*.py /tmp/tests",
"cd /tmp",
"echo 'import althaia; althaia.patch()'>>tests/__init__.py",
"pytest tests",
"rm -rf /tmp/tests",
]
test-requires = [
"poetry",
"pytest",
"pytz",
"tzdata", # fixes Windows tests, as Windows apparently doesn't have an IANA database
"simplejson",
"taskipy",
]
[tool.cibuildwheel.linux]
# 2023-07-27: cargo is needed because installing rpds-py fails on alpine
# installing cargo with apk installs a *very* old version or rust/cargo, which fails later
before-all = "scripts/build_alpine_install_rust.sh"
environment = { LDFLAGS = "-Wl,--strip-debug" }
[tool.cibuildwheel.windows]
# "-Wl,-S" is equivalent to gcc's "-Wl,--strip-debug"
environment = { LDFLAGS = "-Wl,-S" }
# https://github.com/marshmallow-code/marshmallow/issues/2999
# test_from_timestamp_with_overflow_value is deselected on Windows because it mysteriously gives a different message
# for the same exception being thrown:
# E AssertionError: Regex pattern did not match.
# E Expected regex: 'out of range|year must be in 1\\.\\.9999'
# E Actual message: 'Error converting value to datetime'
test-command = [
"mkdir %TEMP%\\althaia\\tests",
"xcopy {project}\\upstream\\tests\\*.py %TEMP%\\althaia\\tests",
"cd %TEMP%\\althaia",
"python -c \"fin = open(\\\"tests\\conftest.py\\\", \\\"r\\\"); cont = fin.read(); fin.close(); cont = cont.replace(\\\"import pytest\\\", \\\"import althaia;althaia.patch();import pytest\\\"); fout = open(\\\"tests\\conftest.py\\\", \\\"w\\\"); fout.write(cont); fout.close();\"",
"pytest tests -k \"not test_from_timestamp_with_overflow_value\"",
]
# if things break in the pipeline, this is a way of inspecting the wheel before the repair step
#[[tool.cibuildwheel.overrides]]
#select = "*"
#inherit.repair-wheel-command = "prepend"
#repair-wheel-command = "echo 'Before repair' && pwd && ls -l {dest_dir} && ls -l /tmp/cibuildwheel/built_wheel && unzip -l '/tmp/cibuildwheel/built_wheel/*.whl'"