Skip to content

Commit

Permalink
Refactor requirements (#407)
Browse files Browse the repository at this point in the history
* Refactor requirements

* Removing requirements files

* Adjust reqs

* Adjust tox

* remove requirements

* Remove redundant requirements/docs.txt files

* Remove deprecate extras and redundancy in testenv deps

* Restore jsonschema min version

* Fix tox testenv:min

* Move optional dependencies into extra[monitoring] for backwards compatibility

* Fix incorrect coverage file being uploaded to codecov

---------

Co-authored-by: mauricio.barg <>
Co-authored-by: Víctor Ruiz <victorruiz@zyte.com>
  • Loading branch information
mrwbarg and VMRuiz authored Aug 31, 2023
1 parent 37c8a3a commit fe4e100
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 53 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@ jobs:
run: |
python -m pip install --upgrade pip
pip install tox codecov
- name: Run tests
- name: Run base tests
run: tox -e base
- name: Run all test
run: tox -e ${{ matrix.tox || 'py' }}
- name: Run docs and formatting tests
if: ${{ matrix.python-version == 3.11 }}
Expand Down
3 changes: 3 additions & 0 deletions docs/requirements-docs.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
sphinx
sphinx-rtd-theme
s3cmd
2 changes: 0 additions & 2 deletions requirements-docs.txt

This file was deleted.

17 changes: 0 additions & 17 deletions requirements.txt

This file was deleted.

3 changes: 0 additions & 3 deletions requirements/docs.txt

This file was deleted.

39 changes: 12 additions & 27 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,21 +1,5 @@
from setuptools import find_packages, setup

test_requirements = [
"pytest>=2.7.0",
"pytest-cov",
"pytest-mock",
"jinja2",
"boto3",
"lxml",
"premailer",
"scrapinghub",
"scrapinghub-entrypoint-scrapy",
"scrapy",
"slack-sdk",
"twisted>=19.7.0",
"itemadapter",
]

setup(
name="spidermon",
version="1.19.0",
Expand All @@ -29,24 +13,25 @@
package_data={"spidermon": ["VERSION"]},
zip_safe=False,
include_package_data=True,
install_requires=["jsonschema[format]>=3.2.0", "python-slugify"],
tests_require=test_requirements,
install_requires=[
"jsonschema[format]>=3.2.0",
"python-slugify",
],
extras_require={
# Specific monitors and tools to support notifications and reports
"monitoring": [
"scrapy",
"Jinja2",
"scrapinghub",
"slack-sdk",
"boto",
"boto3",
"itemadapter",
"premailer",
"sentry-sdk",
],
# Tools to run the tests
"tests": test_requirements,
# Tools to build and publish the documentation
"docs": ["sphinx", "sphinx-rtd-theme", "s3cmd"],
"requests",
"scrapinghub",
"scrapinghub-entrypoint-scrapy",
"scrapy",
"sentry_sdk",
"slack_sdk",
]
},
classifiers=[
"Development Status :: 5 - Production/Stable",
Expand Down
18 changes: 15 additions & 3 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,31 @@ envlist = min,py39,py310,py311
skip_missing_interpreters = True

[testenv]
deps =
pytest
pytest-cov
pytest-mock
extras =
tests
validation
monitoring
commands = pytest -s --cov=spidermon --cov-report= {posargs:tests}

[testenv:base]
deps =
{[testenv]deps}
scrapy
Jinja2
commands = pytest -s --ignore=./tests/contrib --ignore=./tests/utils/test_zyte.py {posargs:tests}

[testenv:min]
basepython = python3.8
deps =
{[testenv]deps}
jsonschema[format]==3.2.0

[testenv:docs]
deps =
-r {toxinidir}/docs/requirements-docs.txt
changedir = docs
extras = docs
commands =
sphinx-build -nW -b html source/ {envtmpdir}/html
sphinx-build -W -b linkcheck source/ {envtmpdir}/linkcheck

0 comments on commit fe4e100

Please sign in to comment.