Skip to content

Commit 6a77a0e

Browse files
committed
Fixed requirements handling:
Moved dependencies on packages into setup.py and added version pins in requirements.txt files. Also re-ordered the way travis installs: First we install using requirements.txt (and thus get the desired versions) then we install using `pip install -e .` which should not install any new packages. See: https://packaging.python.org/discussions/install-requires-vs-requirements/ for current best practises regarding dependency handling.
1 parent b2e439a commit 6a77a0e

File tree

4 files changed

+25
-19
lines changed

4 files changed

+25
-19
lines changed

.travis.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,9 @@ before_install:
1616
- if [[ $TRAVIS_PYTHON_VERSION == '3.2' ]]; then pip install 'coverage<4.0.0'; fi
1717
- pip install codecov
1818
install:
19-
- pip install -e .
19+
- pip install -r requirements.txt
2020
- pip install -r requirements_dev.txt
21+
- pip install -e .
2122
script:
2223
- python setup.py test
2324
after_success:
@@ -29,4 +30,4 @@ deploy:
2930
secure: iZWZuDMIWyFtJf5cLDPwA82d7DVi+/8yBQJVowctJwkioz4PEZBrf4N7cKyFc7JlhsS0/gqPJ9nw1FBqHwlTFwikpCYjudcfVijzibwKBbTbYTbTY1xEYiv+2/Q2UGoGjGmf2qdqM9SBaQwvax+KgMO6e4I4vrX4cm3kMx4LHt0Z2ArORlhZ0oKxyi6azcFiZYwlOlp31PuV0iNpBkroBf+gQ20S35hD+GIm1U6D4zqkN0HmZ0LxlpZLXsHZ0FrEE57KU06RowWfkAFBkGjMBjr+phiZ/XRe88SFaiB3HVZaJm+ZPTJKnxryuGt5th54Q10DKLZ3KUien33saBYVziamHZ8ZYS01ztahEhqLKlQVB1e+p1M8mYXKVodqLgytOsddixIBmibq2rDJmLSPwro8RBwLhLdGZdRsH2kii06OQxPrzlUrOwtErozxvdNjS47hwjJ4ZVm4ZGcnOXZut4qwkiEEUMWUd54V+zDNnRxOf+hi/mEx3u8CmkV26XFJ7WHpr/E1T9XHuRh7YVP8MXrM3gjoL86g1swalpH/QBjf0UaF2BlTvWJ3j52uThH7MFUlCBgpYer1giJayyNjFw4+qUVMCyByD87V7x6/3glA7t4Kh0LiMq0Zo23PPbhuJOmJmDy6GTtjkXZEJ6XnNPV9+VR8LApmppevBDKafgA=
3031
distributions: sdist bdist_wheel
3132
on:
32-
tags: true
33+
tags: true

requirements.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
jsonschema
2-
pyaml
3-
six
1+
jsonschema==2.6.0
2+
pyaml==17.12.1
3+
six==1.11.0

requirements_dev.txt

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
mock
2-
pytest
3-
pytest-pep8
4-
pytest-flakes
5-
pytest-cov
6-
tox
1+
mock==2.0.0
2+
pytest==3.5.0
3+
pytest-pep8==1.0.6
4+
pytest-flakes==2.0.0
5+
pytest-cov==2.5.1
6+
tox==3.0.0rc4

setup.py

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,6 @@
77
from setuptools.command.test import test as TestCommand
88

99

10-
def read_requirements(filename):
11-
"""Open a requirements file and return list of its lines."""
12-
contents = read_file(filename).strip('\n')
13-
return contents.split('\n') if contents else []
14-
15-
1610
def read_file(filename):
1711
"""Open and a file, read it and return its contents."""
1812
path = os.path.join(os.path.dirname(__file__), filename)
@@ -67,8 +61,19 @@ def run_tests(self):
6761
],
6862
},
6963
include_package_data=True,
70-
install_requires=read_requirements('requirements.txt'),
71-
tests_require=read_requirements('requirements_dev.txt'),
64+
install_requires=[
65+
"jsonschema",
66+
"pyaml",
67+
"six",
68+
],
69+
tests_require=[
70+
"mock",
71+
"pytest",
72+
"pytest-pep8",
73+
"pytest-flakes",
74+
"pytest-cov",
75+
"tox",
76+
],
7277
cmdclass={'test': PyTest},
7378
classifiers=[
7479
"Development Status :: 4 - Beta",

0 commit comments

Comments
 (0)