diff --git a/docs/tutorials/wiki/authorization.rst b/docs/tutorials/wiki/authorization.rst index 2b700ee5b7..f7f1be8d06 100644 --- a/docs/tutorials/wiki/authorization.rst +++ b/docs/tutorials/wiki/authorization.rst @@ -38,12 +38,12 @@ Add dependencies ~~~~~~~~~~~~~~~~ Just like in :ref:`wiki_defining_views`, we need a new dependency. -We need to add the `bcrypt `_ package to our tutorial package's ``setup.py`` file by assigning this dependency to the ``requires`` parameter in the ``setup()`` function. +We need to add the `bcrypt `_ package to our tutorial package's ``pyproject.toml`` file by assigning this dependency to the ``dependencies`` stanza. -Open ``setup.py`` and edit it to look like the following: +Open ``pyproject.toml`` and edit it to look like the following: -.. literalinclude:: src/authorization/setup.py - :lines: 11-30 +.. literalinclude:: src/authorization/pyproject.toml + :lines: 20-33 :lineno-match: :emphasize-lines: 2 :language: python diff --git a/docs/tutorials/wiki/basiclayout.rst b/docs/tutorials/wiki/basiclayout.rst index c1c762ae4b..01d366e7b8 100644 --- a/docs/tutorials/wiki/basiclayout.rst +++ b/docs/tutorials/wiki/basiclayout.rst @@ -15,7 +15,7 @@ Even if empty, this marks a directory as a Python package. We use ``__init__.py`` both as a marker, indicating the directory in which it is contained is a package, and to contain application configuration code. When you run the application using the ``pserve`` command using the ``development.ini`` generated configuration file, the application configuration points at a :term:`Setuptools` :term:`entry point` described as ``egg:tutorial``. -In our application, because the application's ``setup.py`` file says so, this entry point happens to be the ``main`` function within the file named ``__init__.py``. +In our application, because the application's ``pyproject.toml`` file says so, this entry point happens to be the ``main`` function within the file named ``__init__.py``. Open ``tutorial/__init__.py``. It should already contain the following: diff --git a/docs/tutorials/wiki/definingviews.rst b/docs/tutorials/wiki/definingviews.rst index 02d7bde9aa..b0368bddff 100644 --- a/docs/tutorials/wiki/definingviews.rst +++ b/docs/tutorials/wiki/definingviews.rst @@ -27,19 +27,19 @@ We will define several :term:`view callable` functions, then wire them into :app See also the chapter :ref:`resources_chapter` for a complete description of resources and the chapter :ref:`traversal_chapter` for the technical details of how traversal works in Pyramid. -Declaring Dependencies in Our ``setup.py`` File -=============================================== +Declaring Dependencies in Our ``pyproject.toml`` File +===================================================== The view code in our application will depend on a package which is not a dependency of the original "tutorial" application. The original "tutorial" application was generated by the cookiecutter. It does not know about our custom application requirements. -We need to add a dependency on the ``docutils`` package to our ``tutorial`` package's ``setup.py`` file by assigning this dependency to the ``requires`` parameter in the ``setup()`` function. +We need to add a dependency on the ``docutils`` package to our ``tutorial`` package's ``pyproject.toml`` file by assigning this dependency to its ``dependencies`` stanza. -Open ``setup.py`` and edit it to look like the following: +Open ``pyproject.toml`` and edit it to look like the following: -.. literalinclude:: src/views/setup.py - :lines: 11-29 +.. literalinclude:: src/views/pyproject.toml + :lines: 20-32 :lineno-match: :emphasize-lines: 2 :language: python @@ -54,7 +54,7 @@ Running ``pip install -e .`` Since a new software dependency was added, you need to run ``pip install -e .`` again inside the root of the ``tutorial`` package to obtain and register the newly added dependency distribution. -Make sure your current working directory is the root of the project (the directory in which ``setup.py`` lives) and execute the following command. +Make sure your current working directory is the root of the project (the directory in which ``pyproject.toml`` lives) and execute the following command. On Unix: diff --git a/docs/tutorials/wiki/design.rst b/docs/tutorials/wiki/design.rst index 5c86293f6b..9c03d4bdcd 100644 --- a/docs/tutorials/wiki/design.rst +++ b/docs/tutorials/wiki/design.rst @@ -12,7 +12,7 @@ Overall We choose to use :term:`reStructuredText` markup in the wiki text. Conversion from reStructuredText to HTML is provided by the widely used ``docutils`` Python module. -We will add this module in the dependency list on the project ``setup.py`` file. +We will add this module in the dependency list on the project's ``pyproject.toml`` file. Models diff --git a/docs/tutorials/wiki/distributing.rst b/docs/tutorials/wiki/distributing.rst index c23f79b5ab..4ad7ffb9fb 100644 --- a/docs/tutorials/wiki/distributing.rst +++ b/docs/tutorials/wiki/distributing.rst @@ -4,33 +4,50 @@ Distributing Your Application ============================= -Once your application works properly, you can create a :term:`distribution` from it by using the ``setup.py sdist`` command. -The following commands assume your current working directory contains the ``tutorial`` package and the ``setup.py`` file. +.. note:: + + This is an optional step. + It is not required nor expected that every application is built to be distributed to a package index. + However, even when building personal projects, defining it as a distributable artifact can provide many advantages when it comes to optimizing your build for a Docker image or other "production" hardened environments that should not mirror your local development environment exactly. + +Once your application works properly, you can create a "sdist" or "wheel" from +it by using a PEP517-compliant client tool. The following commands assume your +current working directory contains the ``tutorial`` package and the +``pyproject.toml`` file. On Unix: .. code-block:: bash - $VENV/bin/python setup.py sdist + $VENV/bin/pip install build + $VENV/bin/python -m build On Windows: .. code-block:: doscon - %VENV%\Scripts\python setup.py sdist + %VENV%\Scripts\pip install build + %VENV%\Scripts\python -m build The output of such a command will be something like: .. code-block:: text - running sdist - # more output - creating dist - Creating tar archive - removing 'tutorial-0.0' (and everything under it) + * Creating venv isolated environment... + * Installing packages in isolated environment... (setuptools) + * Getting build dependencies for sdist... + ... + removing build/bdist.linux-x86_64/wheel + Successfully built tutorial-0.0.tar.gz and tutorial-0.0-py3-none-any.whl This command creates a subdirectory named ``dist``. -Inside that is a tarball named ``tutorial-0.0.tar.gz``, which is the :term:`distribution` of your application. -You can send this file to your friends to show them your cool new application. -They should be able to install it by pointing the ``pip install`` command directly at it. -Or you can upload it to `PyPI `_ and share it with the rest of the world, where it can be downloaded via ``pip install`` remotely like any other package people download from PyPI. +Inside that is a tarball named ``tutorial-0.0.tar.gz`` (the source :term:`distribution` of your application), as well ass ``tutorial-0.0-py3-none-any.whl`` (the binary :term:`distribution`). +You can send these files to your friends to show them your cool new application. +They should be able to install the app by pointing the ``pip install`` command directly at one of them. +These artifacts are also uploadable to `PyPI `_, or another package index, using a tool like ``twine``. + +Note that the config files, such as ``production.ini`` are not part of the distribution. +These files are considered to be defined by the "user" of your application and not part of the application itself. +If you'd like to help a user out, consider defining a new CLI script similar to ``initialize_tutorial_db`` that can render a config file for them! + +Please learn more about distributing an application from the `Python Packaging User Guide `_. diff --git a/docs/tutorials/wiki/installation.rst b/docs/tutorials/wiki/installation.rst index ce15bff0ed..4dc732acac 100644 --- a/docs/tutorials/wiki/installation.rst +++ b/docs/tutorials/wiki/installation.rst @@ -187,17 +187,12 @@ The console will show ``pip`` checking for packages and installing missing packa Successfully installed BTrees-4.7.2 Chameleon-3.8.1 Mako-1.1.3 MarkupSafe-1.1.1 PasteDeploy-2.1.1 Pygments-2.7.3 WebTest-2.0.35 ZConfig-3.5.0 ZEO-5.2.2 ZODB-5.6.0 attrs-20.3.0 beautifulsoup4-4.9.3 cffi-1.14.4 coverage-5.3.1 hupper-1.10.2 iniconfig-1.1.1 packaging-20.8 persistent-4.6.4 plaster-1.0 plaster-pastedeploy-0.7 pluggy-0.13.1 py-1.10.0 pycparser-2.20 pyparsing-2.4.7 pyramid-1.10.5 pyramid-chameleon-0.3 pyramid-debugtoolbar-4.9 pyramid-mako-1.1.0 pyramid-retry-2.1.1 pyramid-tm-2.4 pyramid-zodbconn-0.8.1 pytest-6.2.1 pytest-cov-2.10.1 repoze.lru-0.7 six-1.15.0 soupsieve-2.1 toml-0.10.2 transaction-3.0.1 translationstring-1.4 tutorial venusian-3.0.0 waitress-1.4.4 webob-1.8.6 zc.lockfile-2.0 zdaemon-4.3 zodbpickle-2.0.0 zodburi-2.4.0 zope.deprecation-4.4.0 zope.interface-5.2.0 -Testing requirements are defined in our project's ``setup.py`` file, in the ``tests_require`` and ``extras_require`` stanzas. +Testing requirements are defined in our project's ``pyproject.toml`` file, in the ``project:optional-dependencies`` stanza: -.. literalinclude:: src/installation/setup.py +.. literalinclude:: src/installation/pyproject.toml :language: python :lineno-match: - :lines: 24-28 - -.. literalinclude:: src/installation/setup.py - :language: python - :lineno-match: - :lines: 48-50 + :lines: 33-38 .. _running_tests: @@ -295,10 +290,24 @@ Test and coverage cookiecutter defaults --------------------------------------- The Pyramid cookiecutter includes configuration defaults for ``pytest`` and test coverage. -These configuration files are ``pytest.ini`` and ``.coveragerc``, located at the root of your package. +The configuration for ``pytest`` is in the ``pyroject.toml`` file in the ``tool.pytest.ini_options`` stanza. +Coverage is checked using the ``pytest--cov`` plugin, a wrapper around the `Coverage `_ tool. +Options affecting coverage are defined in the ``[tool.coverage.run]`` stanza of ``pyproject.toml``. ``pytest`` follows :ref:`conventions for Python test discovery `. -The configuration defaults from the cookiecutter tell ``pytest`` where to find the module on which we want to run tests and coverage. +The configuration defaults from the cookiecutter tell ``pytest`` where to find the module on which we want to run tests: + +.. literalinclude:: src/installation/pyproject.toml + :language: python + :lineno-match: + :lines: 51-56 + +The ``tool.coverage.run`` stanza defines the code for which we want to collect and report coverage: + +.. literalinclude:: src/installation/pyproject.toml + :language: python + :lineno-match: + :lines: 46-49 .. seealso:: See ``pytest``'s documentation for :ref:`pytest:usage` or invoke ``pytest -h`` to see its full set of options. diff --git a/docs/tutorials/wiki/src/authorization/.coveragerc b/docs/tutorials/wiki/src/authorization/.coveragerc deleted file mode 100644 index 5db0e79cff..0000000000 --- a/docs/tutorials/wiki/src/authorization/.coveragerc +++ /dev/null @@ -1,2 +0,0 @@ -[run] -source = tutorial diff --git a/docs/tutorials/wiki/src/authorization/CHANGES.txt b/docs/tutorials/wiki/src/authorization/CHANGES.txt deleted file mode 100644 index 14b902fd10..0000000000 --- a/docs/tutorials/wiki/src/authorization/CHANGES.txt +++ /dev/null @@ -1,4 +0,0 @@ -0.0 ---- - -- Initial version. diff --git a/docs/tutorials/wiki/src/authorization/MANIFEST.in b/docs/tutorials/wiki/src/authorization/MANIFEST.in index b4624fd1ca..131373dc02 100644 --- a/docs/tutorials/wiki/src/authorization/MANIFEST.in +++ b/docs/tutorials/wiki/src/authorization/MANIFEST.in @@ -1,4 +1,4 @@ -include *.txt *.ini *.cfg *.rst +include *.txt *.ini *.cfg *.md *.toml recursive-include tutorial *.ico *.png *.css *.gif *.jpg *.pt *.txt *.mak *.mako *.js *.html *.xml *.jinja2 recursive-include tests * recursive-exclude * __pycache__ diff --git a/docs/tutorials/wiki/src/authorization/README.md b/docs/tutorials/wiki/src/authorization/README.md new file mode 100644 index 0000000000..d0126f5aad --- /dev/null +++ b/docs/tutorials/wiki/src/authorization/README.md @@ -0,0 +1,40 @@ +# tutorial + +## Getting Started + +- Change directory into your newly created project if not already there. Your + current directory should be the same as this `README.md` file and `pyproject.toml`. + + ``` + cd tutorial + ``` + +- Create a Python virtual environment, if not already created. + + ``` + python3 -m venv env + ``` + +- Upgrade packaging tools, if necessary. + + ``` + env/bin/pip install --upgrade pip + ``` + +- Install the project in editable mode with its testing requirements. + + ``` + env/bin/pip install -e ".[testing]" + ``` + +- Run your project's tests. + + ``` + env/bin/pytest + ``` + +- Run your project. + + ``` + env/bin/pserve development.ini + ``` diff --git a/docs/tutorials/wiki/src/authorization/README.txt b/docs/tutorials/wiki/src/authorization/README.txt deleted file mode 100644 index b4a924cc44..0000000000 --- a/docs/tutorials/wiki/src/authorization/README.txt +++ /dev/null @@ -1,30 +0,0 @@ -myproj -====== - -Getting Started ---------------- - -- Change directory into your newly created project if not already there. Your - current directory should be the same as this README.txt file and setup.py. - - cd tutorial - -- Create a Python virtual environment, if not already created. - - python3 -m venv env - -- Upgrade packaging tools, if necessary. - - env/bin/pip install --upgrade pip setuptools - -- Install the project in editable mode with its testing requirements. - - env/bin/pip install -e ".[testing]" - -- Run your project's tests. - - env/bin/pytest - -- Run your project. - - env/bin/pserve development.ini diff --git a/docs/tutorials/wiki/src/authorization/pyproject.toml b/docs/tutorials/wiki/src/authorization/pyproject.toml new file mode 100644 index 0000000000..5546f87940 --- /dev/null +++ b/docs/tutorials/wiki/src/authorization/pyproject.toml @@ -0,0 +1,58 @@ +[build-system] +requires = ["setuptools"] +build-backend = "setuptools.build_meta" + +[project] +version = "0.0" +name = "tutorial" +authors = [] +description = "tutorial" +readme = "README.md" +keywords = ["web", "pyramid", "pylons"] +classifiers = [ + "Programming Language :: Python", + "Programming Language :: Python :: 3", + "Framework :: Pyramid", + "Topic :: Internet :: WWW/HTTP", + "Topic :: Internet :: WWW/HTTP :: WSGI :: Application", +] +requires-python = ">=3.8" +dependencies = [ + "bcrypt", + "docutils", + "plaster_pastedeploy", + "pyramid", + "pyramid_chameleon", + "pyramid_debugtoolbar", + "waitress", + "pyramid_retry", + "pyramid_tm", + "pyramid_zodbconn", + "transaction", + "ZODB", +] + +[project.optional-dependencies] +testing = [ + "WebTest", + "pytest", + "pytest-cov", +] + +[project.entry-points."paste.app_factory"] +main = "tutorial:main" + +[tool.setuptools.packages.find] +exclude = ["tests"] + +[tool.coverage.run] +source = [ + "tutorial", +] + +[tool.pytest.ini_options] +addopts = "--strict-markers" +testpaths = [ + "tutorial", + "tests", +] diff --git a/docs/tutorials/wiki/src/authorization/pytest.ini b/docs/tutorials/wiki/src/authorization/pytest.ini deleted file mode 100644 index 3df78fe9dd..0000000000 --- a/docs/tutorials/wiki/src/authorization/pytest.ini +++ /dev/null @@ -1,6 +0,0 @@ -[pytest] -addopts = --strict-markers - -testpaths = - tutorial - tests diff --git a/docs/tutorials/wiki/src/authorization/setup.py b/docs/tutorials/wiki/src/authorization/setup.py deleted file mode 100644 index f619a99152..0000000000 --- a/docs/tutorials/wiki/src/authorization/setup.py +++ /dev/null @@ -1,59 +0,0 @@ -import os - -from setuptools import setup, find_packages - -here = os.path.abspath(os.path.dirname(__file__)) -with open(os.path.join(here, 'README.txt')) as f: - README = f.read() -with open(os.path.join(here, 'CHANGES.txt')) as f: - CHANGES = f.read() - -requires = [ - 'bcrypt', - 'docutils', - 'plaster_pastedeploy', - 'pyramid', - 'pyramid_chameleon', - 'pyramid_debugtoolbar', - 'waitress', - 'pyramid_retry', - 'pyramid_tm', - 'pyramid_zodbconn', - 'transaction', - 'ZODB', -] - -tests_require = [ - 'WebTest', - 'pytest', - 'pytest-cov', -] - -setup( - name='tutorial', - version='0.0', - description='myproj', - long_description=README + '\n\n' + CHANGES, - classifiers=[ - 'Programming Language :: Python', - 'Framework :: Pyramid', - 'Topic :: Internet :: WWW/HTTP', - 'Topic :: Internet :: WWW/HTTP :: WSGI :: Application', - ], - author='', - author_email='', - url='', - keywords='web pyramid pylons', - packages=find_packages(exclude=['tests']), - include_package_data=True, - zip_safe=False, - extras_require={ - 'testing': tests_require, - }, - install_requires=requires, - entry_points={ - 'paste.app_factory': [ - 'main = tutorial:main', - ], - }, -) diff --git a/docs/tutorials/wiki/src/authorization/tests/test_views.py b/docs/tutorials/wiki/src/authorization/tests/test_views.py index 2b4201955c..c2e28dd637 100644 --- a/docs/tutorials/wiki/src/authorization/tests/test_views.py +++ b/docs/tutorials/wiki/src/authorization/tests/test_views.py @@ -5,7 +5,7 @@ def test_my_view(app_request): info = my_view(app_request) assert app_request.response.status_int == 200 - assert info['project'] == 'myproj' + assert info['project'] == 'tutorial' def test_notfound_view(app_request): info = notfound_view(app_request) diff --git a/docs/tutorials/wiki/src/authorization/tutorial/templates/layout.pt b/docs/tutorials/wiki/src/authorization/tutorial/templates/layout.pt index 369b2be1a6..58ae63ea3f 100644 --- a/docs/tutorials/wiki/src/authorization/tutorial/templates/layout.pt +++ b/docs/tutorials/wiki/src/authorization/tutorial/templates/layout.pt @@ -1,5 +1,5 @@ - - + + diff --git a/docs/tutorials/wiki/src/basiclayout/.coveragerc b/docs/tutorials/wiki/src/basiclayout/.coveragerc deleted file mode 100644 index 5db0e79cff..0000000000 --- a/docs/tutorials/wiki/src/basiclayout/.coveragerc +++ /dev/null @@ -1,2 +0,0 @@ -[run] -source = tutorial diff --git a/docs/tutorials/wiki/src/basiclayout/CHANGES.txt b/docs/tutorials/wiki/src/basiclayout/CHANGES.txt deleted file mode 100644 index 14b902fd10..0000000000 --- a/docs/tutorials/wiki/src/basiclayout/CHANGES.txt +++ /dev/null @@ -1,4 +0,0 @@ -0.0 ---- - -- Initial version. diff --git a/docs/tutorials/wiki/src/basiclayout/MANIFEST.in b/docs/tutorials/wiki/src/basiclayout/MANIFEST.in index b4624fd1ca..131373dc02 100644 --- a/docs/tutorials/wiki/src/basiclayout/MANIFEST.in +++ b/docs/tutorials/wiki/src/basiclayout/MANIFEST.in @@ -1,4 +1,4 @@ -include *.txt *.ini *.cfg *.rst +include *.txt *.ini *.cfg *.md *.toml recursive-include tutorial *.ico *.png *.css *.gif *.jpg *.pt *.txt *.mak *.mako *.js *.html *.xml *.jinja2 recursive-include tests * recursive-exclude * __pycache__ diff --git a/docs/tutorials/wiki/src/basiclayout/README.md b/docs/tutorials/wiki/src/basiclayout/README.md new file mode 100644 index 0000000000..d0126f5aad --- /dev/null +++ b/docs/tutorials/wiki/src/basiclayout/README.md @@ -0,0 +1,40 @@ +# tutorial + +## Getting Started + +- Change directory into your newly created project if not already there. Your + current directory should be the same as this `README.md` file and `pyproject.toml`. + + ``` + cd tutorial + ``` + +- Create a Python virtual environment, if not already created. + + ``` + python3 -m venv env + ``` + +- Upgrade packaging tools, if necessary. + + ``` + env/bin/pip install --upgrade pip + ``` + +- Install the project in editable mode with its testing requirements. + + ``` + env/bin/pip install -e ".[testing]" + ``` + +- Run your project's tests. + + ``` + env/bin/pytest + ``` + +- Run your project. + + ``` + env/bin/pserve development.ini + ``` diff --git a/docs/tutorials/wiki/src/basiclayout/README.txt b/docs/tutorials/wiki/src/basiclayout/README.txt deleted file mode 100644 index b4a924cc44..0000000000 --- a/docs/tutorials/wiki/src/basiclayout/README.txt +++ /dev/null @@ -1,30 +0,0 @@ -myproj -====== - -Getting Started ---------------- - -- Change directory into your newly created project if not already there. Your - current directory should be the same as this README.txt file and setup.py. - - cd tutorial - -- Create a Python virtual environment, if not already created. - - python3 -m venv env - -- Upgrade packaging tools, if necessary. - - env/bin/pip install --upgrade pip setuptools - -- Install the project in editable mode with its testing requirements. - - env/bin/pip install -e ".[testing]" - -- Run your project's tests. - - env/bin/pytest - -- Run your project. - - env/bin/pserve development.ini diff --git a/docs/tutorials/wiki/src/basiclayout/pyproject.toml b/docs/tutorials/wiki/src/basiclayout/pyproject.toml new file mode 100644 index 0000000000..ba317b67b7 --- /dev/null +++ b/docs/tutorials/wiki/src/basiclayout/pyproject.toml @@ -0,0 +1,56 @@ +[build-system] +requires = ["setuptools"] +build-backend = "setuptools.build_meta" + +[project] +version = "0.0" +name = "tutorial" +authors = [] +description = "tutorial" +readme = "README.md" +keywords = ["web", "pyramid", "pylons"] +classifiers = [ + "Programming Language :: Python", + "Programming Language :: Python :: 3", + "Framework :: Pyramid", + "Topic :: Internet :: WWW/HTTP", + "Topic :: Internet :: WWW/HTTP :: WSGI :: Application", +] +requires-python = ">=3.8" +dependencies = [ + "plaster_pastedeploy", + "pyramid", + "pyramid_chameleon", + "pyramid_debugtoolbar", + "waitress", + "pyramid_retry", + "pyramid_tm", + "pyramid_zodbconn", + "transaction", + "ZODB", +] + +[project.optional-dependencies] +testing = [ + "WebTest", + "pytest", + "pytest-cov", +] + +[project.entry-points."paste.app_factory"] +main = "tutorial:main" + +[tool.setuptools.packages.find] +exclude = ["tests"] + +[tool.coverage.run] +source = [ + "tutorial", +] + +[tool.pytest.ini_options] +addopts = "--strict-markers" +testpaths = [ + "tutorial", + "tests", +] diff --git a/docs/tutorials/wiki/src/basiclayout/pytest.ini b/docs/tutorials/wiki/src/basiclayout/pytest.ini deleted file mode 100644 index 3df78fe9dd..0000000000 --- a/docs/tutorials/wiki/src/basiclayout/pytest.ini +++ /dev/null @@ -1,6 +0,0 @@ -[pytest] -addopts = --strict-markers - -testpaths = - tutorial - tests diff --git a/docs/tutorials/wiki/src/basiclayout/setup.py b/docs/tutorials/wiki/src/basiclayout/setup.py deleted file mode 100644 index d70df09598..0000000000 --- a/docs/tutorials/wiki/src/basiclayout/setup.py +++ /dev/null @@ -1,57 +0,0 @@ -import os - -from setuptools import setup, find_packages - -here = os.path.abspath(os.path.dirname(__file__)) -with open(os.path.join(here, 'README.txt')) as f: - README = f.read() -with open(os.path.join(here, 'CHANGES.txt')) as f: - CHANGES = f.read() - -requires = [ - 'plaster_pastedeploy', - 'pyramid', - 'pyramid_chameleon', - 'pyramid_debugtoolbar', - 'waitress', - 'pyramid_retry', - 'pyramid_tm', - 'pyramid_zodbconn', - 'transaction', - 'ZODB', -] - -tests_require = [ - 'WebTest', - 'pytest', - 'pytest-cov', -] - -setup( - name='tutorial', - version='0.0', - description='myproj', - long_description=README + '\n\n' + CHANGES, - classifiers=[ - 'Programming Language :: Python', - 'Framework :: Pyramid', - 'Topic :: Internet :: WWW/HTTP', - 'Topic :: Internet :: WWW/HTTP :: WSGI :: Application', - ], - author='', - author_email='', - url='', - keywords='web pyramid pylons', - packages=find_packages(exclude=['tests']), - include_package_data=True, - zip_safe=False, - extras_require={ - 'testing': tests_require, - }, - install_requires=requires, - entry_points={ - 'paste.app_factory': [ - 'main = tutorial:main', - ], - }, -) diff --git a/docs/tutorials/wiki/src/basiclayout/tests/test_views.py b/docs/tutorials/wiki/src/basiclayout/tests/test_views.py index 2b4201955c..c2e28dd637 100644 --- a/docs/tutorials/wiki/src/basiclayout/tests/test_views.py +++ b/docs/tutorials/wiki/src/basiclayout/tests/test_views.py @@ -5,7 +5,7 @@ def test_my_view(app_request): info = my_view(app_request) assert app_request.response.status_int == 200 - assert info['project'] == 'myproj' + assert info['project'] == 'tutorial' def test_notfound_view(app_request): info = notfound_view(app_request) diff --git a/docs/tutorials/wiki/src/basiclayout/tutorial/templates/layout.pt b/docs/tutorials/wiki/src/basiclayout/tutorial/templates/layout.pt index 2e65a93c47..e6b52e78a0 100644 --- a/docs/tutorials/wiki/src/basiclayout/tutorial/templates/layout.pt +++ b/docs/tutorials/wiki/src/basiclayout/tutorial/templates/layout.pt @@ -1,5 +1,5 @@ - - + + diff --git a/docs/tutorials/wiki/src/basiclayout/tutorial/views/default.py b/docs/tutorials/wiki/src/basiclayout/tutorial/views/default.py index 51ec5ed98f..c849e82d93 100644 --- a/docs/tutorials/wiki/src/basiclayout/tutorial/views/default.py +++ b/docs/tutorials/wiki/src/basiclayout/tutorial/views/default.py @@ -5,4 +5,4 @@ @view_config(context=MyModel, renderer='tutorial:templates/mytemplate.pt') def my_view(request): - return {'project': 'myproj'} + return {'project': 'tutorial'} diff --git a/docs/tutorials/wiki/src/installation/.coveragerc b/docs/tutorials/wiki/src/installation/.coveragerc deleted file mode 100644 index 5db0e79cff..0000000000 --- a/docs/tutorials/wiki/src/installation/.coveragerc +++ /dev/null @@ -1,2 +0,0 @@ -[run] -source = tutorial diff --git a/docs/tutorials/wiki/src/installation/CHANGES.txt b/docs/tutorials/wiki/src/installation/CHANGES.txt deleted file mode 100644 index 14b902fd10..0000000000 --- a/docs/tutorials/wiki/src/installation/CHANGES.txt +++ /dev/null @@ -1,4 +0,0 @@ -0.0 ---- - -- Initial version. diff --git a/docs/tutorials/wiki/src/installation/MANIFEST.in b/docs/tutorials/wiki/src/installation/MANIFEST.in index b4624fd1ca..131373dc02 100644 --- a/docs/tutorials/wiki/src/installation/MANIFEST.in +++ b/docs/tutorials/wiki/src/installation/MANIFEST.in @@ -1,4 +1,4 @@ -include *.txt *.ini *.cfg *.rst +include *.txt *.ini *.cfg *.md *.toml recursive-include tutorial *.ico *.png *.css *.gif *.jpg *.pt *.txt *.mak *.mako *.js *.html *.xml *.jinja2 recursive-include tests * recursive-exclude * __pycache__ diff --git a/docs/tutorials/wiki/src/installation/README.md b/docs/tutorials/wiki/src/installation/README.md new file mode 100644 index 0000000000..d0126f5aad --- /dev/null +++ b/docs/tutorials/wiki/src/installation/README.md @@ -0,0 +1,40 @@ +# tutorial + +## Getting Started + +- Change directory into your newly created project if not already there. Your + current directory should be the same as this `README.md` file and `pyproject.toml`. + + ``` + cd tutorial + ``` + +- Create a Python virtual environment, if not already created. + + ``` + python3 -m venv env + ``` + +- Upgrade packaging tools, if necessary. + + ``` + env/bin/pip install --upgrade pip + ``` + +- Install the project in editable mode with its testing requirements. + + ``` + env/bin/pip install -e ".[testing]" + ``` + +- Run your project's tests. + + ``` + env/bin/pytest + ``` + +- Run your project. + + ``` + env/bin/pserve development.ini + ``` diff --git a/docs/tutorials/wiki/src/installation/README.txt b/docs/tutorials/wiki/src/installation/README.txt deleted file mode 100644 index b4a924cc44..0000000000 --- a/docs/tutorials/wiki/src/installation/README.txt +++ /dev/null @@ -1,30 +0,0 @@ -myproj -====== - -Getting Started ---------------- - -- Change directory into your newly created project if not already there. Your - current directory should be the same as this README.txt file and setup.py. - - cd tutorial - -- Create a Python virtual environment, if not already created. - - python3 -m venv env - -- Upgrade packaging tools, if necessary. - - env/bin/pip install --upgrade pip setuptools - -- Install the project in editable mode with its testing requirements. - - env/bin/pip install -e ".[testing]" - -- Run your project's tests. - - env/bin/pytest - -- Run your project. - - env/bin/pserve development.ini diff --git a/docs/tutorials/wiki/src/installation/pyproject.toml b/docs/tutorials/wiki/src/installation/pyproject.toml new file mode 100644 index 0000000000..ba317b67b7 --- /dev/null +++ b/docs/tutorials/wiki/src/installation/pyproject.toml @@ -0,0 +1,56 @@ +[build-system] +requires = ["setuptools"] +build-backend = "setuptools.build_meta" + +[project] +version = "0.0" +name = "tutorial" +authors = [] +description = "tutorial" +readme = "README.md" +keywords = ["web", "pyramid", "pylons"] +classifiers = [ + "Programming Language :: Python", + "Programming Language :: Python :: 3", + "Framework :: Pyramid", + "Topic :: Internet :: WWW/HTTP", + "Topic :: Internet :: WWW/HTTP :: WSGI :: Application", +] +requires-python = ">=3.8" +dependencies = [ + "plaster_pastedeploy", + "pyramid", + "pyramid_chameleon", + "pyramid_debugtoolbar", + "waitress", + "pyramid_retry", + "pyramid_tm", + "pyramid_zodbconn", + "transaction", + "ZODB", +] + +[project.optional-dependencies] +testing = [ + "WebTest", + "pytest", + "pytest-cov", +] + +[project.entry-points."paste.app_factory"] +main = "tutorial:main" + +[tool.setuptools.packages.find] +exclude = ["tests"] + +[tool.coverage.run] +source = [ + "tutorial", +] + +[tool.pytest.ini_options] +addopts = "--strict-markers" +testpaths = [ + "tutorial", + "tests", +] diff --git a/docs/tutorials/wiki/src/installation/pytest.ini b/docs/tutorials/wiki/src/installation/pytest.ini deleted file mode 100644 index 3df78fe9dd..0000000000 --- a/docs/tutorials/wiki/src/installation/pytest.ini +++ /dev/null @@ -1,6 +0,0 @@ -[pytest] -addopts = --strict-markers - -testpaths = - tutorial - tests diff --git a/docs/tutorials/wiki/src/installation/setup.py b/docs/tutorials/wiki/src/installation/setup.py deleted file mode 100644 index d70df09598..0000000000 --- a/docs/tutorials/wiki/src/installation/setup.py +++ /dev/null @@ -1,57 +0,0 @@ -import os - -from setuptools import setup, find_packages - -here = os.path.abspath(os.path.dirname(__file__)) -with open(os.path.join(here, 'README.txt')) as f: - README = f.read() -with open(os.path.join(here, 'CHANGES.txt')) as f: - CHANGES = f.read() - -requires = [ - 'plaster_pastedeploy', - 'pyramid', - 'pyramid_chameleon', - 'pyramid_debugtoolbar', - 'waitress', - 'pyramid_retry', - 'pyramid_tm', - 'pyramid_zodbconn', - 'transaction', - 'ZODB', -] - -tests_require = [ - 'WebTest', - 'pytest', - 'pytest-cov', -] - -setup( - name='tutorial', - version='0.0', - description='myproj', - long_description=README + '\n\n' + CHANGES, - classifiers=[ - 'Programming Language :: Python', - 'Framework :: Pyramid', - 'Topic :: Internet :: WWW/HTTP', - 'Topic :: Internet :: WWW/HTTP :: WSGI :: Application', - ], - author='', - author_email='', - url='', - keywords='web pyramid pylons', - packages=find_packages(exclude=['tests']), - include_package_data=True, - zip_safe=False, - extras_require={ - 'testing': tests_require, - }, - install_requires=requires, - entry_points={ - 'paste.app_factory': [ - 'main = tutorial:main', - ], - }, -) diff --git a/docs/tutorials/wiki/src/installation/tests/test_views.py b/docs/tutorials/wiki/src/installation/tests/test_views.py index 2b4201955c..c2e28dd637 100644 --- a/docs/tutorials/wiki/src/installation/tests/test_views.py +++ b/docs/tutorials/wiki/src/installation/tests/test_views.py @@ -5,7 +5,7 @@ def test_my_view(app_request): info = my_view(app_request) assert app_request.response.status_int == 200 - assert info['project'] == 'myproj' + assert info['project'] == 'tutorial' def test_notfound_view(app_request): info = notfound_view(app_request) diff --git a/docs/tutorials/wiki/src/installation/tutorial/templates/layout.pt b/docs/tutorials/wiki/src/installation/tutorial/templates/layout.pt index 2e65a93c47..e6b52e78a0 100644 --- a/docs/tutorials/wiki/src/installation/tutorial/templates/layout.pt +++ b/docs/tutorials/wiki/src/installation/tutorial/templates/layout.pt @@ -1,5 +1,5 @@ - - + + diff --git a/docs/tutorials/wiki/src/installation/tutorial/views/default.py b/docs/tutorials/wiki/src/installation/tutorial/views/default.py index 51ec5ed98f..c849e82d93 100644 --- a/docs/tutorials/wiki/src/installation/tutorial/views/default.py +++ b/docs/tutorials/wiki/src/installation/tutorial/views/default.py @@ -5,4 +5,4 @@ @view_config(context=MyModel, renderer='tutorial:templates/mytemplate.pt') def my_view(request): - return {'project': 'myproj'} + return {'project': 'tutorial'} diff --git a/docs/tutorials/wiki/src/models/.coveragerc b/docs/tutorials/wiki/src/models/.coveragerc deleted file mode 100644 index 5db0e79cff..0000000000 --- a/docs/tutorials/wiki/src/models/.coveragerc +++ /dev/null @@ -1,2 +0,0 @@ -[run] -source = tutorial diff --git a/docs/tutorials/wiki/src/models/CHANGES.txt b/docs/tutorials/wiki/src/models/CHANGES.txt deleted file mode 100644 index 14b902fd10..0000000000 --- a/docs/tutorials/wiki/src/models/CHANGES.txt +++ /dev/null @@ -1,4 +0,0 @@ -0.0 ---- - -- Initial version. diff --git a/docs/tutorials/wiki/src/models/MANIFEST.in b/docs/tutorials/wiki/src/models/MANIFEST.in index b4624fd1ca..131373dc02 100644 --- a/docs/tutorials/wiki/src/models/MANIFEST.in +++ b/docs/tutorials/wiki/src/models/MANIFEST.in @@ -1,4 +1,4 @@ -include *.txt *.ini *.cfg *.rst +include *.txt *.ini *.cfg *.md *.toml recursive-include tutorial *.ico *.png *.css *.gif *.jpg *.pt *.txt *.mak *.mako *.js *.html *.xml *.jinja2 recursive-include tests * recursive-exclude * __pycache__ diff --git a/docs/tutorials/wiki/src/models/README.md b/docs/tutorials/wiki/src/models/README.md new file mode 100644 index 0000000000..d0126f5aad --- /dev/null +++ b/docs/tutorials/wiki/src/models/README.md @@ -0,0 +1,40 @@ +# tutorial + +## Getting Started + +- Change directory into your newly created project if not already there. Your + current directory should be the same as this `README.md` file and `pyproject.toml`. + + ``` + cd tutorial + ``` + +- Create a Python virtual environment, if not already created. + + ``` + python3 -m venv env + ``` + +- Upgrade packaging tools, if necessary. + + ``` + env/bin/pip install --upgrade pip + ``` + +- Install the project in editable mode with its testing requirements. + + ``` + env/bin/pip install -e ".[testing]" + ``` + +- Run your project's tests. + + ``` + env/bin/pytest + ``` + +- Run your project. + + ``` + env/bin/pserve development.ini + ``` diff --git a/docs/tutorials/wiki/src/models/README.txt b/docs/tutorials/wiki/src/models/README.txt deleted file mode 100644 index b4a924cc44..0000000000 --- a/docs/tutorials/wiki/src/models/README.txt +++ /dev/null @@ -1,30 +0,0 @@ -myproj -====== - -Getting Started ---------------- - -- Change directory into your newly created project if not already there. Your - current directory should be the same as this README.txt file and setup.py. - - cd tutorial - -- Create a Python virtual environment, if not already created. - - python3 -m venv env - -- Upgrade packaging tools, if necessary. - - env/bin/pip install --upgrade pip setuptools - -- Install the project in editable mode with its testing requirements. - - env/bin/pip install -e ".[testing]" - -- Run your project's tests. - - env/bin/pytest - -- Run your project. - - env/bin/pserve development.ini diff --git a/docs/tutorials/wiki/src/models/pyproject.toml b/docs/tutorials/wiki/src/models/pyproject.toml new file mode 100644 index 0000000000..ba317b67b7 --- /dev/null +++ b/docs/tutorials/wiki/src/models/pyproject.toml @@ -0,0 +1,56 @@ +[build-system] +requires = ["setuptools"] +build-backend = "setuptools.build_meta" + +[project] +version = "0.0" +name = "tutorial" +authors = [] +description = "tutorial" +readme = "README.md" +keywords = ["web", "pyramid", "pylons"] +classifiers = [ + "Programming Language :: Python", + "Programming Language :: Python :: 3", + "Framework :: Pyramid", + "Topic :: Internet :: WWW/HTTP", + "Topic :: Internet :: WWW/HTTP :: WSGI :: Application", +] +requires-python = ">=3.8" +dependencies = [ + "plaster_pastedeploy", + "pyramid", + "pyramid_chameleon", + "pyramid_debugtoolbar", + "waitress", + "pyramid_retry", + "pyramid_tm", + "pyramid_zodbconn", + "transaction", + "ZODB", +] + +[project.optional-dependencies] +testing = [ + "WebTest", + "pytest", + "pytest-cov", +] + +[project.entry-points."paste.app_factory"] +main = "tutorial:main" + +[tool.setuptools.packages.find] +exclude = ["tests"] + +[tool.coverage.run] +source = [ + "tutorial", +] + +[tool.pytest.ini_options] +addopts = "--strict-markers" +testpaths = [ + "tutorial", + "tests", +] diff --git a/docs/tutorials/wiki/src/models/pytest.ini b/docs/tutorials/wiki/src/models/pytest.ini deleted file mode 100644 index 3df78fe9dd..0000000000 --- a/docs/tutorials/wiki/src/models/pytest.ini +++ /dev/null @@ -1,6 +0,0 @@ -[pytest] -addopts = --strict-markers - -testpaths = - tutorial - tests diff --git a/docs/tutorials/wiki/src/models/setup.py b/docs/tutorials/wiki/src/models/setup.py deleted file mode 100644 index d70df09598..0000000000 --- a/docs/tutorials/wiki/src/models/setup.py +++ /dev/null @@ -1,57 +0,0 @@ -import os - -from setuptools import setup, find_packages - -here = os.path.abspath(os.path.dirname(__file__)) -with open(os.path.join(here, 'README.txt')) as f: - README = f.read() -with open(os.path.join(here, 'CHANGES.txt')) as f: - CHANGES = f.read() - -requires = [ - 'plaster_pastedeploy', - 'pyramid', - 'pyramid_chameleon', - 'pyramid_debugtoolbar', - 'waitress', - 'pyramid_retry', - 'pyramid_tm', - 'pyramid_zodbconn', - 'transaction', - 'ZODB', -] - -tests_require = [ - 'WebTest', - 'pytest', - 'pytest-cov', -] - -setup( - name='tutorial', - version='0.0', - description='myproj', - long_description=README + '\n\n' + CHANGES, - classifiers=[ - 'Programming Language :: Python', - 'Framework :: Pyramid', - 'Topic :: Internet :: WWW/HTTP', - 'Topic :: Internet :: WWW/HTTP :: WSGI :: Application', - ], - author='', - author_email='', - url='', - keywords='web pyramid pylons', - packages=find_packages(exclude=['tests']), - include_package_data=True, - zip_safe=False, - extras_require={ - 'testing': tests_require, - }, - install_requires=requires, - entry_points={ - 'paste.app_factory': [ - 'main = tutorial:main', - ], - }, -) diff --git a/docs/tutorials/wiki/src/models/tests/test_views.py b/docs/tutorials/wiki/src/models/tests/test_views.py index 2b4201955c..c2e28dd637 100644 --- a/docs/tutorials/wiki/src/models/tests/test_views.py +++ b/docs/tutorials/wiki/src/models/tests/test_views.py @@ -5,7 +5,7 @@ def test_my_view(app_request): info = my_view(app_request) assert app_request.response.status_int == 200 - assert info['project'] == 'myproj' + assert info['project'] == 'tutorial' def test_notfound_view(app_request): info = notfound_view(app_request) diff --git a/docs/tutorials/wiki/src/models/tutorial/templates/layout.pt b/docs/tutorials/wiki/src/models/tutorial/templates/layout.pt index 2e65a93c47..e6b52e78a0 100644 --- a/docs/tutorials/wiki/src/models/tutorial/templates/layout.pt +++ b/docs/tutorials/wiki/src/models/tutorial/templates/layout.pt @@ -1,5 +1,5 @@ - - + + diff --git a/docs/tutorials/wiki/src/models/tutorial/views/default.py b/docs/tutorials/wiki/src/models/tutorial/views/default.py index 51ec5ed98f..c849e82d93 100644 --- a/docs/tutorials/wiki/src/models/tutorial/views/default.py +++ b/docs/tutorials/wiki/src/models/tutorial/views/default.py @@ -5,4 +5,4 @@ @view_config(context=MyModel, renderer='tutorial:templates/mytemplate.pt') def my_view(request): - return {'project': 'myproj'} + return {'project': 'tutorial'} diff --git a/docs/tutorials/wiki/src/tests/.coveragerc b/docs/tutorials/wiki/src/tests/.coveragerc deleted file mode 100644 index 5db0e79cff..0000000000 --- a/docs/tutorials/wiki/src/tests/.coveragerc +++ /dev/null @@ -1,2 +0,0 @@ -[run] -source = tutorial diff --git a/docs/tutorials/wiki/src/tests/CHANGES.txt b/docs/tutorials/wiki/src/tests/CHANGES.txt deleted file mode 100644 index 14b902fd10..0000000000 --- a/docs/tutorials/wiki/src/tests/CHANGES.txt +++ /dev/null @@ -1,4 +0,0 @@ -0.0 ---- - -- Initial version. diff --git a/docs/tutorials/wiki/src/tests/MANIFEST.in b/docs/tutorials/wiki/src/tests/MANIFEST.in index b4624fd1ca..131373dc02 100644 --- a/docs/tutorials/wiki/src/tests/MANIFEST.in +++ b/docs/tutorials/wiki/src/tests/MANIFEST.in @@ -1,4 +1,4 @@ -include *.txt *.ini *.cfg *.rst +include *.txt *.ini *.cfg *.md *.toml recursive-include tutorial *.ico *.png *.css *.gif *.jpg *.pt *.txt *.mak *.mako *.js *.html *.xml *.jinja2 recursive-include tests * recursive-exclude * __pycache__ diff --git a/docs/tutorials/wiki/src/tests/README.md b/docs/tutorials/wiki/src/tests/README.md new file mode 100644 index 0000000000..d0126f5aad --- /dev/null +++ b/docs/tutorials/wiki/src/tests/README.md @@ -0,0 +1,40 @@ +# tutorial + +## Getting Started + +- Change directory into your newly created project if not already there. Your + current directory should be the same as this `README.md` file and `pyproject.toml`. + + ``` + cd tutorial + ``` + +- Create a Python virtual environment, if not already created. + + ``` + python3 -m venv env + ``` + +- Upgrade packaging tools, if necessary. + + ``` + env/bin/pip install --upgrade pip + ``` + +- Install the project in editable mode with its testing requirements. + + ``` + env/bin/pip install -e ".[testing]" + ``` + +- Run your project's tests. + + ``` + env/bin/pytest + ``` + +- Run your project. + + ``` + env/bin/pserve development.ini + ``` diff --git a/docs/tutorials/wiki/src/tests/README.txt b/docs/tutorials/wiki/src/tests/README.txt deleted file mode 100644 index b4a924cc44..0000000000 --- a/docs/tutorials/wiki/src/tests/README.txt +++ /dev/null @@ -1,30 +0,0 @@ -myproj -====== - -Getting Started ---------------- - -- Change directory into your newly created project if not already there. Your - current directory should be the same as this README.txt file and setup.py. - - cd tutorial - -- Create a Python virtual environment, if not already created. - - python3 -m venv env - -- Upgrade packaging tools, if necessary. - - env/bin/pip install --upgrade pip setuptools - -- Install the project in editable mode with its testing requirements. - - env/bin/pip install -e ".[testing]" - -- Run your project's tests. - - env/bin/pytest - -- Run your project. - - env/bin/pserve development.ini diff --git a/docs/tutorials/wiki/src/tests/pyproject.toml b/docs/tutorials/wiki/src/tests/pyproject.toml new file mode 100644 index 0000000000..5546f87940 --- /dev/null +++ b/docs/tutorials/wiki/src/tests/pyproject.toml @@ -0,0 +1,58 @@ +[build-system] +requires = ["setuptools"] +build-backend = "setuptools.build_meta" + +[project] +version = "0.0" +name = "tutorial" +authors = [] +description = "tutorial" +readme = "README.md" +keywords = ["web", "pyramid", "pylons"] +classifiers = [ + "Programming Language :: Python", + "Programming Language :: Python :: 3", + "Framework :: Pyramid", + "Topic :: Internet :: WWW/HTTP", + "Topic :: Internet :: WWW/HTTP :: WSGI :: Application", +] +requires-python = ">=3.8" +dependencies = [ + "bcrypt", + "docutils", + "plaster_pastedeploy", + "pyramid", + "pyramid_chameleon", + "pyramid_debugtoolbar", + "waitress", + "pyramid_retry", + "pyramid_tm", + "pyramid_zodbconn", + "transaction", + "ZODB", +] + +[project.optional-dependencies] +testing = [ + "WebTest", + "pytest", + "pytest-cov", +] + +[project.entry-points."paste.app_factory"] +main = "tutorial:main" + +[tool.setuptools.packages.find] +exclude = ["tests"] + +[tool.coverage.run] +source = [ + "tutorial", +] + +[tool.pytest.ini_options] +addopts = "--strict-markers" +testpaths = [ + "tutorial", + "tests", +] diff --git a/docs/tutorials/wiki/src/tests/pytest.ini b/docs/tutorials/wiki/src/tests/pytest.ini deleted file mode 100644 index 3df78fe9dd..0000000000 --- a/docs/tutorials/wiki/src/tests/pytest.ini +++ /dev/null @@ -1,6 +0,0 @@ -[pytest] -addopts = --strict-markers - -testpaths = - tutorial - tests diff --git a/docs/tutorials/wiki/src/tests/setup.py b/docs/tutorials/wiki/src/tests/setup.py deleted file mode 100644 index f619a99152..0000000000 --- a/docs/tutorials/wiki/src/tests/setup.py +++ /dev/null @@ -1,59 +0,0 @@ -import os - -from setuptools import setup, find_packages - -here = os.path.abspath(os.path.dirname(__file__)) -with open(os.path.join(here, 'README.txt')) as f: - README = f.read() -with open(os.path.join(here, 'CHANGES.txt')) as f: - CHANGES = f.read() - -requires = [ - 'bcrypt', - 'docutils', - 'plaster_pastedeploy', - 'pyramid', - 'pyramid_chameleon', - 'pyramid_debugtoolbar', - 'waitress', - 'pyramid_retry', - 'pyramid_tm', - 'pyramid_zodbconn', - 'transaction', - 'ZODB', -] - -tests_require = [ - 'WebTest', - 'pytest', - 'pytest-cov', -] - -setup( - name='tutorial', - version='0.0', - description='myproj', - long_description=README + '\n\n' + CHANGES, - classifiers=[ - 'Programming Language :: Python', - 'Framework :: Pyramid', - 'Topic :: Internet :: WWW/HTTP', - 'Topic :: Internet :: WWW/HTTP :: WSGI :: Application', - ], - author='', - author_email='', - url='', - keywords='web pyramid pylons', - packages=find_packages(exclude=['tests']), - include_package_data=True, - zip_safe=False, - extras_require={ - 'testing': tests_require, - }, - install_requires=requires, - entry_points={ - 'paste.app_factory': [ - 'main = tutorial:main', - ], - }, -) diff --git a/docs/tutorials/wiki/src/tests/tutorial/templates/layout.pt b/docs/tutorials/wiki/src/tests/tutorial/templates/layout.pt index 369b2be1a6..58ae63ea3f 100644 --- a/docs/tutorials/wiki/src/tests/tutorial/templates/layout.pt +++ b/docs/tutorials/wiki/src/tests/tutorial/templates/layout.pt @@ -1,5 +1,5 @@ - - + + diff --git a/docs/tutorials/wiki/src/views/.coveragerc b/docs/tutorials/wiki/src/views/.coveragerc deleted file mode 100644 index 5db0e79cff..0000000000 --- a/docs/tutorials/wiki/src/views/.coveragerc +++ /dev/null @@ -1,2 +0,0 @@ -[run] -source = tutorial diff --git a/docs/tutorials/wiki/src/views/CHANGES.txt b/docs/tutorials/wiki/src/views/CHANGES.txt deleted file mode 100644 index 14b902fd10..0000000000 --- a/docs/tutorials/wiki/src/views/CHANGES.txt +++ /dev/null @@ -1,4 +0,0 @@ -0.0 ---- - -- Initial version. diff --git a/docs/tutorials/wiki/src/views/MANIFEST.in b/docs/tutorials/wiki/src/views/MANIFEST.in index b4624fd1ca..131373dc02 100644 --- a/docs/tutorials/wiki/src/views/MANIFEST.in +++ b/docs/tutorials/wiki/src/views/MANIFEST.in @@ -1,4 +1,4 @@ -include *.txt *.ini *.cfg *.rst +include *.txt *.ini *.cfg *.md *.toml recursive-include tutorial *.ico *.png *.css *.gif *.jpg *.pt *.txt *.mak *.mako *.js *.html *.xml *.jinja2 recursive-include tests * recursive-exclude * __pycache__ diff --git a/docs/tutorials/wiki/src/views/README.md b/docs/tutorials/wiki/src/views/README.md new file mode 100644 index 0000000000..d0126f5aad --- /dev/null +++ b/docs/tutorials/wiki/src/views/README.md @@ -0,0 +1,40 @@ +# tutorial + +## Getting Started + +- Change directory into your newly created project if not already there. Your + current directory should be the same as this `README.md` file and `pyproject.toml`. + + ``` + cd tutorial + ``` + +- Create a Python virtual environment, if not already created. + + ``` + python3 -m venv env + ``` + +- Upgrade packaging tools, if necessary. + + ``` + env/bin/pip install --upgrade pip + ``` + +- Install the project in editable mode with its testing requirements. + + ``` + env/bin/pip install -e ".[testing]" + ``` + +- Run your project's tests. + + ``` + env/bin/pytest + ``` + +- Run your project. + + ``` + env/bin/pserve development.ini + ``` diff --git a/docs/tutorials/wiki/src/views/README.txt b/docs/tutorials/wiki/src/views/README.txt deleted file mode 100644 index b4a924cc44..0000000000 --- a/docs/tutorials/wiki/src/views/README.txt +++ /dev/null @@ -1,30 +0,0 @@ -myproj -====== - -Getting Started ---------------- - -- Change directory into your newly created project if not already there. Your - current directory should be the same as this README.txt file and setup.py. - - cd tutorial - -- Create a Python virtual environment, if not already created. - - python3 -m venv env - -- Upgrade packaging tools, if necessary. - - env/bin/pip install --upgrade pip setuptools - -- Install the project in editable mode with its testing requirements. - - env/bin/pip install -e ".[testing]" - -- Run your project's tests. - - env/bin/pytest - -- Run your project. - - env/bin/pserve development.ini diff --git a/docs/tutorials/wiki/src/views/pyproject.toml b/docs/tutorials/wiki/src/views/pyproject.toml new file mode 100644 index 0000000000..1803f9de70 --- /dev/null +++ b/docs/tutorials/wiki/src/views/pyproject.toml @@ -0,0 +1,57 @@ +[build-system] +requires = ["setuptools"] +build-backend = "setuptools.build_meta" + +[project] +version = "0.0" +name = "tutorial" +authors = [] +description = "tutorial" +readme = "README.md" +keywords = ["web", "pyramid", "pylons"] +classifiers = [ + "Programming Language :: Python", + "Programming Language :: Python :: 3", + "Framework :: Pyramid", + "Topic :: Internet :: WWW/HTTP", + "Topic :: Internet :: WWW/HTTP :: WSGI :: Application", +] +requires-python = ">=3.8" +dependencies = [ + "docutils", + "plaster_pastedeploy", + "pyramid", + "pyramid_chameleon", + "pyramid_debugtoolbar", + "waitress", + "pyramid_retry", + "pyramid_tm", + "pyramid_zodbconn", + "transaction", + "ZODB", +] + +[project.optional-dependencies] +testing = [ + "WebTest", + "pytest", + "pytest-cov", +] + +[project.entry-points."paste.app_factory"] +main = "tutorial:main" + +[tool.setuptools.packages.find] +exclude = ["tests"] + +[tool.coverage.run] +source = [ + "tutorial", +] + +[tool.pytest.ini_options] +addopts = "--strict-markers" +testpaths = [ + "tutorial", + "tests", +] diff --git a/docs/tutorials/wiki/src/views/pytest.ini b/docs/tutorials/wiki/src/views/pytest.ini deleted file mode 100644 index 3df78fe9dd..0000000000 --- a/docs/tutorials/wiki/src/views/pytest.ini +++ /dev/null @@ -1,6 +0,0 @@ -[pytest] -addopts = --strict-markers - -testpaths = - tutorial - tests diff --git a/docs/tutorials/wiki/src/views/setup.py b/docs/tutorials/wiki/src/views/setup.py deleted file mode 100644 index 786691e218..0000000000 --- a/docs/tutorials/wiki/src/views/setup.py +++ /dev/null @@ -1,58 +0,0 @@ -import os - -from setuptools import setup, find_packages - -here = os.path.abspath(os.path.dirname(__file__)) -with open(os.path.join(here, 'README.txt')) as f: - README = f.read() -with open(os.path.join(here, 'CHANGES.txt')) as f: - CHANGES = f.read() - -requires = [ - 'docutils', - 'plaster_pastedeploy', - 'pyramid', - 'pyramid_chameleon', - 'pyramid_debugtoolbar', - 'waitress', - 'pyramid_retry', - 'pyramid_tm', - 'pyramid_zodbconn', - 'transaction', - 'ZODB', -] - -tests_require = [ - 'WebTest', - 'pytest', - 'pytest-cov', -] - -setup( - name='tutorial', - version='0.0', - description='myproj', - long_description=README + '\n\n' + CHANGES, - classifiers=[ - 'Programming Language :: Python', - 'Framework :: Pyramid', - 'Topic :: Internet :: WWW/HTTP', - 'Topic :: Internet :: WWW/HTTP :: WSGI :: Application', - ], - author='', - author_email='', - url='', - keywords='web pyramid pylons', - packages=find_packages(exclude=['tests']), - include_package_data=True, - zip_safe=False, - extras_require={ - 'testing': tests_require, - }, - install_requires=requires, - entry_points={ - 'paste.app_factory': [ - 'main = tutorial:main', - ], - }, -) diff --git a/docs/tutorials/wiki/src/views/tests/test_views.py b/docs/tutorials/wiki/src/views/tests/test_views.py index 2b4201955c..c2e28dd637 100644 --- a/docs/tutorials/wiki/src/views/tests/test_views.py +++ b/docs/tutorials/wiki/src/views/tests/test_views.py @@ -5,7 +5,7 @@ def test_my_view(app_request): info = my_view(app_request) assert app_request.response.status_int == 200 - assert info['project'] == 'myproj' + assert info['project'] == 'tutorial' def test_notfound_view(app_request): info = notfound_view(app_request) diff --git a/docs/tutorials/wiki/src/views/tutorial/templates/layout.pt b/docs/tutorials/wiki/src/views/tutorial/templates/layout.pt index 62d5f28aa5..845ca151ab 100644 --- a/docs/tutorials/wiki/src/views/tutorial/templates/layout.pt +++ b/docs/tutorials/wiki/src/views/tutorial/templates/layout.pt @@ -1,5 +1,5 @@ - - + + diff --git a/docs/tutorials/wiki/tests.rst b/docs/tutorials/wiki/tests.rst index 231945c9a8..70eb3c1da0 100644 --- a/docs/tutorials/wiki/tests.rst +++ b/docs/tutorials/wiki/tests.rst @@ -19,19 +19,19 @@ The test module would have the same name with the prefix ``test_``. The harness consists of the following setup: -- ``pytest.ini`` - controls basic ``pytest`` configuration, including where to find the tests. +- The ``project.optional-dependencies`` stanza of ``pyproject.toml`` - controls the dependencies installed when testing. + When the list is changed, it is necessary to re-run ``$VENV/bin/pip install -e ".[testing]"`` to ensure the new dependencies are installed. + +- The ``tool.pytest.ini_options`` stanza of ``pyproject.toml`` controls basic ``pytest`` configuration, including where to find the tests. We have configured ``pytest`` to search for tests in the application package and in the ``tests`` package. -- ``.coveragerc`` - controls coverage config. +- The ``tool.coverage.run`` stanza of ``pyproject.toml`` controls coverage config. In our setup, it works with the ``pytest-cov`` plugin that we use via the ``--cov`` options to the ``pytest`` command. -- ``testing.ini`` - a mirror of ``development.ini`` and ``production.ini`` that contains settings used for executing the test suite. +- The ``testing.ini`` file is a mirror of ``development.ini`` and ``production.ini`` that contains settings used for executing the test suite. Most importantly, it contains the database connection information used by tests that require the database. -- ``tests_require`` in ``setup.py`` - controls the dependencies installed when testing. - When the list is changed, it is necessary to re-run ``$VENV/bin/pip install -e ".[testing]"`` to ensure the new dependencies are installed. - -- ``tests/conftest.py`` - the core fixtures available throughout our tests. +- The ``tests/conftest.py`` file defines the core fixtures available throughout our tests. The fixtures are explained in more detail in the following sections. Open ``tests/conftest.py`` and follow along.