From 78cf9e7ad2b025d631023921385091eccc13ca2a Mon Sep 17 00:00:00 2001 From: Brian Rutledge Date: Sat, 12 Jun 2021 11:59:20 -0400 Subject: [PATCH] Add testenv:dev to create development environment --- docs/contributing.rst | 35 +++++++++++++++++------------------ tox.ini | 15 +++++++++++++++ 2 files changed, 32 insertions(+), 18 deletions(-) diff --git a/docs/contributing.rst b/docs/contributing.rst index e74d9559..bc94a62f 100644 --- a/docs/contributing.rst +++ b/docs/contributing.rst @@ -11,36 +11,35 @@ mailing list`_, to ask questions or get involved. Getting started --------------- -We recommend you use a `virtual environment`_, so that twine and its -dependencies do not interfere with other packages installed on your -machine. - -Clone the twine repository from GitHub, then make and activate a -virtual environment that uses Python 3.6 or newer as the default -Python. For example: +We use `tox`_ to run tests, check code style, and build the documentation. +To install ``tox``, run: .. code-block:: console - cd /path/to/your/local/twine - python3.6 -m venv venv - source venv/bin/activate + python3 -m pip install tox -Then, run the following commands: +Clone the twine repository from GitHub, then run: .. code-block:: console - pip install -U pip - pip install -e . + cd /path/to/your/local/twine + tox -e dev -Now, in your virtual environment, ``twine`` is pointing at your local copy, so -when you make changes, you can easily see their effect. +This creates a `virtual environment`_, so that twine and its +dependencies do not interfere with other packages installed on your +machine. In the virtual environment, ``twine`` is pointing at your +local copy, so when you make changes, you can easily see their effect. -We use `tox`_ to run tests, check code style, and build the documentation. -To install ``tox`` in your active virtual environment, run: +The virtual environment also contains the tools for running tests +and checking code style, so you can run them on single files directly or +in your code editor. However, we still encourage using the ``tox`` commands +below on the whole codebase. + +To use the virtual environment, run: .. code-block:: console - pip install tox + source venv/bin/activate Building the documentation ^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tox.ini b/tox.ini index bdafe485..5ef7ee40 100644 --- a/tox.ini +++ b/tox.ini @@ -102,6 +102,21 @@ commands = python -m build python -m twine upload dist/* +[testenv:dev] +envdir = {posargs:venv} +recreate = True +deps = + {[testenv]deps} + {[testenv:integration]deps} + {[testenv:format]deps} + {[testenv:lint]deps} + {[testenv:types]deps} +download = True +usedevelop = True +commands = + python -c 'import sys; print(sys.executable)' + python --version + [testenv:devpi] deps = devpi-server