From a79bec16b7c00f7dd4940b5753e5b7726583dac9 Mon Sep 17 00:00:00 2001 From: Bryan Cooley Date: Mon, 10 Feb 2020 14:35:51 -0800 Subject: [PATCH 1/2] (Issue-840) First pass at reorganizing requirements files. --- hug/json_module.py | 2 +- requirements/build_common.txt | 5 +---- requirements/build_windows.txt | 8 +++++--- requirements/development.txt | 18 +++++++++--------- requirements/marshmallow2.txt | 1 + requirements/marshmallow3.txt | 1 + requirements/test.txt | 4 ++++ tox.ini | 29 +++++++++++++++++++---------- 8 files changed, 41 insertions(+), 27 deletions(-) create mode 100644 requirements/marshmallow2.txt create mode 100644 requirements/marshmallow3.txt create mode 100644 requirements/test.txt diff --git a/hug/json_module.py b/hug/json_module.py index f881f7f8..5db3ed85 100644 --- a/hug/json_module.py +++ b/hug/json_module.py @@ -1,6 +1,6 @@ import os -HUG_USE_UJSON = bool(os.environ.get("HUG_USE_UJSON", 1)) +HUG_USE_UJSON = os.environ.get("HUG_USE_UJSON", "false").lower() == 'true' try: # pragma: no cover if HUG_USE_UJSON: import ujson as json diff --git a/requirements/build_common.txt b/requirements/build_common.txt index a312c6de..42f25d29 100644 --- a/requirements/build_common.txt +++ b/requirements/build_common.txt @@ -1,9 +1,6 @@ -r common.txt +-r test.txt flake8==3.5.0 -pytest-cov==2.7.1 -pytest==4.6.3 -python-coveralls==2.9.2 wheel==0.33.4 PyJWT==1.7.1 -pytest-xdist==1.29.0 numpy<1.16 diff --git a/requirements/build_windows.txt b/requirements/build_windows.txt index a67127df..f63ec90d 100644 --- a/requirements/build_windows.txt +++ b/requirements/build_windows.txt @@ -1,8 +1,10 @@ -r common.txt flake8==3.7.7 isort==4.3.20 -marshmallow==2.18.1 -pytest==4.6.3 wheel==0.33.4 -pytest-xdist==1.29.0 numpy==1.15.4 + +pytest==4.6.3 +pytest-xdist==1.29.0 + +marshmallow==2.18.1 diff --git a/requirements/development.txt b/requirements/development.txt index 4142d01c..43fb9ba0 100644 --- a/requirements/development.txt +++ b/requirements/development.txt @@ -1,16 +1,16 @@ bumpversion==0.5.3 Cython==0.29.10 + -r common.txt -flake8==3.7.7 -ipython==7.5.0 -isort==4.3.20 -pytest-cov==2.7.1 -pytest==4.6.3 -python-coveralls==2.9.2 +-r test.txt tox==3.12.1 +flake8==3.7.7 wheel -pytest-xdist==1.29.0 -marshmallow==2.18.1 -ujson==1.35 numpy<1.16 +marshmallow==2.18.1 + +isort==4.3.20 + +ipython==7.5.0 +ujson==1.35 diff --git a/requirements/marshmallow2.txt b/requirements/marshmallow2.txt new file mode 100644 index 00000000..c343e156 --- /dev/null +++ b/requirements/marshmallow2.txt @@ -0,0 +1 @@ +marshmallow<3.0 diff --git a/requirements/marshmallow3.txt b/requirements/marshmallow3.txt new file mode 100644 index 00000000..341df9c3 --- /dev/null +++ b/requirements/marshmallow3.txt @@ -0,0 +1 @@ +marshmallow==3.0.0rc6 diff --git a/requirements/test.txt b/requirements/test.txt new file mode 100644 index 00000000..0f37bfa0 --- /dev/null +++ b/requirements/test.txt @@ -0,0 +1,4 @@ +pytest==4.6.3 +pytest-cov==2.7.1 +pytest-xdist==1.29.0 +python-coveralls==2.9.2 diff --git a/tox.ini b/tox.ini index 62d638e2..f82a9636 100644 --- a/tox.ini +++ b/tox.ini @@ -4,8 +4,17 @@ envlist=py{35,36,37,38,py3}-marshmallow{2,3}, cython-marshmallow{2,3} [testenv] deps= -rrequirements/build_common.txt - marshmallow2: marshmallow <3.0 - marshmallow3: marshmallow==3.0.0rc6 + marshmallow2: -rrequirements/marshmallow2.txt + marshmallow3: -rrequirements/marshmallow3.txt + +whitelist_externals=flake8 +commands=py.test --durations 3 --cov-report html --cov hug -n auto tests + +[testdevelopment] +deps= + -rrequirements/development.txt + marshmallow2: -rrequirements/marshmallow2.txt + marshmallow3: -rrequirements/marshmallow3.txt whitelist_externals=flake8 commands=py.test --durations 3 --cov-report html --cov hug -n auto tests @@ -13,7 +22,7 @@ commands=py.test --durations 3 --cov-report html --cov hug -n auto tests [testenv:py37-black] deps= -rrequirements/build_style_tools.txt - marshmallow==3.0.0rc6 + -rrequirements/marshmallow3.txt whitelist_externals=flake8 commands=black --check --verbose -l 100 hug @@ -21,7 +30,7 @@ commands=black --check --verbose -l 100 hug [testenv:py37-vulture] deps= -rrequirements/build_style_tools.txt - marshmallow==3.0.0rc6 + -rrequirements/marshmallow3.txt whitelist_externals=flake8 commands=vulture hug --min-confidence 100 --ignore-names req_succeeded @@ -30,7 +39,7 @@ commands=vulture hug --min-confidence 100 --ignore-names req_succeeded [testenv:py37-flake8] deps= -rrequirements/build_style_tools.txt - marshmallow==3.0.0rc6 + -rrequirements/marshmallow3.txt whitelist_externals=flake8 commands=flake8 hug @@ -38,7 +47,7 @@ commands=flake8 hug [testenv:py37-bandit] deps= -rrequirements/build_style_tools.txt - marshmallow==3.0.0rc6 + -rrequirements/marshmallow3.txt whitelist_externals=flake8 commands=bandit -r hug/ -ll @@ -46,7 +55,7 @@ commands=bandit -r hug/ -ll [testenv:py37-isort] deps= -rrequirements/build_style_tools.txt - marshmallow==3.0.0rc6 + -rrequirements/marshmallow3.txt whitelist_externals=flake8 commands=isort -c --diff --recursive hug @@ -54,7 +63,7 @@ commands=isort -c --diff --recursive hug [testenv:py37-safety] deps= -rrequirements/build_style_tools.txt - marshmallow==3.0.0rc6 + -rrequirements/marshmallow3.txt whitelist_externals=flake8 commands=safety check -i 36810 @@ -65,5 +74,5 @@ basepython = {env:PYTHON:}\python.exe commands=py.test hug -n auto tests [testenv:cython] -deps=Cython - -rrequirements/build.txt +deps=-rrequirements/build.txt + Cython From 60b7509bc3005cecd86e65aa912ae8a29942b90e Mon Sep 17 00:00:00 2001 From: Bryan Cooley Date: Tue, 18 Feb 2020 09:16:07 -0800 Subject: [PATCH 2/2] (Issue-840) PR feedback: remove blank lines in requirements files. --- hug/json_module.py | 2 +- requirements/build_windows.txt | 4 +--- requirements/development.txt | 6 +----- 3 files changed, 3 insertions(+), 9 deletions(-) diff --git a/hug/json_module.py b/hug/json_module.py index 5db3ed85..c1176c6b 100644 --- a/hug/json_module.py +++ b/hug/json_module.py @@ -1,6 +1,6 @@ import os -HUG_USE_UJSON = os.environ.get("HUG_USE_UJSON", "false").lower() == 'true' +HUG_USE_UJSON = os.environ.get("HUG_USE_UJSON", "false").lower() == "true" try: # pragma: no cover if HUG_USE_UJSON: import ujson as json diff --git a/requirements/build_windows.txt b/requirements/build_windows.txt index f63ec90d..c936225c 100644 --- a/requirements/build_windows.txt +++ b/requirements/build_windows.txt @@ -3,8 +3,6 @@ flake8==3.7.7 isort==4.3.20 wheel==0.33.4 numpy==1.15.4 - +marshmallow==2.18.1 pytest==4.6.3 pytest-xdist==1.29.0 - -marshmallow==2.18.1 diff --git a/requirements/development.txt b/requirements/development.txt index 43fb9ba0..50e0e8c8 100644 --- a/requirements/development.txt +++ b/requirements/development.txt @@ -1,16 +1,12 @@ bumpversion==0.5.3 Cython==0.29.10 - -r common.txt -r test.txt tox==3.12.1 flake8==3.7.7 +isort==4.3.20 wheel numpy<1.16 - marshmallow==2.18.1 - -isort==4.3.20 - ipython==7.5.0 ujson==1.35