Skip to content

Commit 297cf33

Browse files
committed
Get rid of the duplicate Python package dependency specifications
1 parent 093dd6b commit 297cf33

File tree

3 files changed

+51
-31
lines changed

3 files changed

+51
-31
lines changed

.readthedocs.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# .readthedocs.yml
2+
# Read the Docs configuration file
3+
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
4+
5+
# Required
6+
version: 2
7+
8+
# Build documentation in the docs/ directory with Sphinx
9+
sphinx:
10+
configuration: docs/conf.py
11+
12+
# Build documentation with MkDocs
13+
#mkdocs:
14+
# configuration: mkdocs.yml
15+
16+
# Optionally build your docs in additional formats such as PDF and ePub
17+
formats: all
18+
19+
# Optionally set the version of Python and requirements required to build your docs
20+
python:
21+
version: 3.6
22+
install:
23+
- requirements: requirements.txt
Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,23 @@
11
wikipedia==1.4.0
22
PyUserInput==0.1.11
33
tinydb==3.9.0.post1
4+
youtube_dl
5+
spacy==2.1.3
46
pyowm==2.9.0
57
tensorflow==1.15.0
6-
tqdm
8+
deepspeech==0.4.1
79
requests>=2.20.0
8-
lxml==4.2.1
910
nltk
1011
httplib2>=0.9.1
1112
tweepy==3.7.0
1213
metadata_parser==0.9.20
1314
hug==2.4.0
1415
hug-middleware-cors==1.0.0
1516
waitress==1.1.0
17+
SpeechRecognition
18+
pyjwt==1.6.4
1619
SQLAlchemy>=1.3.0
1720
PyMySQL==0.8.1
18-
m2r
21+
msgpack==0.5.6
22+
neuralcoref==4.0
1923
deeppavlov==0.7.1

setup.py

Lines changed: 21 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
from os import path
1616
from subprocess import PIPE, Popen
1717

18-
here = path.abspath(path.dirname(__file__))
18+
__location__ = path.abspath(path.dirname(__file__))
1919

2020

2121
def pkgconfig(*packages):
@@ -54,8 +54,24 @@ def pkgconfig(*packages):
5454
return config
5555

5656

57+
def read_requirements():
58+
"""parses requirements from requirements.txt"""
59+
reqs_path = path.join(__location__, 'requirements.txt')
60+
with open(reqs_path, encoding='utf8') as f:
61+
reqs = [line.strip() for line in f if not line.strip().startswith('#')]
62+
63+
names = []
64+
links = []
65+
for req in reqs:
66+
if '://' in req:
67+
links.append(req)
68+
else:
69+
names.append(req)
70+
return {'install_requires': names, 'dependency_links': links}
71+
72+
5773
# Get the long description from the README file
58-
with open(path.join(here, 'README.md'), encoding='utf-8') as f:
74+
with open(path.join(__location__, 'README.md'), encoding='utf-8') as f:
5975
long_description = f.read()
6076

6177
setup(
@@ -120,31 +136,7 @@ def pkgconfig(*packages):
120136
# your project is installed. For an analysis of "install_requires" vs pip's
121137
# requirements files see:
122138
# https://packaging.python.org/en/latest/requirements.html
123-
install_requires=[
124-
'wikipedia==1.4.0',
125-
'PyUserInput==0.1.11',
126-
'tinydb==3.9.0.post1',
127-
'youtube_dl',
128-
'spacy==2.1.3',
129-
'pyowm==2.9.0',
130-
'tensorflow==1.15.0',
131-
'deepspeech==0.4.1',
132-
'requests>=2.20.0',
133-
'nltk',
134-
'httplib2>=0.9.1',
135-
'tweepy==3.7.0',
136-
'metadata_parser==0.9.20',
137-
'hug==2.4.0',
138-
'hug-middleware-cors==1.0.0',
139-
'waitress==1.1.0',
140-
'SpeechRecognition',
141-
'pyjwt==1.6.4',
142-
'SQLAlchemy>=1.3.0',
143-
'PyMySQL==0.8.1',
144-
'msgpack==0.5.6',
145-
'neuralcoref==4.0',
146-
'deeppavlov==0.7.1'
147-
],
139+
**read_requirements(),
148140

149141
# List additional groups of dependencies here (e.g. development
150142
# dependencies). You can install these using the following syntax,
@@ -190,4 +182,5 @@ def pkgconfig(*packages):
190182
ext_modules=[
191183
Extension('realhud', ['dragonfire/realhud/realhud.c'],
192184
**pkgconfig('gtk+-2.0 x11 xext'))
193-
])
185+
]
186+
)

0 commit comments

Comments
 (0)