From 0a799313f142d9ec886494331acd8c624950c61f Mon Sep 17 00:00:00 2001 From: Steve Piercy Date: Mon, 8 Oct 2018 02:22:22 -0700 Subject: Emphasize the changes to setup.py --- docs/quick_tutorial/debugtoolbar.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'docs/quick_tutorial/debugtoolbar.rst') diff --git a/docs/quick_tutorial/debugtoolbar.rst b/docs/quick_tutorial/debugtoolbar.rst index a13d153d8..dbd93a6cb 100644 --- a/docs/quick_tutorial/debugtoolbar.rst +++ b/docs/quick_tutorial/debugtoolbar.rst @@ -43,7 +43,7 @@ Steps .. literalinclude:: debugtoolbar/setup.py :language: python :linenos: - :emphasize-lines: 5 + :emphasize-lines: 7 #. Install our project and its newly added dependency. -- cgit v1.2.3 From 23fbcac9c35c5f74a1258a72100518fcff3b03e3 Mon Sep 17 00:00:00 2001 From: Steve Piercy Date: Mon, 8 Oct 2018 23:57:55 -0700 Subject: Use correct invocation of `pip install - e ".[dev]"` instead of [testing] --- docs/quick_tutorial/debugtoolbar.rst | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'docs/quick_tutorial/debugtoolbar.rst') diff --git a/docs/quick_tutorial/debugtoolbar.rst b/docs/quick_tutorial/debugtoolbar.rst index dbd93a6cb..1c4d600d1 100644 --- a/docs/quick_tutorial/debugtoolbar.rst +++ b/docs/quick_tutorial/debugtoolbar.rst @@ -102,8 +102,9 @@ temporarily. Extra credit ============ -#. We added ``pyramid_debugtoolbar`` to the list of ``install_requires`` dependencies in ``debugtoolbar/setup.py`` because this tutorial is for development and educational purposes only. - In what cases would you *not* want to add ``pyramid_debugtoolbar`` to your dependencies? +#. We added ``pyramid_debugtoolbar`` to the list of ``dev_requires`` dependencies in ``debugtoolbar/setup.py``. + We then installed the dependencies via ``pip install -e ".[dev]"`` by virtue of the Setuptools ``extras_require`` value in the Python dictionary. + Why did we add them there instead of in the ``requires`` list? #. Introduce a bug into your application. Change: -- cgit v1.2.3 From beeb8ee80c1d0823f965e5826ce3633972904dab Mon Sep 17 00:00:00 2001 From: Steve Piercy Date: Tue, 9 Oct 2018 00:11:51 -0700 Subject: Align emphasize-lines with setup.py code --- docs/quick_tutorial/debugtoolbar.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'docs/quick_tutorial/debugtoolbar.rst') diff --git a/docs/quick_tutorial/debugtoolbar.rst b/docs/quick_tutorial/debugtoolbar.rst index 1c4d600d1..907f3e0b6 100644 --- a/docs/quick_tutorial/debugtoolbar.rst +++ b/docs/quick_tutorial/debugtoolbar.rst @@ -43,7 +43,7 @@ Steps .. literalinclude:: debugtoolbar/setup.py :language: python :linenos: - :emphasize-lines: 7 + :emphasize-lines: 10-16, 20-22 #. Install our project and its newly added dependency. -- cgit v1.2.3 From b15a06346148f6095adf17893490175abc95a494 Mon Sep 17 00:00:00 2001 From: Steve Piercy Date: Tue, 9 Oct 2018 00:14:00 -0700 Subject: Rearrange introduction of Setuptools and move to debugtoolbar. Replace [testing] with [dev]. Make narrative text more descriptive of what is going on with `extras_require` --- docs/quick_tutorial/debugtoolbar.rst | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'docs/quick_tutorial/debugtoolbar.rst') diff --git a/docs/quick_tutorial/debugtoolbar.rst b/docs/quick_tutorial/debugtoolbar.rst index 907f3e0b6..2607c83f2 100644 --- a/docs/quick_tutorial/debugtoolbar.rst +++ b/docs/quick_tutorial/debugtoolbar.rst @@ -38,7 +38,7 @@ Steps cd ..; cp -r ini debugtoolbar; cd debugtoolbar -#. Add ``pyramid_debugtoolbar`` to our project's dependencies in ``setup.py``: +#. Add ``pyramid_debugtoolbar`` to our project's dependencies in ``setup.py`` as a :term:`Setuptools` "extra" for development: .. literalinclude:: debugtoolbar/setup.py :language: python @@ -46,10 +46,11 @@ Steps :emphasize-lines: 10-16, 20-22 #. Install our project and its newly added dependency. + Note that we use the extra specifier ``[dev]`` to install development requirements and surround it and the period with double quote marks. .. code-block:: bash - $VENV/bin/pip install -e . + $VENV/bin/pip install -e ".[dev]" #. Our ``debugtoolbar/development.ini`` gets a configuration entry for ``pyramid.includes``: @@ -96,6 +97,11 @@ experience otherwise inexplicable client-side weirdness, you can shut it off by commenting out the ``pyramid_debugtoolbar`` line in ``pyramid.includes`` temporarily. +Finally we've introduced the concept of :term:`Setuptools` extras. +These are optional or recommended features that may be installed with an "extras" specifier, in this case, ``dev``. +The specifier is the name of a key in a Python dictionary, and is surrounded by square brackets when invoked on the command line, for example, . +The value for the key is a Python list of dependencies. + .. seealso:: See also :ref:`pyramid_debugtoolbar `. -- cgit v1.2.3