Permalink
Browse files

Merge pull request #3380 from stevepiercy/docs-quick-tutorial-update

Revise Quick Tutorial `setup.py`s
  • Loading branch information...
stevepiercy committed Oct 9, 2018
2 parents 045951c + b15a063 commit 05915720f97df868e0b7dcff6e9b8eed964b8a90
Showing with 544 additions and 369 deletions.
  1. +1 −1 docs/quick_tutorial/authentication.rst
  2. +23 −14 docs/quick_tutorial/authentication/setup.py
  3. +23 −14 docs/quick_tutorial/authorization/setup.py
  4. +1 −1 docs/quick_tutorial/databases.rst
  5. +26 −16 docs/quick_tutorial/databases/setup.py
  6. +12 −5 docs/quick_tutorial/debugtoolbar.rst
  7. +21 −8 docs/quick_tutorial/debugtoolbar/setup.py
  8. +1 −1 docs/quick_tutorial/forms.rst
  9. +23 −14 docs/quick_tutorial/forms/setup.py
  10. +3 −3 docs/quick_tutorial/functional_testing.rst
  11. +23 −14 docs/quick_tutorial/functional_testing/setup.py
  12. +24 −25 docs/quick_tutorial/ini.rst
  13. +11 −7 docs/quick_tutorial/ini/setup.py
  14. +1 −1 docs/quick_tutorial/jinja2.rst
  15. +23 −14 docs/quick_tutorial/jinja2/setup.py
  16. +23 −14 docs/quick_tutorial/json/setup.py
  17. +23 −14 docs/quick_tutorial/logging/setup.py
  18. +23 −14 docs/quick_tutorial/more_view_classes/setup.py
  19. +6 −3 docs/quick_tutorial/package/setup.py
  20. +23 −14 docs/quick_tutorial/request_response/setup.py
  21. +10 −6 docs/quick_tutorial/retail_forms/setup.py
  22. +23 −14 docs/quick_tutorial/routing/setup.py
  23. +23 −14 docs/quick_tutorial/sessions/setup.py
  24. +23 −14 docs/quick_tutorial/static_assets/setup.py
  25. +34 −37 docs/quick_tutorial/templating.rst
  26. +23 −14 docs/quick_tutorial/templating/setup.py
  27. +4 −2 docs/quick_tutorial/tutorial_approach.rst
  28. +3 −8 docs/quick_tutorial/unit_testing.rst
  29. +22 −13 docs/quick_tutorial/unit_testing/setup.py
  30. +19 −22 docs/quick_tutorial/view_classes.rst
  31. +23 −14 docs/quick_tutorial/view_classes/setup.py
  32. +23 −14 docs/quick_tutorial/views/setup.py
@@ -39,7 +39,7 @@ Steps
.. literalinclude:: authentication/setup.py
:language: python
:emphasize-lines: 4
:emphasize-lines: 6
:linenos:
#. We can now install our project in development mode:
@@ -1,23 +1,32 @@
from setuptools import setup
# List of dependencies installed via `pip install -e .`
# by virtue of the Setuptools `install_requires` value below.
requires = [
'bcrypt',
'pyramid',
'pyramid_chameleon',
'pyramid_debugtoolbar',
'waitress',
]
setup(name='tutorial',
install_requires=requires,
extras_require={
'test': [
'pytest',
'webtest',
],
},
entry_points="""\
[paste.app_factory]
main = tutorial:main
""",
)
# List of dependencies installed via `pip install -e ".[dev]"`
# by virtue of the Setuptools `extras_require` value in the Python
# dictionary below.
dev_requires = [
'pyramid_debugtoolbar',
'pytest',
'webtest',
]
setup(
name='tutorial',
install_requires=requires,
extras_require={
'dev': dev_requires,
},
entry_points={
'paste.app_factory': [
'main = tutorial:main'
],
},
)
@@ -1,23 +1,32 @@
from setuptools import setup
# List of dependencies installed via `pip install -e .`
# by virtue of the Setuptools `install_requires` value below.
requires = [
'bcrypt',
'pyramid',
'pyramid_chameleon',
'pyramid_debugtoolbar',
'waitress',
]
setup(name='tutorial',
install_requires=requires,
extras_require={
'test': [
'pytest',
'webtest',
],
},
entry_points="""\
[paste.app_factory]
main = tutorial:main
""",
)
# List of dependencies installed via `pip install -e ".[dev]"`
# by virtue of the Setuptools `extras_require` value in the Python
# dictionary below.
dev_requires = [
'pyramid_debugtoolbar',
'pytest',
'webtest',
]
setup(
name='tutorial',
install_requires=requires,
extras_require={
'dev': dev_requires,
},
entry_points={
'paste.app_factory': [
'main = tutorial:main'
],
},
)
@@ -51,7 +51,7 @@ Steps
.. literalinclude:: databases/setup.py
:linenos:
:emphasize-lines: 8-9, 11, 25-26
:emphasize-lines: 9-10, 12, 34-36
.. note:: We aren't yet doing ``$VENV/bin/pip install -e .`` because we need to write a script and update configuration first.
@@ -1,28 +1,38 @@
from setuptools import setup
# List of dependencies installed via `pip install -e .`
# by virtue of the Setuptools `install_requires` value below.
requires = [
'deform',
'pyramid',
'pyramid_chameleon',
'pyramid_debugtoolbar',
'pyramid_tm',
'sqlalchemy',
'waitress',
'zope.sqlalchemy',
]
setup(name='tutorial',
install_requires=requires,
extras_require={
'test': [
'pytest',
'webtest',
],
},
entry_points="""\
[paste.app_factory]
main = tutorial:main
[console_scripts]
initialize_tutorial_db = tutorial.initialize_db:main
""",
)
# List of dependencies installed via `pip install -e ".[dev]"`
# by virtue of the Setuptools `extras_require` value in the Python
# dictionary below.
dev_requires = [
'pyramid_debugtoolbar',
'pytest',
'webtest',
]
setup(
name='tutorial',
install_requires=requires,
extras_require={
'dev': dev_requires,
},
entry_points={
'paste.app_factory': [
'main = tutorial:main'
],
'console_scripts': [
'initialize_tutorial_db = tutorial.initialize_db:main'
],
},
)
@@ -38,18 +38,19 @@ 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
:linenos:
:emphasize-lines: 5
: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,14 +97,20 @@ 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 <toolbar:overview>`.
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:
@@ -1,15 +1,28 @@
from setuptools import setup
# List of dependencies installed via `pip install -e .`
# by virtue of the Setuptools `install_requires` value below.
requires = [
'pyramid',
'pyramid_debugtoolbar',
'waitress',
]
setup(name='tutorial',
install_requires=requires,
entry_points="""\
[paste.app_factory]
main = tutorial:main
""",
)
# List of dependencies installed via `pip install -e ".[dev]"`
# by virtue of the Setuptools `extras_require` value in the Python
# dictionary below.
dev_requires = [
'pyramid_debugtoolbar',
]
setup(
name='tutorial',
install_requires=requires,
extras_require={
'dev': dev_requires,
},
entry_points={
'paste.app_factory': [
'main = tutorial:main'
],
},
)
@@ -40,7 +40,7 @@ Steps
#. Let's edit ``forms/setup.py`` to declare a dependency on Deform, which in turn pulls in Colander as a dependency:
.. literalinclude:: forms/setup.py
:emphasize-lines: 4
:emphasize-lines: 6
:linenos:
#. We can now install our project in development mode:
@@ -1,23 +1,32 @@
from setuptools import setup
# List of dependencies installed via `pip install -e .`
# by virtue of the Setuptools `install_requires` value below.
requires = [
'deform',
'pyramid',
'pyramid_chameleon',
'pyramid_debugtoolbar',
'waitress',
]
setup(name='tutorial',
install_requires=requires,
extras_require={
'test': [
'pytest',
'webtest',
],
},
entry_points="""\
[paste.app_factory]
main = tutorial:main
""",
)
# List of dependencies installed via `pip install -e ".[dev]"`
# by virtue of the Setuptools `extras_require` value in the Python
# dictionary below.
dev_requires = [
'pyramid_debugtoolbar',
'pytest',
'webtest',
]
setup(
name='tutorial',
install_requires=requires,
extras_require={
'dev': dev_requires,
},
entry_points={
'paste.app_factory': [
'main = tutorial:main'
],
},
)
@@ -42,14 +42,14 @@ Steps
.. literalinclude:: functional_testing/setup.py
:language: python
:linenos:
:emphasize-lines: 14
:emphasize-lines: 16
#. Install our project and its newly added dependency.
Note that we use the extra specifier ``[test]`` to install testing requirements.
Note that we use the extra specifier ``[dev]`` to install testing requirements for development and surround it and the period with double quote marks.
.. code-block:: bash
$VENV/bin/pip install -e .[test]
$VENV/bin/pip install -e ".[dev]"
#. Let's extend ``functional_testing/tutorial/tests.py`` to include a functional test:
@@ -1,21 +1,30 @@
from setuptools import setup
# List of dependencies installed via `pip install -e .`
# by virtue of the Setuptools `install_requires` value below.
requires = [
'pyramid',
'pyramid_debugtoolbar',
'waitress',
]
setup(name='tutorial',
install_requires=requires,
extras_require={
'test': [
'pytest',
'webtest',
],
},
entry_points="""\
[paste.app_factory]
main = tutorial:main
""",
)
# List of dependencies installed via `pip install -e ".[dev]"`
# by virtue of the Setuptools `extras_require` value in the Python
# dictionary below.
dev_requires = [
'pyramid_debugtoolbar',
'pytest',
'webtest',
]
setup(
name='tutorial',
install_requires=requires,
extras_require={
'dev': dev_requires,
},
entry_points={
'paste.app_factory': [
'main = tutorial:main'
],
},
)
Oops, something went wrong.

0 comments on commit 0591572

Please sign in to comment.