-
Notifications
You must be signed in to change notification settings - Fork 4
/
setup.py
135 lines (103 loc) · 3.96 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
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
import os
import sys
from pathlib import Path
from shutil import rmtree
from typing import List, Tuple
from setuptools import Command, find_packages, setup
# -----------------------------------------------------------------------------
DESCRIPTION = "Python DB-API and SQLAlchemy interface for GraphQL APIs."
VERSION = "0.0.1.dev5"
# -----------------------------------------------------------------------------
# read the contents of your README file
this_directory = Path(__file__).parent
long_description = (this_directory / "README.md").read_text()
long_description_content_type = "text/markdown; charset=UTF-8; variant=GFM"
dist_directory = (this_directory / "dist").absolute()
# -----------------------------------------------------------------------------
class BaseCommand(Command):
user_options: List[Tuple[str, str, str]] = []
@staticmethod
def status(s: str) -> None:
"""Prints things in bold."""
print("\033[1m{0}\033[0m".format(s)) # noqa: T201
def system(self, command: str) -> None:
os.system(command) # noqa: S605
def initialize_options(self):
pass
def finalize_options(self):
pass
class BuildCommand(BaseCommand):
"""Support setup.py building."""
description = "Build the package."
def run(self):
try:
self.status("Removing previous builds…")
rmtree(dist_directory)
except OSError:
pass
self.status("Building Source and Wheel (universal) distribution…")
self.system("{0} -m build --sdist --wheel .".format(sys.executable))
self.status("Checking wheel contents…")
self.system("check-wheel-contents dist/*.whl")
self.status("Running twine check…")
self.system("{0} -m twine check dist/*".format(sys.executable))
class UploadTestCommand(BaseCommand):
"""Support uploading to test PyPI."""
description = "Upload the package to the test PyPI."
def run(self):
self.status("Uploading the package to PyPi via Twine…")
self.system(
"twine upload --repository-url https://test.pypi.org/legacy/ dist/*"
)
class UploadCommand(BaseCommand):
"""Support uploading to PyPI."""
description = "Upload the package to PyPI."
def run(self):
self.status("Uploading the package to PyPi via Twine…")
self.system("twine upload dist/*")
self.status("Pushing git tags…")
self.system("git tag v{0}".format(VERSION))
self.system("git push --tags")
# -----------------------------------------------------------------------------
setup(
name="sqlalchemy-graphqlapi",
version=VERSION,
description=DESCRIPTION,
long_description=long_description,
long_description_content_type=long_description_content_type,
author="Alex Rothberg",
author_email="[email protected]",
url="https://github.com/cancan101/graphql-db-api",
packages=find_packages(exclude=("tests",)),
entry_points={
"sqlalchemy.dialects": [
"graphql = graphqldb.dialect:APSWGraphQLDialect",
],
"shillelagh.adapter": [
"graphql = graphqldb.adapter:GraphQLAdapter",
],
},
install_requires=(
"shillelagh >= 1.2.0",
"requests >= 2.31.0",
),
license="MIT",
classifiers=[
# Trove classifiers
# Full list: https://pypi.python.org/pypi?%3Aaction=list_classifiers
"Development Status :: 2 - Pre-Alpha",
"License :: OSI Approved :: MIT License",
"Programming Language :: Python",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: Implementation :: CPython",
],
# $ setup.py publish support.
cmdclass={
"buildit": BuildCommand,
"uploadtest": UploadTestCommand,
"upload": UploadCommand,
},
)