Add requirements.txt and requirements-dev.txt (#172)

This commit is contained in:
Greg Eremeev 2021-01-06 03:56:00 +03:00 committed by GitHub
parent 94e5b175d7
commit dcc9e6772a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 22 additions and 6 deletions

View File

@ -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

6
requirements-dev.txt Normal file
View File

@ -0,0 +1,6 @@
pytest
coveralls
pytest-cov>=2.5.1
dataclasses;python_version<"3.7"
mypy;implementation_name=="cpython"
black;implementation_name=="cpython"

1
requirements.txt Normal file
View File

@ -0,0 +1 @@
typing_extensions>=3.7.4;python_version<"3.9"

View File

@ -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,
)