Skip to content

Commit 164eb11

Browse files
committed
Update __version__ import in discordanalytics/client.py and added setup file
1 parent 0ecf0b3 commit 164eb11

3 files changed

Lines changed: 55 additions & 3 deletions

File tree

discordanalytics/client.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,7 @@
55
import requests
66
import sys
77

8-
# from .__init__ import __version__
9-
10-
__version__ = "0.0.1"
8+
from .__init__ import __version__
119

1210
class ApiEndpoints:
1311
BASE_URL = "https://discordanalytics.xyz/api"

requirements.txt

116 Bytes
Binary file not shown.

setup.py

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
from setuptools import setup
2+
import re
3+
4+
requirements = []
5+
with open('requirements.txt') as f:
6+
requirements = f.read().splitlines()
7+
8+
version = ''
9+
with open('discordanalytics/__init__.py') as f:
10+
version = re.search(r'^__version__\s*=\s*[\'"]([^\'"]*)[\'"]', f.read(), re.MULTILINE).group(1)
11+
12+
if not version:
13+
raise RuntimeError('version is not set')
14+
15+
if version.endswith(('a', 'b', 'rc')):
16+
try:
17+
import subprocess
18+
p = subprocess.Popen(['git', 'rev-list', '--count', 'HEAD'], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
19+
out, err = p.communicate()
20+
if out:
21+
version += out.decode('utf-8').strip()
22+
p = subprocess.Popen(['git', 'rev-parse', '--short', 'HEAD'], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
23+
out, err = p.communicate()
24+
if out:
25+
version += '+g' + out.decode('utf-8').strip()
26+
except Exception:
27+
pass
28+
29+
readme = ''
30+
with open('README.md') as f:
31+
readme = f.read()
32+
33+
packages = [
34+
'discordanalytics'
35+
]
36+
37+
setup(
38+
name='discordanalytics',
39+
author='ValDesign',
40+
url='https://github.com/DiscordAnalytics/python-package',
41+
project_urls={
42+
'Documentation': 'https://docs.discordanalytics.xyz',
43+
'Issue tracker': 'https://github.com/DiscordAnalytics/python-package/issues'
44+
},
45+
version=version,
46+
packages=packages,
47+
license='MIT',
48+
description='A Python package for interacting with Discord Analytics API',
49+
long_description=readme,
50+
long_description_content_type='text/markdown',
51+
include_package_data=True,
52+
install_requires=requirements,
53+
python_requires='>=3.8.0'
54+
)

0 commit comments

Comments
 (0)