-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathsetup.py
106 lines (90 loc) · 3.34 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
105
106
import sys
import os
import pathlib
from setuptools.command.develop import develop
from setuptools.command.install import install
from setuptools.command.sdist import sdist
from setuptools import setup, find_packages
from subprocess import check_call
if sys.version_info < (3, 0):
sys.exit(
"""
######################################
# Python 3 is needed #
######################################
"""
)
_version = "0.6.0-1"
HERE = pathlib.Path(__file__).parent
# USING SUBMODULE https://oak-tree.tech/blog/python-packaging-primer
def gitcmd_update_submodules():
''' Check if the package is being deployed as a git repository. If so, recursively
update all dependencies.
@returns True if the package is a git repository and the modules were updated.
False otherwise.
'''
if os.path.exists(os.path.join(HERE, '.git')):
check_call(['git', 'submodule', 'update', '--init', '--recursive'])
return True
return False
class gitcmd_develop(develop):
''' Specialized packaging class that runs git submodule update --init --recursive
as part of the update/install procedure.
'''
def run(self):
gitcmd_update_submodules()
develop.run(self)
class gitcmd_install(install):
''' Specialized packaging class that runs git submodule update --init --recursive
as part of the update/install procedure.
'''
def run(self):
gitcmd_update_submodules()
install.run(self)
class gitcmd_sdist(sdist):
''' Specialized packaging class that runs git submodule update --init --recursive
as part of the update/install procedure;.
'''
def run(self):
gitcmd_update_submodules()
sdist.run(self)
## INSTALLING ADDITIONAL FILES
# https://docs.python.org/3/distutils/setupscript.html#installing-package-data
# https://python-packaging.readthedocs.io/en/latest/non-code-files.html
# print("TO COPY", find_packages("src", exclude=["*.tests", "*.tests.*", "tests.*", "tests"]))
setup(
cmdclass={
'develop': gitcmd_develop,
'install': gitcmd_install,
'sdist': gitcmd_sdist,
},
name="navabilitysdk",
version=_version,
license="Apache-2.0",
author="NavAbility",
author_email="[email protected]",
packages=find_packages("src", exclude=["*.tests", "*.tests.*", "tests.*", "tests"]),
package_dir={"": "src"},
package_data={"sdkCommonGQL": ["*.toml",],},
# data_files=[('sdkCommonGQL',['*.toml',]),],
include_package_data=True,
# entry_points={"console_scripts": ["navability = navability.main:cli"]},
python_requires=">=3.8",
download_url=f"https://github.com/NavAbility/NavAbilitySDK.py/archive/refs/tags/v{_version}.tar.gz", # noqa: E501, B950
long_description="""NavAbility SDK: Access NavAbility Cloud factor graph features from Python.
Note that this SDK and the related API are in beta. Please let us know if you have any issues at [email protected].""",
install_requires=[
"click==8.0.2",
"gql[all]==3.0.0a6",
"ipython==8.2.0",
"marshmallow==3.14.0",
"numpy>=1.21",
"nest-asyncio>=1.5",
# Dev/test dependencies
"black==22.3.0", # REF: https://github.com/psf/black/issues/2634
"flake8==4.0.1",
"pytest==6.2.5",
"pytest-asyncio==0.18.1",
"pyyaml==6.0",
],
)