Skip to content

Commit

Permalink
Make optional dependencies more granular for tests/docs/builds; add r…
Browse files Browse the repository at this point in the history
…eadthedocs config file to ensure correct Sphinx version
  • Loading branch information
JWCook committed Jun 16, 2020
1 parent 91d3531 commit 511b116
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 25 deletions.
18 changes: 18 additions & 0 deletions .readthedocs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Read the Docs configuration file
version: 2

sphinx:
builder: html
configuration: docs/conf.py

formats:
- pdf

python:
version: 3.7
system_packages: True
install:
- method: pip
path: .
extra_requirements:
- docs
30 changes: 14 additions & 16 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,24 @@
#!/usr/bin/env python
from itertools import chain
from sys import version_info
from setuptools import setup, find_packages
from pyinaturalist import __version__

# Only install the typing backport if we're on python < 3.5
backports = ["typing>=3.7.4"] if version_info < (3, 5) else []

# These package categories allow tox and build environments to install only what they need
extras_require = {
# Packages used for CI jobs
"build": ["coveralls", "tox-travis"],
# Packages used for documentation builds
"docs": ["Sphinx>=3.0", "sphinx-rtd-theme", "sphinxcontrib-apidoc"],
# Packages used for testing both locally and in CI jobs
"test": ["black", "flake8", "mypy", "pytest", "pytest-cov", "requests-mock>=1.7", "tox"],
}
# All development/testing packages combined
extras_require["dev"] = list(chain.from_iterable(extras_require.values()))


setup(
name="pyinaturalist",
Expand All @@ -16,21 +29,6 @@
packages=find_packages(),
include_package_data=True,
install_requires=["python-dateutil>=2.0", "requests>=2.21.0"] + backports,
extras_require={
"dev": [
"black",
"flake8",
"mypy",
"pytest",
"pytest-cov",
"requests-mock>=1.7",
"Sphinx>=3.0",
"sphinx-rtd-theme",
"sphinxcontrib-apidoc",
"tox",
],
# Additional packages used only within CI jobs
"build": ["coveralls", "tox-travis"],
},
extras_require=extras_require,
zip_safe=False,
)
17 changes: 8 additions & 9 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,8 @@ envlist =
[testenv]
setenv =
PYTHONPATH = {toxinidir}/pyinaturalist
extras = dev
commands =
pytest --basetemp={envtmpdir}
extras = test
commands = pytest --basetemp={envtmpdir}
whitelist_externals =
printf
make
Expand Down Expand Up @@ -46,17 +45,17 @@ deps =
extras =

[testenv:docs]
commands =
make -C docs all
extras =
test
docs
commands = make -C docs all

[testenv:lint]
commands =
python setup.py flake8
commands = python setup.py flake8

# Build and check distributions without deploying, just to make sure they can build correctly
[testenv:dist-test]
deps =
twine
deps = twine
commands =
python setup.py sdist bdist_wheel
twine check dist/*
Expand Down

0 comments on commit 511b116

Please sign in to comment.