Skip to content

Commit

Permalink
refactor requirements.txt
Browse files Browse the repository at this point in the history
  • Loading branch information
Cuizi7 committed Dec 12, 2018
1 parent ce24c2d commit 0d304b8
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 47 deletions.
8 changes: 0 additions & 8 deletions requirements-py2.txt

This file was deleted.

2 changes: 0 additions & 2 deletions requirements-py34.txt

This file was deleted.

46 changes: 29 additions & 17 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,19 +1,31 @@
requests
numpy>=1.11.1
pandas>=0.18.1
python-dateutil>=2.5.3
pytz>=2016.4
six>=1.10.0
pytest>=2.9.2
logbook>=1.0.0
click>=7.0
bcolz>=1.1.0
matplotlib>=1.5.1
jsonpickle==0.9.4
simplejson>=3.10.0
dill==0.2.5
XlsxWriter>=0.9.6
line-profiler>=2.0
PyYAML>=3.12

numpy >=1.11.1
python-dateutil >=2.5.3
pytz >=2016.4
six >=1.10.0
pytest >=2.9.2
logbook >=1.0.0
click >=7.0
jsonpickle ==0.9.4
simplejson >=3.10.0
dill ==0.2.5
XlsxWriter >=0.9.6
line-profiler >=2.0
PyYAML >=3.12
tabulate

pandas >=0.18.1 ; python_version != '3.4'
pandas >=0.18.1,<=0.22.0 ; python_version == '3.4'

bcolz >=1.1.0 ; python_version != '3.4'
bcolz >=1.1.0,<=1.2.0 ; python_version =='3.4'

matplotlib >=1.5.1 ; python_version >= '3.5'
matplotlib >=1.5.1,<=2.2.3 ; python_version <= '3.4'

ipython ==5.3.0 ; python_version == '2.7'
enum34 >=1.1.6 ; python_version == '2.7'
fastcache >=1.0.2 ; python_version == '2.7'
funcsigs ; python_version == '2.7'
backports.tempfile ; python_version == '2.7'
mock ; python_version == '2.7'
24 changes: 4 additions & 20 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,35 +15,19 @@
# See the License for the specific language governing permissions and
# limitations under the License.

import platform
from os.path import dirname, join
try:
from pip._internal.req import parse_requirements
except ImportError:
from pip.req import parse_requirements

from setuptools import find_packages, setup


def update_requirements(from_reqs, to_reqs):
from_req_dict = {req.name: req for req in from_reqs}
from_req_dict.update({req.name: req for req in to_reqs})
return from_req_dict.values()
def read_file(file):
with open(file, "rt") as f:
return f.read()


with open(join(dirname(__file__), 'rqalpha/VERSION.txt'), 'rb') as f:
version = f.read().decode('ascii').strip()

requirements = parse_requirements("requirements.txt", session=False)

python_version = platform.python_version()
if python_version.startswith("2"):
requirements = update_requirements(requirements, parse_requirements("requirements-py2.txt", session=False))
elif python_version.startswith("3.4"):
requirements = update_requirements(requirements, parse_requirements("requirements-py34.txt", session=False))

req_strs = [str(ir.req) for ir in requirements]


setup(
name='rqalpha',
Expand All @@ -55,7 +39,7 @@ def update_requirements(from_reqs, to_reqs):
license='Apache License v2',
package_data={'': ['*.*']},
url='https://github.com/ricequant/rqalpha',
install_requires=req_strs,
install_requires=read_file("requirements.txt").strip(),
zip_safe=False,
entry_points={
"console_scripts": [
Expand Down

0 comments on commit 0d304b8

Please sign in to comment.