-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.py
More file actions
106 lines (94 loc) · 3.33 KB
/
setup.py
File metadata and controls
106 lines (94 loc) · 3.33 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
import os
import sys
from distutils.command.build import build as build_
from glob import glob as glob # glob
from setuptools import find_packages, setup
from setuptools.extension import Extension
sys.path.append("pelutils")
from __version__ import __version__
requirements = [
"numpy>=1.21.0",
"gitpython>=3.1.0",
"rich>=10.0.0",
"python-rapidjson>=1.5",
"py-cpuinfo>=8.0.0",
"psutil>=5.8.0",
"matplotlib>=3.3",
"scipy>=1.6",
"tqdm>=4.55",
"deprecated>=1.2",
]
requirements_dev = [
"torch>=2",
"pytest==8.4.2",
"pytest-cov==7.0.0",
"coveralls>=4.0.0",
"coverage==7.10.7",
"wheel",
"setuptools>=60.0.0",
"ruff==0.14.14",
"freezegun>=1.5",
]
with open("README.md") as readme_file:
README = readme_file.read()
c_files = list()
for root, __, files in os.walk("pelutils/_c"):
c_files += [os.path.join(root, f) for f in files if f.endswith(".c")]
class CExtension(Extension):
"""See this thread for details: https://stackoverflow.com/a/34830639/13196863."""
class build(build_): # noqa: D101
def build_extension(self, ext): # noqa: D102
self._ctypes = isinstance(ext, CExtension)
return super().build_extension(ext)
def get_export_symbols(self, ext): # noqa: D102
if self._ctypes:
return ext.export_symbols
return super().get_export_symbols(ext)
def get_ext_filename(self, ext_name): # noqa: D102
if self._ctypes:
return ext_name + '.so'
return super().get_ext_filename(ext_name)
setup_args = dict(
name = "pelutils",
version = __version__,
description = "The Swiss army knife of Python projects.",
long_description_content_type = "text/markdown",
long_description = README,
license = "MIT",
packages = find_packages(),
author = "Asger Laurits Schultz, Søren Winkel Holm",
author_email = "asger.s@protonmail.com, swholm@protonmail.com",
keywords = [ "utility", "logger", "parser", "profiling", "plotting" ],
url = "https://github.com/peleiden/pelutils",
download_url = "https://pypi.org/project/pelutils/",
install_requires = [ requirements ],
extras_require = { "dev": requirements_dev },
entry_points = { "console_scripts": [
"linecounter = pelutils._entry_points.linecounter:run",
"pelexamples = examples.cli:run",
] },
cmdclass = { "build": build },
ext_modules = [
CExtension(
name = "_pelutils_c",
sources = c_files,
extra_compile_args = ["-DMS_WIN64"],
)
],
license_files = [ os.path.join("pelutils", "_c", "hashmap.c", "LICENSE") ],
python_requires = ">=3.9",
classifiers = [
"Intended Audience :: Developers",
"Operating System :: OS Independent",
"Programming Language :: Python",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.9",
"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",
],
)
if __name__ == "__main__":
setup(**setup_args)