Use extras_require instead of dev-requirements.txt (#318)
* Use extras_require instead of dev-requirements.txt * Better phrasing * Make names reflects dir names, add docs Keep docs-requirements.txt for now, but the plan is to get rid of it. * Explain docs building
This commit is contained in:
parent
3cffdfa3dd
commit
c601faf994
|
@ -151,34 +151,33 @@ We highly recommend to develop using the latest Python 3 release because ``attrs
|
|||
First create a `virtual environment <https://virtualenv.pypa.io/>`_.
|
||||
It’s out of scope for this document to list all the ways to manage virtual environments in Python but if you don’t have already a pet way, take some time to look at tools like `pew <https://github.com/berdario/pew>`_, `virtualfish <http://virtualfish.readthedocs.io/>`_, and `virtualenvwrapper <http://virtualenvwrapper.readthedocs.io/>`_.
|
||||
|
||||
Next get an up to date checkout of the ``attrs`` repository:
|
||||
Next, get an up to date checkout of the ``attrs`` repository:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
git checkout git@github.com:python-attrs/attrs.git
|
||||
$ git checkout git@github.com:python-attrs/attrs.git
|
||||
|
||||
Change into the newly created directory and **after activating your virtual environment** install an editable version of ``attrs``:
|
||||
Change into the newly created directory and **after activating your virtual environment** install an editable version of ``attrs`` along with its tests and docs requirements:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
cd attrs
|
||||
pip install -e .
|
||||
|
||||
If you run the virtual environment’s Python and try to ``import attr`` it should work!
|
||||
|
||||
To run the test suite, you'll need our development dependencies which can be installed using
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
pip install -r dev-requirements.txt
|
||||
$ cd attrs
|
||||
$ pip install -e .[dev]
|
||||
|
||||
At this point
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
python -m pytest
|
||||
$ python -m pytest
|
||||
|
||||
should work and pass!
|
||||
should work and pass, as should:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
$ cd docs
|
||||
$ make html
|
||||
|
||||
The built documentation can then be found in ``docs/_build/html/``.
|
||||
|
||||
|
||||
Governance
|
||||
|
@ -205,7 +204,7 @@ Thank you for considering contributing to ``attrs``!
|
|||
.. _`PEP 8`: https://www.python.org/dev/peps/pep-0008/
|
||||
.. _`PEP 257`: https://www.python.org/dev/peps/pep-0257/
|
||||
.. _`good test docstrings`: https://jml.io/pages/test-docstrings.html
|
||||
.. _`Code of Conduct`: https://github.com/python-attrs/attrs/blob/master/CODE_OF_CONDUCT.rst
|
||||
.. _`Code of Conduct`: https://github.com/python-attrs/attrs/blob/master/.github/CODE_OF_CONDUCT.rst
|
||||
.. _changelog: https://github.com/python-attrs/attrs/blob/master/CHANGELOG.rst
|
||||
.. _`backward compatibility`: http://www.attrs.org/en/latest/backward-compatibility.html
|
||||
.. _tox: https://tox.readthedocs.io/
|
||||
|
|
|
@ -4,7 +4,7 @@ include LICENSE *.rst *.toml
|
|||
exclude .github/*.md .travis.yml
|
||||
|
||||
# Tests
|
||||
include tox.ini .coveragerc conftest.py dev-requirements.txt docs-requirements.txt
|
||||
include tox.ini .coveragerc conftest.py docs-requirements.txt
|
||||
recursive-include tests *.py
|
||||
recursive-include .github *.rst
|
||||
|
||||
|
|
|
@ -1,6 +0,0 @@
|
|||
coverage
|
||||
hypothesis
|
||||
pympler
|
||||
pytest
|
||||
six
|
||||
zope.interface
|
|
@ -1,3 +1 @@
|
|||
-e .
|
||||
sphinx
|
||||
zope.interface
|
||||
-e .[docs]
|
||||
|
|
16
setup.py
16
setup.py
|
@ -29,6 +29,21 @@ CLASSIFIERS = [
|
|||
"Topic :: Software Development :: Libraries :: Python Modules",
|
||||
]
|
||||
INSTALL_REQUIRES = []
|
||||
EXTRAS_REQUIRE = {
|
||||
"docs": [
|
||||
"sphinx",
|
||||
"zope.interface",
|
||||
],
|
||||
"tests": [
|
||||
"coverage",
|
||||
"hypothesis",
|
||||
"pympler",
|
||||
"pytest",
|
||||
"six",
|
||||
"zope.interface",
|
||||
],
|
||||
}
|
||||
EXTRAS_REQUIRE["dev"] = EXTRAS_REQUIRE["tests"] + EXTRAS_REQUIRE["docs"]
|
||||
|
||||
###############################################################################
|
||||
|
||||
|
@ -92,4 +107,5 @@ if __name__ == "__main__":
|
|||
zip_safe=False,
|
||||
classifiers=CLASSIFIERS,
|
||||
install_requires=INSTALL_REQUIRES,
|
||||
extras_require=EXTRAS_REQUIRE,
|
||||
)
|
||||
|
|
12
tox.ini
12
tox.ini
|
@ -7,17 +7,17 @@ envlist = isort,py27,py34,py35,py36,pypy,pypy3,flake8,manifest,docs,readme,chang
|
|||
# https://github.com/pypa/setuptools/issues/1042 from breaking our builds.
|
||||
setenv =
|
||||
VIRTUALENV_NO_DOWNLOAD=1
|
||||
deps = -rdev-requirements.txt
|
||||
deps = .[tests]
|
||||
commands = python -m pytest {posargs}
|
||||
|
||||
|
||||
[testenv:py27]
|
||||
deps = -rdev-requirements.txt
|
||||
deps = .[tests]
|
||||
commands = coverage run --parallel -m pytest {posargs}
|
||||
|
||||
|
||||
[testenv:py36]
|
||||
deps = -rdev-requirements.txt
|
||||
deps = .[tests]
|
||||
commands = coverage run --parallel -m pytest {posargs}
|
||||
|
||||
|
||||
|
@ -35,7 +35,7 @@ commands =
|
|||
basepython = python3.6
|
||||
# Needs a full install so isort can determine own/foreign imports.
|
||||
deps =
|
||||
-rdev-requirements.txt
|
||||
.[tests]
|
||||
flake8
|
||||
flake8-isort
|
||||
commands = flake8 src tests setup.py conftest.py docs/conf.py
|
||||
|
@ -45,7 +45,7 @@ commands = flake8 src tests setup.py conftest.py docs/conf.py
|
|||
basepython = python3.6
|
||||
# Needs a full install so isort can determine own/foreign imports.
|
||||
deps =
|
||||
-rdev-requirements.txt
|
||||
.[tests]
|
||||
isort
|
||||
commands =
|
||||
isort --recursive setup.py conftest.py src tests
|
||||
|
@ -55,7 +55,7 @@ commands =
|
|||
basepython = python3.6
|
||||
setenv =
|
||||
PYTHONHASHSEED = 0
|
||||
deps = -rdocs-requirements.txt
|
||||
deps = .[docs]
|
||||
commands =
|
||||
sphinx-build -W -b html -d {envtmpdir}/doctrees docs docs/_build/html
|
||||
sphinx-build -W -b doctest -d {envtmpdir}/doctrees docs docs/_build/html
|
||||
|
|
Loading…
Reference in New Issue