Skip to content

Commit

Permalink
Use extras_require instead of dev-requirements.txt (python-attrs#318)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
hynek authored and Tinche committed Dec 29, 2017
1 parent 3cffdfa commit c601faf
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 29 deletions.
25 changes: 12 additions & 13 deletions .github/CONTRIBUTING.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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 [email protected]:python-attrs/attrs.git
$ git checkout [email protected]: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 .
$ cd attrs
$ pip install -e .[dev]
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
At this point

.. code-block:: bash
pip install -r dev-requirements.txt
$ python -m pytest
At this point
should work and pass, as should:

.. code-block:: bash
python -m pytest
$ cd docs
$ make html
should work and pass!
The built documentation can then be found in ``docs/_build/html/``.


Governance
Expand All @@ -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/
Expand Down
2 changes: 1 addition & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
6 changes: 0 additions & 6 deletions dev-requirements.txt

This file was deleted.

4 changes: 1 addition & 3 deletions docs-requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
-e .
sphinx
zope.interface
-e .[docs]
16 changes: 16 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,21 @@
"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"]

###############################################################################

Expand Down Expand Up @@ -92,4 +107,5 @@ def find_meta(meta):
zip_safe=False,
classifiers=CLASSIFIERS,
install_requires=INSTALL_REQUIRES,
extras_require=EXTRAS_REQUIRE,
)
12 changes: 6 additions & 6 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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}


Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down

0 comments on commit c601faf

Please sign in to comment.