-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathsetup.py
More file actions
136 lines (108 loc) · 3.87 KB
/
setup.py
File metadata and controls
136 lines (108 loc) · 3.87 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
from setuptools import setup, find_packages
import pathlib
import subprocess
import distutils.cmd
# current directory
here = pathlib.Path(__file__).parent.resolve()
version_file = here / "VERSION"
# Get the long description from the README file
long_description = (here / "README.md").read_text(encoding="utf-8")
def format_git_describe_version(version):
if "-" in version:
splitted = version.split("-")
tag = splitted[0]
index = f"dev{splitted[1]}"
return f"{tag}.{index}"
else:
return version
def get_version_from_git():
try:
process = subprocess.run(
["git", "describe"], cwd=str(here), check=True, capture_output=True
)
version = process.stdout.decode("utf-8").strip()
version = format_git_describe_version(version)
with version_file.open("w") as f:
f.write(version)
return version
except subprocess.CalledProcessError:
if version_file.exists():
return version_file.read_text().strip()
else:
return "0.1.0"
version = get_version_from_git()
print(f"Detected version {version} from git describe")
class GetVersionCommand(distutils.cmd.Command):
"""A custom command to get the current project version inferred from git describe."""
description = "gets the project version from git describe"
user_options = []
def initialize_options(self):
pass
def finalize_options(self):
pass
def run(self):
print(version)
class DownloadDatasets(distutils.cmd.Command):
"""A custom command to download the datasets used in the examples."""
description = "downloads the datasets used in the examples"
user_options = []
def initialize_options(self):
pass
def finalize_options(self):
pass
def run(self):
import psyki
try:
from test.resources.data import DATASETS
for dataset in DATASETS:
dataset.download()
except ImportError:
psyki.logger.log("Cannot import test.resources.data.DATASETS.")
setup(
name="psyki", # Required
version=version,
description="Python-based implementation of PSyKI, i.e. a Platform for Symbolic Knowledge Injection",
license="Apache 2.0 License",
long_description=long_description,
long_description_content_type="text/markdown",
url="https://github.com/psykei/psyki-python",
author="Matteo Magnini",
author_email="matteo.magnini@unibo.it",
classifiers=[
"Development Status :: 3 - Alpha",
"Intended Audience :: Developers",
"Topic :: Software Development :: Libraries",
"Topic :: Scientific/Engineering :: Artificial Intelligence",
"License :: OSI Approved :: Apache Software License",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Prolog",
],
keywords="symbolic knowledge injection, ski, symbolic ai", # Optional
# package_dir={'': 'src'}, # Optional
packages=find_packages(), # Required
include_package_data=True,
python_requires=">=3.12",
install_requires=[
"tensorflow>=2.14.1,<2.15.0",
"numpy>=1.22.3",
"2ppy>=0.4.1",
"scikit-learn>=1.0.2",
"pandas>=1.4.2",
"codecarbon>=2.2.4,<2.3.0",
"prometheus_client>=0.21.0",
], # Optional
zip_safe=False,
platforms="Independant",
project_urls={ # Optional
"Bug Reports": "https://github.com/psykei/psyki-python/issues",
# 'Funding': 'https://donate.pypi.org',
# 'Say Thanks!': 'http://saythanks.io/to/example',
"Source": "https://github.com/psykei/psyki-python",
},
cmdclass={
"get_project_version": GetVersionCommand,
"download_datasets": DownloadDatasets,
},
)