forked from jcrist/msgspec
-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.py
104 lines (92 loc) · 3.32 KB
/
setup.py
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
import sys
import os
from setuptools import setup
from setuptools.extension import Extension
import versioneer
# Check for 32-bit windows builds, which currently aren't supported. We can't
# rely on `platform.architecture` here since users can still run 32-bit python
# builds on 64 bit architectures.
if sys.platform == "win32" and sys.maxsize == (2**31 - 1):
import textwrap
error = """
====================================================================
`msgspec` currently doesn't support 32-bit Python windows builds. If
this is important for your use case, please open an issue on GitHub:
https://github.com/jcrist/msgspec/issues
====================================================================
"""
print(textwrap.dedent(error))
exit(1)
SANITIZE = os.environ.get("MSGSPEC_SANITIZE", False)
COVERAGE = os.environ.get("MSGSPEC_COVERAGE", False)
DEBUG = os.environ.get("MSGSPEC_DEBUG", SANITIZE or COVERAGE)
extra_compile_args = []
extra_link_args = []
if SANITIZE:
extra_compile_args.extend(["-fsanitize=address", "-fsanitize=undefined"])
extra_link_args.extend(["-lasan", "-lubsan"])
if COVERAGE:
extra_compile_args.append("--coverage")
extra_link_args.append("-lgcov")
if DEBUG:
extra_compile_args.extend(["-O0", "-g", "-UNDEBUG"])
ext_modules = [
Extension(
"msgspec._core",
[os.path.join("msgspec", "_core.c")],
extra_compile_args=extra_compile_args,
extra_link_args=extra_link_args,
)
]
yaml_deps = ["pyyaml"]
toml_deps = ['tomli ; python_version < "3.11"', "tomli_w"]
doc_deps = ["sphinx", "furo", "sphinx-copybutton", "sphinx-design", "ipython"]
test_deps = ["pytest", "mypy", "pyright", "msgpack", "attrs", *yaml_deps, *toml_deps]
dev_deps = ["pre-commit", "coverage", "gcovr", *doc_deps, *test_deps]
extras_require = {
"yaml": yaml_deps,
"toml": toml_deps,
"doc": doc_deps,
"test": test_deps,
"dev": dev_deps,
}
setup(
name="msgspec",
version=versioneer.get_version(),
cmdclass=versioneer.get_cmdclass(),
maintainer="Jim Crist-Harif",
maintainer_email="[email protected]",
url="https://jcristharif.com/msgspec/",
project_urls={
"Documentation": "https://jcristharif.com/msgspec/",
"Source": "https://github.com/jcrist/msgspec/",
"Issue Tracker": "https://github.com/jcrist/msgspec/issues",
},
description=(
"A fast serialization and validation library, with builtin support for "
"JSON, MessagePack, YAML, and TOML."
),
keywords="JSON msgpack MessagePack TOML YAML serialization validation schema",
classifiers=[
"License :: OSI Approved :: BSD License",
"Development Status :: 4 - Beta",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
],
extras_require=extras_require,
license="BSD",
packages=["msgspec"],
package_data={"msgspec": ["py.typed", "*.pyi"]},
ext_modules=ext_modules,
long_description=(
open("README.md", encoding="utf-8").read()
if os.path.exists("README.md")
else ""
),
long_description_content_type="text/markdown",
python_requires=">=3.8",
zip_safe=False,
)