summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CHANGES.rst6
-rw-r--r--docs/tutorials/wiki/authorization.rst8
-rw-r--r--docs/tutorials/wiki/basiclayout.rst2
-rw-r--r--docs/tutorials/wiki/definingviews.rst14
-rw-r--r--docs/tutorials/wiki/design.rst2
-rw-r--r--docs/tutorials/wiki/distributing.rst43
-rw-r--r--docs/tutorials/wiki/installation.rst29
-rw-r--r--docs/tutorials/wiki/src/authorization/.coveragerc2
-rw-r--r--docs/tutorials/wiki/src/authorization/CHANGES.txt4
-rw-r--r--docs/tutorials/wiki/src/authorization/MANIFEST.in2
-rw-r--r--docs/tutorials/wiki/src/authorization/README.md40
-rw-r--r--docs/tutorials/wiki/src/authorization/README.txt30
-rw-r--r--docs/tutorials/wiki/src/authorization/pyproject.toml58
-rw-r--r--docs/tutorials/wiki/src/authorization/pytest.ini6
-rw-r--r--docs/tutorials/wiki/src/authorization/setup.py59
-rw-r--r--docs/tutorials/wiki/src/authorization/tests/test_views.py2
-rw-r--r--docs/tutorials/wiki/src/authorization/tutorial/templates/layout.pt4
-rw-r--r--docs/tutorials/wiki/src/basiclayout/.coveragerc2
-rw-r--r--docs/tutorials/wiki/src/basiclayout/CHANGES.txt4
-rw-r--r--docs/tutorials/wiki/src/basiclayout/MANIFEST.in2
-rw-r--r--docs/tutorials/wiki/src/basiclayout/README.md40
-rw-r--r--docs/tutorials/wiki/src/basiclayout/README.txt30
-rw-r--r--docs/tutorials/wiki/src/basiclayout/pyproject.toml56
-rw-r--r--docs/tutorials/wiki/src/basiclayout/pytest.ini6
-rw-r--r--docs/tutorials/wiki/src/basiclayout/setup.py57
-rw-r--r--docs/tutorials/wiki/src/basiclayout/tests/test_views.py2
-rw-r--r--docs/tutorials/wiki/src/basiclayout/tutorial/templates/layout.pt4
-rw-r--r--docs/tutorials/wiki/src/basiclayout/tutorial/views/default.py2
-rw-r--r--docs/tutorials/wiki/src/installation/.coveragerc2
-rw-r--r--docs/tutorials/wiki/src/installation/CHANGES.txt4
-rw-r--r--docs/tutorials/wiki/src/installation/MANIFEST.in2
-rw-r--r--docs/tutorials/wiki/src/installation/README.md40
-rw-r--r--docs/tutorials/wiki/src/installation/README.txt30
-rw-r--r--docs/tutorials/wiki/src/installation/pyproject.toml56
-rw-r--r--docs/tutorials/wiki/src/installation/pytest.ini6
-rw-r--r--docs/tutorials/wiki/src/installation/setup.py57
-rw-r--r--docs/tutorials/wiki/src/installation/tests/test_views.py2
-rw-r--r--docs/tutorials/wiki/src/installation/tutorial/templates/layout.pt4
-rw-r--r--docs/tutorials/wiki/src/installation/tutorial/views/default.py2
-rw-r--r--docs/tutorials/wiki/src/models/.coveragerc2
-rw-r--r--docs/tutorials/wiki/src/models/CHANGES.txt4
-rw-r--r--docs/tutorials/wiki/src/models/MANIFEST.in2
-rw-r--r--docs/tutorials/wiki/src/models/README.md40
-rw-r--r--docs/tutorials/wiki/src/models/README.txt30
-rw-r--r--docs/tutorials/wiki/src/models/pyproject.toml56
-rw-r--r--docs/tutorials/wiki/src/models/pytest.ini6
-rw-r--r--docs/tutorials/wiki/src/models/setup.py57
-rw-r--r--docs/tutorials/wiki/src/models/tests/test_views.py2
-rw-r--r--docs/tutorials/wiki/src/models/tutorial/templates/layout.pt4
-rw-r--r--docs/tutorials/wiki/src/models/tutorial/views/default.py2
-rw-r--r--docs/tutorials/wiki/src/tests/.coveragerc2
-rw-r--r--docs/tutorials/wiki/src/tests/CHANGES.txt4
-rw-r--r--docs/tutorials/wiki/src/tests/MANIFEST.in2
-rw-r--r--docs/tutorials/wiki/src/tests/README.md40
-rw-r--r--docs/tutorials/wiki/src/tests/README.txt30
-rw-r--r--docs/tutorials/wiki/src/tests/pyproject.toml58
-rw-r--r--docs/tutorials/wiki/src/tests/pytest.ini6
-rw-r--r--docs/tutorials/wiki/src/tests/setup.py59
-rw-r--r--docs/tutorials/wiki/src/tests/tutorial/templates/layout.pt4
-rw-r--r--docs/tutorials/wiki/src/views/.coveragerc2
-rw-r--r--docs/tutorials/wiki/src/views/CHANGES.txt4
-rw-r--r--docs/tutorials/wiki/src/views/MANIFEST.in2
-rw-r--r--docs/tutorials/wiki/src/views/README.md40
-rw-r--r--docs/tutorials/wiki/src/views/README.txt30
-rw-r--r--docs/tutorials/wiki/src/views/pyproject.toml57
-rw-r--r--docs/tutorials/wiki/src/views/pytest.ini6
-rw-r--r--docs/tutorials/wiki/src/views/setup.py58
-rw-r--r--docs/tutorials/wiki/src/views/tests/test_views.py2
-rw-r--r--docs/tutorials/wiki/src/views/tutorial/templates/layout.pt4
-rw-r--r--docs/tutorials/wiki/tests.rst14
-rw-r--r--src/pyramid/path.py22
-rw-r--r--src/pyramid/scripts/pdistreport.py14
-rw-r--r--src/pyramid/scripts/pshell.py14
-rw-r--r--tests/test_scripts/dummy.py20
-rw-r--r--tests/test_scripts/test_pdistreport.py34
-rw-r--r--tests/test_scripts/test_pshell.py38
76 files changed, 767 insertions, 725 deletions
diff --git a/CHANGES.rst b/CHANGES.rst
index c05bc66fa..96d496044 100644
--- a/CHANGES.rst
+++ b/CHANGES.rst
@@ -28,6 +28,12 @@ Features
See https://github.com/Pylons/pyramid/pull/3745
+- Replace usage of ``pkg_resources`` in ``pyramid.path.DottedNameResolver``.
+ See https://github.com/Pylons/pyramid/pull/3748
+
+- Replace usage of ``pkg_resources`` in ``pdistreport`` and ``pshell`` CLI
+ commands. See https://github.com/Pylons/pyramid/pull/3749
+
Bug Fixes
---------
diff --git a/docs/tutorials/wiki/authorization.rst b/docs/tutorials/wiki/authorization.rst
index 2b700ee5b..f7f1be8d0 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 <https://pypi.org/project/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 <https://pypi.org/project/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 c1c762ae4..01d366e7b 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 02d7bde9a..b0368bddf 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 5c86293f6..9c03d4bdc 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 c23f79b5a..4ad7ffb9f 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 <https://pypi.org/>`_ 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 <https://pypi.org/>`_, 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 <https://packaging.python.org/en/latest/tutorials/packaging-projects/>`_.
diff --git a/docs/tutorials/wiki/installation.rst b/docs/tutorials/wiki/installation.rst
index ce15bff0e..4dc732aca 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 <https://coverage.readthedocs.io/en/latest/index.html>`_ tool.
+Options affecting coverage are defined in the ``[tool.coverage.run]`` stanza of ``pyproject.toml``.
``pytest`` follows :ref:`conventions for Python test discovery <pytest: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 5db0e79cf..000000000
--- 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 14b902fd1..000000000
--- 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 b4624fd1c..131373dc0 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 000000000..d0126f5aa
--- /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 b4a924cc4..000000000
--- 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 000000000..5546f8794
--- /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 3df78fe9d..000000000
--- 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 f619a9915..000000000
--- 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 2b4201955..c2e28dd63 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 @@ from tutorial.views.notfound import notfound_view
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 369b2be1a..58ae63ea3 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 @@
-<!DOCTYPE html metal:define-macro="layout">
-<html lang="${request.locale_name}">
+<!DOCTYPE html>
+<html lang="${request.locale_name}" metal:define-macro="layout">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
diff --git a/docs/tutorials/wiki/src/basiclayout/.coveragerc b/docs/tutorials/wiki/src/basiclayout/.coveragerc
deleted file mode 100644
index 5db0e79cf..000000000
--- 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 14b902fd1..000000000
--- 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 b4624fd1c..131373dc0 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 000000000..d0126f5aa
--- /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 b4a924cc4..000000000
--- 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 000000000..ba317b67b
--- /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 3df78fe9d..000000000
--- 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 d70df0959..000000000
--- 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 2b4201955..c2e28dd63 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 @@ from tutorial.views.notfound import notfound_view
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 2e65a93c4..e6b52e78a 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 @@
-<!DOCTYPE html metal:define-macro="layout">
-<html lang="${request.locale_name}">
+<!DOCTYPE html>
+<html lang="${request.locale_name}" metal:define-macro="layout">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
diff --git a/docs/tutorials/wiki/src/basiclayout/tutorial/views/default.py b/docs/tutorials/wiki/src/basiclayout/tutorial/views/default.py
index 51ec5ed98..c849e82d9 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 @@ from ..models import MyModel
@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 5db0e79cf..000000000
--- 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 14b902fd1..000000000
--- 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 b4624fd1c..131373dc0 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 000000000..d0126f5aa
--- /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 b4a924cc4..000000000
--- 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 000000000..ba317b67b
--- /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 3df78fe9d..000000000
--- 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 d70df0959..000000000
--- 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 2b4201955..c2e28dd63 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 @@ from tutorial.views.notfound import notfound_view
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 2e65a93c4..e6b52e78a 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 @@
-<!DOCTYPE html metal:define-macro="layout">
-<html lang="${request.locale_name}">
+<!DOCTYPE html>
+<html lang="${request.locale_name}" metal:define-macro="layout">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
diff --git a/docs/tutorials/wiki/src/installation/tutorial/views/default.py b/docs/tutorials/wiki/src/installation/tutorial/views/default.py
index 51ec5ed98..c849e82d9 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 @@ from ..models import MyModel
@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 5db0e79cf..000000000
--- 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 14b902fd1..000000000
--- 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 b4624fd1c..131373dc0 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 000000000..d0126f5aa
--- /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 b4a924cc4..000000000
--- 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 000000000..ba317b67b
--- /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 3df78fe9d..000000000
--- 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 d70df0959..000000000
--- 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 2b4201955..c2e28dd63 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 @@ from tutorial.views.notfound import notfound_view
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 2e65a93c4..e6b52e78a 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 @@
-<!DOCTYPE html metal:define-macro="layout">
-<html lang="${request.locale_name}">
+<!DOCTYPE html>
+<html lang="${request.locale_name}" metal:define-macro="layout">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
diff --git a/docs/tutorials/wiki/src/models/tutorial/views/default.py b/docs/tutorials/wiki/src/models/tutorial/views/default.py
index 51ec5ed98..c849e82d9 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 @@ from ..models import MyModel
@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 5db0e79cf..000000000
--- 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 14b902fd1..000000000
--- 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 b4624fd1c..131373dc0 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 000000000..d0126f5aa
--- /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 b4a924cc4..000000000
--- 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 000000000..5546f8794
--- /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 3df78fe9d..000000000
--- 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 f619a9915..000000000
--- 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 369b2be1a..58ae63ea3 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 @@
-<!DOCTYPE html metal:define-macro="layout">
-<html lang="${request.locale_name}">
+<!DOCTYPE html>
+<html lang="${request.locale_name}" metal:define-macro="layout">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
diff --git a/docs/tutorials/wiki/src/views/.coveragerc b/docs/tutorials/wiki/src/views/.coveragerc
deleted file mode 100644
index 5db0e79cf..000000000
--- 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 14b902fd1..000000000
--- 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 b4624fd1c..131373dc0 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 000000000..d0126f5aa
--- /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 b4a924cc4..000000000
--- 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 000000000..1803f9de7
--- /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 3df78fe9d..000000000
--- 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 786691e21..000000000
--- 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 2b4201955..c2e28dd63 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 @@ from tutorial.views.notfound import notfound_view
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 62d5f28aa..845ca151a 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 @@
-<!DOCTYPE html metal:define-macro="layout">
-<html lang="${request.locale_name}">
+<!DOCTYPE html>
+<html lang="${request.locale_name}" metal:define-macro="layout">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
diff --git a/docs/tutorials/wiki/tests.rst b/docs/tutorials/wiki/tests.rst
index 231945c9a..70eb3c1da 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.
diff --git a/src/pyramid/path.py b/src/pyramid/path.py
index a5b7ad212..160d97abe 100644
--- a/src/pyramid/path.py
+++ b/src/pyramid/path.py
@@ -1,3 +1,5 @@
+import functools
+from importlib import import_module
from importlib.machinery import SOURCE_SUFFIXES
import os
import pkg_resources
@@ -344,14 +346,18 @@ class DottedNameResolver(Resolver):
value = package.__name__
else:
value = package.__name__ + value
- # Calling EntryPoint.load with an argument is deprecated.
- # See https://pythonhosted.org/setuptools/history.html#id8
- ep = pkg_resources.EntryPoint.parse('x=%s' % value)
- if hasattr(ep, 'resolve'):
- # setuptools>=10.2
- return ep.resolve() # pragma: NO COVER
- else:
- return ep.load(False) # pragma: NO COVER
+ # logic below is similar to importlib.metadata.EntryPoint.load()
+ module = value
+ attrs = []
+ parts = value.split(':', 1)
+ if len(parts) == 2:
+ module, attrs = parts
+ attrs = attrs.split('.')
+ module = import_module(module)
+ try:
+ return functools.reduce(getattr, attrs, module)
+ except AttributeError as ex:
+ raise ImportError(str(ex))
def _zope_dottedname_style(self, value, package):
"""package.module.attr style"""
diff --git a/src/pyramid/scripts/pdistreport.py b/src/pyramid/scripts/pdistreport.py
index 99615c1d5..eb41c17e7 100644
--- a/src/pyramid/scripts/pdistreport.py
+++ b/src/pyramid/scripts/pdistreport.py
@@ -1,6 +1,6 @@
import argparse
+import importlib.metadata
from operator import itemgetter
-import pkg_resources
import platform
import sys
@@ -21,7 +21,7 @@ def get_parser():
def main(
argv=sys.argv,
- pkg_resources=pkg_resources,
+ importlib_metadata=importlib.metadata,
platform=platform.platform,
out=out,
):
@@ -29,25 +29,25 @@ def main(
parser = get_parser()
parser.parse_args(argv[1:])
packages = []
- for distribution in pkg_resources.working_set:
- name = distribution.project_name
+ for distribution in importlib_metadata.distributions():
+ name = distribution.metadata['Name']
packages.append(
{
'version': distribution.version,
'lowername': name.lower(),
'name': name,
- 'location': distribution.location,
+ 'summary': distribution.metadata.get('Summary'),
}
)
packages = sorted(packages, key=itemgetter('lowername'))
- pyramid_version = pkg_resources.get_distribution('pyramid').version
+ pyramid_version = importlib_metadata.distribution('pyramid').version
plat = platform()
out('Pyramid version:', pyramid_version)
out('Platform:', plat)
out('Packages:')
for package in packages:
out(' ', package['name'], package['version'])
- out(' ', package['location'])
+ out(' ', package['summary'])
if __name__ == '__main__': # pragma: no cover
diff --git a/src/pyramid/scripts/pshell.py b/src/pyramid/scripts/pshell.py
index 63600abaf..4d3817ffb 100644
--- a/src/pyramid/scripts/pshell.py
+++ b/src/pyramid/scripts/pshell.py
@@ -1,8 +1,8 @@
import argparse
from code import interact
from contextlib import contextmanager
+import importlib.metadata
import os
-import pkg_resources
import sys
import textwrap
@@ -41,7 +41,7 @@ class PShellCommand:
script_name = 'pshell'
bootstrap = staticmethod(bootstrap) # for testing
get_config_loader = staticmethod(get_config_loader) # for testing
- pkg_resources = pkg_resources # for testing
+ importlib_metadata = importlib.metadata # for testing
parser = argparse.ArgumentParser(
description=textwrap.dedent(description),
@@ -228,10 +228,16 @@ class PShellCommand:
return 0
def find_all_shells(self):
- pkg_resources = self.pkg_resources
+ importlib_metadata = self.importlib_metadata
shells = {}
- for ep in pkg_resources.iter_entry_points('pyramid.pshell_runner'):
+ eps = importlib_metadata.entry_points()
+ if hasattr(eps, 'select'):
+ eps = eps.select(group='pyramid.pshell_runner')
+ else: # pragma: no cover
+ # fallback for py38 and py39
+ eps = eps.get('pyramid.pshell_runner')
+ for ep in eps:
name = ep.name
shell_factory = ep.load()
shells[name] = shell_factory
diff --git a/tests/test_scripts/dummy.py b/tests/test_scripts/dummy.py
index 5768f071e..758d3c9fd 100644
--- a/tests/test_scripts/dummy.py
+++ b/tests/test_scripts/dummy.py
@@ -154,26 +154,6 @@ class DummyBootstrap:
}
-class DummyEntryPoint:
- def __init__(self, name, module):
- self.name = name
- self.module = module
-
- def load(self):
- return self.module
-
-
-class DummyPkgResources:
- def __init__(self, entry_point_values):
- self.entry_points = []
-
- for name, module in entry_point_values.items():
- self.entry_points.append(DummyEntryPoint(name, module))
-
- def iter_entry_points(self, name):
- return self.entry_points
-
-
class dummy_setup_logging:
def __call__(self, config_uri, global_conf):
self.config_uri = config_uri
diff --git a/tests/test_scripts/test_pdistreport.py b/tests/test_scripts/test_pdistreport.py
index 079722734..2bcaad0b3 100644
--- a/tests/test_scripts/test_pdistreport.py
+++ b/tests/test_scripts/test_pdistreport.py
@@ -1,3 +1,4 @@
+import email.message
import unittest
@@ -12,14 +13,14 @@ class TestPDistReportCommand(unittest.TestCase):
def platform():
return 'myplatform'
- pkg_resources = DummyPkgResources()
+ importlib_metadata = DummyImportlibMetadata()
L = []
def out(*args):
L.extend(args)
result = self._callFUT(
- pkg_resources=pkg_resources, platform=platform, out=out
+ importlib_metadata=importlib_metadata, platform=platform, out=out
)
self.assertEqual(result, None)
self.assertEqual(
@@ -32,14 +33,14 @@ class TestPDistReportCommand(unittest.TestCase):
return 'myplatform'
working_set = (DummyDistribution('abc'), DummyDistribution('def'))
- pkg_resources = DummyPkgResources(working_set)
+ importlib_metadata = DummyImportlibMetadata(working_set)
L = []
def out(*args):
L.extend(args)
result = self._callFUT(
- pkg_resources=pkg_resources, platform=platform, out=out
+ importlib_metadata=importlib_metadata, platform=platform, out=out
)
self.assertEqual(result, None)
self.assertEqual(
@@ -54,31 +55,30 @@ class TestPDistReportCommand(unittest.TestCase):
'abc',
'1',
' ',
- '/projects/abc',
+ 'summary for name=\'abc\'',
' ',
'def',
'1',
' ',
- '/projects/def',
+ 'summary for name=\'def\'',
],
)
-class DummyPkgResources:
- def __init__(self, working_set=()):
- self.working_set = working_set
+class DummyImportlibMetadata:
+ def __init__(self, distributions=()):
+ self._distributions = distributions
- def get_distribution(self, name):
- return Version('1')
+ def distribution(self, name):
+ return DummyDistribution(name)
-
-class Version:
- def __init__(self, version):
- self.version = version
+ def distributions(self):
+ return iter(self._distributions)
class DummyDistribution:
def __init__(self, name):
- self.project_name = name
self.version = '1'
- self.location = '/projects/%s' % name
+ self.metadata = email.message.Message()
+ self.metadata['Name'] = name
+ self.metadata['Summary'] = f'summary for {name=}'
diff --git a/tests/test_scripts/test_pshell.py b/tests/test_scripts/test_pshell.py
index de7e17496..a5eeee045 100644
--- a/tests/test_scripts/test_pshell.py
+++ b/tests/test_scripts/test_pshell.py
@@ -1,4 +1,5 @@
import os
+import sys
import unittest
from . import dummy
@@ -50,7 +51,10 @@ class TestPShellCommand(unittest.TestCase):
return cmd
def _makeEntryPoints(self, command, shells):
- command.pkg_resources = dummy.DummyPkgResources(shells)
+ entry_points = [
+ DummyEntryPoint(name, value) for name, value in shells.items()
+ ]
+ command.importlib_metadata = DummyImportlibMetadata(entry_points)
def test_command_loads_default_shell(self):
command = self._makeOne()
@@ -430,3 +434,35 @@ class Test_main(unittest.TestCase):
def test_it(self):
result = self._callFUT(['pshell'])
self.assertEqual(result, 2)
+
+
+class DummyImportlibMetadata:
+ def __init__(self, entry_points):
+ self._entry_points = entry_points
+
+ def entry_points(self):
+ return DummyEntryPoints(self._entry_points)
+
+
+class DummyEntryPoints:
+ def __init__(self, entry_points):
+ self._entry_points = entry_points
+
+ if sys.version_info >= (3, 10):
+
+ def select(self, **kw):
+ return iter(self._entry_points)
+
+ else: # pragma no cover
+
+ def get(self, key):
+ return list(self._entry_points)
+
+
+class DummyEntryPoint:
+ def __init__(self, name, value):
+ self.name = name
+ self.value = value
+
+ def load(self):
+ return self.value