forked from amogorkon/justuse
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
executable file
·94 lines (85 loc) · 2.54 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
import os
from pathlib import Path
from setuptools import find_packages, setup
here = os.path.abspath(os.path.dirname(__file__))
src = os.path.join(here, "src/use")
# Instead of doing the obvious thing (importing 'use' directly and just reading '__version__'),
# we are parsing the version out of the source AST here, because if the user is missing any
# dependencies at setup time, an import error would prevent the installation.
# Two simple ways to verify the installation using this setup.py file:
#
# python3 setup.py develop
#
# or:
#
# python3 setup.py install
#
import ast
with open(os.path.join(src, "__init__.py")) as f:
mod = ast.parse(f.read())
version = [
t
for t in [*filter(lambda n: isinstance(n, ast.Assign), mod.body)]
if t.targets[0].id == "__version__"
][0].value.value
meta = {
"name": "justuse",
"license": "MIT",
"url": "https://github.com/amogorkon/justuse",
"version": version,
"author": "Anselm Kiefner",
"author_email": "[email protected]",
"python_requires": ">=3.10",
"keywords": [
"installing",
"packages",
"hot reload",
"auto install",
"aspect oriented",
"version checking",
"functional",
],
"classifiers": [
"Development Status :: 4 - Beta",
"Intended Audience :: Developers",
"Natural Language :: English",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
"Programming Language :: Python :: 3 :: Only",
],
"extras_require": {"test": ["pytest", "pytest-cov", "pytest-env"]},
"fullname": "justuse",
"dist_files": ["pytest.ini", "tests/pytest.ini"],
"description": "a pure-python alternative to import",
"maintainer_email": "[email protected]",
"maintainer": "Anselm Kiefner",
"platforms": ["any"],
"download_url": "https://github.com/amogorkon/justuse/" "archive/refs/heads/main.zip",
}
requires = (
"beartype( >= 0.8.1)",
"furl(>= 2.1.2)",
"icontract(>= 2.5.4)",
"jinja2",
"packaging(== 21.0)",
"pip",
"pydantic(>= 1.8.2)",
"requests",
"wheel",
)
LONG_DESCRIPTION = Path("README.md").read_text()
setup(
packages=find_packages(where="src"),
package_dir={
"": "src",
},
package_name="use",
include_package_data=True,
long_description=LONG_DESCRIPTION,
long_description_content_type="text/markdown",
requires=requires,
install_requires=requires,
setup_requires=requires,
zip_safe=True,
**meta
)