diff --git a/.travis.yml b/.travis.yml index 1787f61..405a1cc 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,11 +12,7 @@ matrix: allow_failures: - python: "nightly" install: - - pip install --upgrade coveralls pytest "pytest-cov>=2.5.1" dataclasses typing_extensions - # mypy can't be installed on pypy - - if [[ "${TRAVIS_PYTHON_VERSION}" != "pypy"* ]] ; then pip install mypy ; fi - # Black is Python 3.6+-only - - if [[ "${TRAVIS_PYTHON_VERSION}" != "pypy"* ]] ; then pip install black ; fi + - pip install --upgrade -r requirements.txt -r requirements-dev.txt script: - py.test -vv --cov=injector --cov-branch --cov-report html --cov-report term - if [[ "${TRAVIS_PYTHON_VERSION}" != "pypy"* ]] ; then mypy injector ; fi diff --git a/requirements-dev.txt b/requirements-dev.txt new file mode 100644 index 0000000..953188b --- /dev/null +++ b/requirements-dev.txt @@ -0,0 +1,6 @@ +pytest +coveralls +pytest-cov>=2.5.1 +dataclasses;python_version<"3.7" +mypy;implementation_name=="cpython" +black;implementation_name=="cpython" diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..bcc17af --- /dev/null +++ b/requirements.txt @@ -0,0 +1 @@ +typing_extensions>=3.7.4;python_version<"3.9" diff --git a/setup.py b/setup.py index f80f299..68ec6a7 100644 --- a/setup.py +++ b/setup.py @@ -6,6 +6,13 @@ import warnings warnings.filterwarnings("always", module=__name__) +def obtain_requirements(file_name): + with open(file_name) as fd_in: + for line in fd_in: + if '#' not in line: + yield line.strip() + + class PyTest(Command): user_options = [] @@ -34,6 +41,11 @@ def read_injector_variable(name): version = read_injector_variable('__version__') version_tag = read_injector_variable('__version_tag__') + +requirements = list(obtain_requirements('requirements.txt')) +requirements_dev = list(obtain_requirements('requirements-dev.txt')) + + try: import pypandoc @@ -61,6 +73,7 @@ setup( author='Alec Thomas', author_email='alec@swapoff.org', cmdclass={'test': PyTest}, + extras_require={'dev': requirements_dev}, keywords=[ 'Dependency Injection', 'DI', @@ -69,5 +82,5 @@ setup( 'IoC', 'Inversion of Control container', ], - install_requires=['typing_extensions>=3.7.4;python_version<"3.9"'], + install_requires=requirements, )