From 49e48ebe45b4509181d53c15890c3a2a1daeec68 Mon Sep 17 00:00:00 2001 From: Vytautas Liuolia Date: Sun, 18 Aug 2024 10:10:54 +0200 Subject: [PATCH 01/11] chore: prototype removal of `setup.cfg` (WiP) --- falcon/version.py | 2 +- pyproject.toml | 81 +++++++++++++++++++++++++++++++++++++++++++---- setup.cfg | 80 ---------------------------------------------- setup.py | 1 + 4 files changed, 77 insertions(+), 87 deletions(-) delete mode 100644 setup.cfg diff --git a/falcon/version.py b/falcon/version.py index c3971dba6..0a9005c05 100644 --- a/falcon/version.py +++ b/falcon/version.py @@ -14,5 +14,5 @@ """Falcon version.""" -__version__ = '4.0.0' +__version__ = '4.0.0.dev1' """Current version of Falcon.""" diff --git a/pyproject.toml b/pyproject.toml index 4a58ef88c..2cbfb928c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,10 +1,79 @@ [build-system] - build-backend = "setuptools.build_meta" - requires = [ - "setuptools>=47", - "wheel>=0.34", - "cython>=3.0.8; python_implementation == 'CPython'", # Skip cython when using pypy - ] +build-backend = "setuptools.build_meta" +requires = [ + "setuptools>=47", + "wheel>=0.34", + "cython>=3.0.8; python_implementation == 'CPython'", # Skip cython when using pypy +] + +[project] +name = "falcon" +dynamic = ["version", "readme"] +dependencies = [] +requires-python = ">=3.8" +description = "The ultra-reliable, fast ASGI+WSGI framework for building data plane APIs at scale." +authors = [ + {name = "Kurt Griffiths", email = "mail@kgriffs.com"}, +] +license = {text = "Apache 2.0"} +classifiers = [ + "Development Status :: 5 - Production/Stable", + "Environment :: Web Environment", + "Natural Language :: English", + "Intended Audience :: Developers", + "Intended Audience :: System Administrators", + "License :: OSI Approved :: Apache Software License", + "Operating System :: MacOS :: MacOS X", + "Operating System :: Microsoft :: Windows", + "Operating System :: POSIX", + "Topic :: Internet :: WWW/HTTP :: WSGI", + "Topic :: Software Development :: Libraries :: Application Frameworks", + "Programming Language :: Python", + "Programming Language :: Python :: Implementation :: CPython", + "Programming Language :: Python :: Implementation :: PyPy", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", + "Programming Language :: Python :: 3.13", + "Programming Language :: Cython", +] +keywords = [ + "asgi", + "wsgi", + "web", + "api", + "framework", + "rest", + "http", + "cloud", +] + +[project.scripts] +falcon-bench = "falcon.cmd.bench:main" +falcon-inspect-app = "falcon.cmd.inspect_app:main" +falcon-print-routes = "falcon.cmd.inspect_app:route_main" + +[project.urls] +Homepage = "https://falconframework.org" +Documentation = "https://falcon.readthedocs.io/en/stable/" +"Release Notes" = "https://falcon.readthedocs.io/en/stable/changes/" +"Source" = "https://github.com/falconry/falcon" +"Issue Tracker" = "https://github.com/falconry/falcon/issues" +Funding = "https://opencollective.com/falcon" +Chat = "https://gitter.im/falconry/user" + +[tool.setuptools] +include-package-data = true +zip-safe = false + +[tool.setuptools.dynamic] +version = {attr = "falcon.version.__version__"} + +[tool.setuptools.packages.find] +exclude = ["examples", "tests"] [tool.mypy] exclude = [ diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index 04a693b0f..000000000 --- a/setup.cfg +++ /dev/null @@ -1,80 +0,0 @@ -[metadata] -name = falcon -version = attr: falcon.__version__ -description = The ultra-reliable, fast ASGI+WSGI framework for building data plane APIs at scale. -long_description_content_type = text/x-rst -url = https://falconframework.org -author = Kurt Griffiths -author_email = mail@kgriffs.com -license = Apache 2.0 -license_files = LICENSE -classifiers = - Development Status :: 5 - Production/Stable - Environment :: Web Environment - Natural Language :: English - Intended Audience :: Developers - Intended Audience :: System Administrators - License :: OSI Approved :: Apache Software License - Operating System :: MacOS :: MacOS X - Operating System :: Microsoft :: Windows - Operating System :: POSIX - Topic :: Internet :: WWW/HTTP :: WSGI - Topic :: Software Development :: Libraries :: Application Frameworks - Programming Language :: Python - Programming Language :: Python :: Implementation :: CPython - Programming Language :: Python :: Implementation :: PyPy - Programming Language :: Python :: 3 - Programming Language :: Python :: 3.8 - Programming Language :: Python :: 3.9 - Programming Language :: Python :: 3.10 - Programming Language :: Python :: 3.11 - Programming Language :: Python :: 3.12 - Programming Language :: Python :: 3.13 - Programming Language :: Cython -keywords = - asgi - wsgi - web - api - framework - rest - http - cloud -project_urls = - Documentation=https://falcon.readthedocs.io/en/stable/ - Release Notes=https://falcon.readthedocs.io/en/stable/changes/ - Source=https://github.com/falconry/falcon - Issue Tracker=https://github.com/falconry/falcon/issues - Funding=https://opencollective.com/falcon - Chat=https://gitter.im/falconry/user - -[options] -zip_safe = False -include_package_data = True -packages = find: -python_requires = >=3.8 -install_requires = -tests_require = - testtools - requests - pyyaml - pytest - pytest-runner - -[options.packages.find] -exclude = - examples - tests - -[options.entry_points] -console_scripts = - falcon-bench = falcon.cmd.bench:main - falcon-inspect-app = falcon.cmd.inspect_app:main - falcon-print-routes = falcon.cmd.inspect_app:route_main - -[egg_info] -# TODO replace -tag_build = dev1 - -[aliases] -test=pytest diff --git a/setup.py b/setup.py index 2927b1ba2..06c030b56 100644 --- a/setup.py +++ b/setup.py @@ -132,6 +132,7 @@ def status_msgs(*msgs): setup( long_description=load_description(), + long_description_content_type = 'text/x-rst', cmdclass=cmdclass, ext_modules=ext_modules, ) From ecdb28e27dbb79a1cb0a82ef36d8851a2e842b8c Mon Sep 17 00:00:00 2001 From: Vytautas Liuolia Date: Sun, 18 Aug 2024 11:02:24 +0200 Subject: [PATCH 02/11] chore(pyproject.toml): patch up license-files --- pyproject.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/pyproject.toml b/pyproject.toml index 2cbfb928c..2926a2100 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -67,6 +67,7 @@ Chat = "https://gitter.im/falconry/user" [tool.setuptools] include-package-data = true +license-files = ["LICENSE"] zip-safe = false [tool.setuptools.dynamic] From 35d072a477f73def1164aa5954a113aa1ceda766 Mon Sep 17 00:00:00 2001 From: Vytautas Liuolia Date: Sun, 18 Aug 2024 11:21:07 +0200 Subject: [PATCH 03/11] docs(README): use PyPI compatible embedding of README --- README.rst | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/README.rst b/README.rst index cb1105237..d033e1a5d 100644 --- a/README.rst +++ b/README.rst @@ -1,12 +1,8 @@ -.. raw:: html - - - Falcon web framework logo - +.. image:: https://raw.githubusercontent.com/falconry/falcon/master/logo/banner.jpg + :align: center + :alt: Falcon logo + :target: https://falconframework.org/ + :width: 100 % |Build Status| |Docs| |codecov.io| From 6695ff146ad63b23120ca5c630d5decc469ae82b Mon Sep 17 00:00:00 2001 From: Vytautas Liuolia Date: Sun, 18 Aug 2024 20:49:29 +0200 Subject: [PATCH 04/11] docs(README): make readme static --- README.rst | 33 ++++++++------------------------- pyproject.toml | 3 ++- setup.py | 47 +---------------------------------------------- 3 files changed, 11 insertions(+), 72 deletions(-) diff --git a/README.rst b/README.rst index d033e1a5d..50087cb6a 100644 --- a/README.rst +++ b/README.rst @@ -84,28 +84,7 @@ Falcon tries to do as little as possible while remaining highly effective. A Big Thank You to Our Patrons! ------------------------------- -.. raw:: html - -

- CERT Gouvernemental Luxembourg -

- -

- Examination RU - - Paris Kejser - - Algolia - - Salesforce -

- -

- Misaka Network - Likalo -

- -.. Patron list ends here (see the comment above this section). +|Backer:GovCert| Has Falcon helped you make an awesome app? Show your support today with a one-time donation or by becoming a patron. Supporters get cool gear, an opportunity to promote their brand to Python developers, and prioritized support. @@ -1039,9 +1018,13 @@ See the License for the specific language governing permissions and limitations under the License. .. |Docs| image:: https://readthedocs.org/projects/falcon/badge/?version=stable - :target: https://falcon.readthedocs.io/en/stable/?badge=stable :alt: Falcon web framework docs + :target: https://falcon.readthedocs.io/en/stable/?badge=stable .. |Build Status| image:: https://github.com/falconry/falcon/workflows/Run%20tests/badge.svg - :target: https://github.com/falconry/falcon/actions?query=workflow%3A%22Run+tests%22 + :target: https://github.com/falconry/falcon/actions?query=workflow%3A%22Run+tests%22 .. |codecov.io| image:: https://codecov.io/gh/falconry/falcon/branch/master/graphs/badge.svg - :target: http://codecov.io/gh/falconry/falcon + :target: http://codecov.io/gh/falconry/falcon +.. |Backer:GovCert| image:: https://falconframework.org/assets/govcert.png + :alt: CERT Gouvernemental Luxembourg + :height: 60px + :target: https://www.govcert.lu/ diff --git a/pyproject.toml b/pyproject.toml index 2926a2100..be34716d1 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -8,7 +8,8 @@ requires = [ [project] name = "falcon" -dynamic = ["version", "readme"] +readme = "README.rst" +dynamic = ["version"] dependencies = [] requires-python = ">=3.8" description = "The ultra-reliable, fast ASGI+WSGI framework for building data plane APIs at scale." diff --git a/setup.py b/setup.py index 06c030b56..9751f825c 100644 --- a/setup.py +++ b/setup.py @@ -1,9 +1,7 @@ import glob -import io import os from os import path import platform -import re from setuptools import setup @@ -92,47 +90,4 @@ def list_modules(dirname, pattern): cmdclass = {} -def load_description(): - in_patron_list = False - in_patron_replacement = False - in_raw = False - - description_lines = [] - - # NOTE(kgriffs): PyPI does not support the raw directive - for readme_line in io.open('README.rst', 'r', encoding='utf-8'): - # NOTE(vytas): The patron list largely builds upon raw sections - if readme_line.startswith('.. Patron list starts'): - in_patron_list = True - in_patron_replacement = True - continue - elif in_patron_list: - if not readme_line.strip(): - in_patron_replacement = False - elif in_patron_replacement: - description_lines.append(readme_line.lstrip()) - if readme_line.startswith('.. Patron list ends'): - in_patron_list = False - continue - elif readme_line.startswith('.. raw::'): - in_raw = True - elif in_raw: - if readme_line and not re.match(r'\s', readme_line): - in_raw = False - - if not in_raw: - description_lines.append(readme_line) - - return ''.join(description_lines) - - -def status_msgs(*msgs): - print('*' * 75, *msgs, '*' * 75, sep='\n') - - -setup( - long_description=load_description(), - long_description_content_type = 'text/x-rst', - cmdclass=cmdclass, - ext_modules=ext_modules, -) +setup(cmdclass=cmdclass, ext_modules=ext_modules) From d4cd76e2795014e2d70e2569e5555d8bc77e7b59 Mon Sep 17 00:00:00 2001 From: Vytautas Liuolia Date: Sun, 18 Aug 2024 21:08:02 +0200 Subject: [PATCH 05/11] chore(docs/conf.py): fix docs not to depend on `setup.cfg` --- docs/conf.py | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/docs/conf.py b/docs/conf.py index 4ef269e33..f5b7b40d5 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -10,12 +10,11 @@ # All configuration values have a default; values that are commented out # serve to show the default. -from datetime import datetime from collections import OrderedDict -import configparser +from datetime import datetime import multiprocessing -import sys import os +import sys sys.path.insert(0, os.path.abspath('..')) @@ -86,19 +85,19 @@ # |version| and |release|, also used in various other places throughout the # built documents. -cfg = configparser.ConfigParser() -cfg.read('../setup.cfg') -tag = cfg.get('egg_info', 'tag_build') +_version_components = falcon.__version__.split('.') +_prerelease = any( + not component.isdigit() and not component.startswith('post') + for component in _version_components +) -html_context = { - 'prerelease': bool(tag), # True if tag is not the empty string -} +html_context = {'prerelease': _prerelease} # The short X.Y version. -version = '.'.join(falcon.__version__.split('.')[0:2]) + tag +version = '.'.join(_version_components[0:2]) # The full version, including alpha/beta/rc tags. -release = falcon.__version__ + tag +release = falcon.__version__ # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. From 1182ef07a9babc4ad8d9cab4a10bfe59193c62ed Mon Sep 17 00:00:00 2001 From: Vytautas Liuolia Date: Mon, 19 Aug 2024 14:11:03 +0200 Subject: [PATCH 06/11] chore(pyproject.toml):explicitly specify `text/x-rst` media type --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index be34716d1..b1a729e17 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -8,7 +8,7 @@ requires = [ [project] name = "falcon" -readme = "README.rst" +readme = {file = "README.rst", content-type = "text/x-rst"} dynamic = ["version"] dependencies = [] requires-python = ">=3.8" From c0136fbcd059d890922ef1db56e9207f3c0a9f72 Mon Sep 17 00:00:00 2001 From: Vytautas Liuolia Date: Mon, 19 Aug 2024 21:05:47 +0200 Subject: [PATCH 07/11] docs(README): add Sentry --- README.rst | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/README.rst b/README.rst index 50087cb6a..296b18dad 100644 --- a/README.rst +++ b/README.rst @@ -84,7 +84,7 @@ Falcon tries to do as little as possible while remaining highly effective. A Big Thank You to Our Patrons! ------------------------------- -|Backer:GovCert| +|Backer:GovCert| |Backer:Sentry| Has Falcon helped you make an awesome app? Show your support today with a one-time donation or by becoming a patron. Supporters get cool gear, an opportunity to promote their brand to Python developers, and prioritized support. @@ -1028,3 +1028,7 @@ limitations under the License. :alt: CERT Gouvernemental Luxembourg :height: 60px :target: https://www.govcert.lu/ +.. |Backer:Sentry| image:: https://falconframework.org/assets/sentry-dark.svg + :alt: Sentry + :height: 60px + :target: https://sentry.io From 6f9a1ee9ee41d969e7ae080eb6bd2a23ce4ea2e2 Mon Sep 17 00:00:00 2001 From: Vytautas Liuolia Date: Sat, 31 Aug 2024 13:16:33 +0200 Subject: [PATCH 08/11] docs: polish newsfragments --- docs/_newsfragments/2182.breakingchange.rst | 5 +++-- docs/_newsfragments/2253.misc.rst | 5 +++-- docs/_newsfragments/2301.misc.rst | 3 ++- docs/_newsfragments/2314.breakingchange.rst | 5 +++++ 4 files changed, 13 insertions(+), 5 deletions(-) create mode 100644 docs/_newsfragments/2314.breakingchange.rst diff --git a/docs/_newsfragments/2182.breakingchange.rst b/docs/_newsfragments/2182.breakingchange.rst index aeeb2e308..14853175b 100644 --- a/docs/_newsfragments/2182.breakingchange.rst +++ b/docs/_newsfragments/2182.breakingchange.rst @@ -1,2 +1,3 @@ -The function :func:`falcon.http_date_to_dt` now validates http-dates to have the correct -timezone set. It now also returns timezone aware datetime objects. +The function :func:`falcon.http_date_to_dt` now validates HTTP dates to have +the correct timezone set. It now also returns timezone-aware +:class:`~datetime.datetime` objects. diff --git a/docs/_newsfragments/2253.misc.rst b/docs/_newsfragments/2253.misc.rst index ea7118af4..805753494 100644 --- a/docs/_newsfragments/2253.misc.rst +++ b/docs/_newsfragments/2253.misc.rst @@ -1,2 +1,3 @@ -The functions ``create_task()`` and ``get_running_loop()`` of `falcon.util.sync` are deprecated. -The counterpart functions in the builtin package `asyncio` are encouraged to be used. +The :ref:`utility functions` ``create_task()`` and ``get_running_loop()`` are +now deprecated in favor of their standard library counterparts, +:func:`asyncio.create_task` and `:func:`asyncio.get_running_loop`. diff --git a/docs/_newsfragments/2301.misc.rst b/docs/_newsfragments/2301.misc.rst index fe8c43ab4..e6d2c8f89 100644 --- a/docs/_newsfragments/2301.misc.rst +++ b/docs/_newsfragments/2301.misc.rst @@ -1 +1,2 @@ -Deprecated the ``TimezoneGMT`` class. Use :attr:`datetime.timezone.utc` instead. +The ``falcon.TimezoneGMT`` class was deprecated. Use the UTC timezone +(:attr:`datetime.timezone.utc`) from the standard library instead. diff --git a/docs/_newsfragments/2314.breakingchange.rst b/docs/_newsfragments/2314.breakingchange.rst new file mode 100644 index 000000000..a1783ef02 --- /dev/null +++ b/docs/_newsfragments/2314.breakingchange.rst @@ -0,0 +1,5 @@ +``setup.cfg`` was dropped in favor of consolidating all static project +configuration in ``pyproject.toml`` (``setup.py`` is still needed for +programmatic control of the build process). While this change should not impact +the framework's end-users directly, some ``setuptools``\-based legacy workflows +(such as the obsolete ``setup.py test``) will no longer work. From f51ae1ca5f624b7818cfdee18b57ac707b4ac68f Mon Sep 17 00:00:00 2001 From: Vytautas Liuolia Date: Sat, 31 Aug 2024 14:29:36 +0200 Subject: [PATCH 09/11] docs: fix one newsfragment, update `RELEASE.md` --- RELEASE.md | 36 ++++++++++++++++++------------- docs/_newsfragments/2253.misc.rst | 6 +++--- 2 files changed, 24 insertions(+), 18 deletions(-) diff --git a/RELEASE.md b/RELEASE.md index 81ac71cef..7ebfd7d79 100644 --- a/RELEASE.md +++ b/RELEASE.md @@ -2,7 +2,7 @@ Release Process: -1. Bump version and update tag. +1. Bump version (including the suffix for pre-release, if applicable). 2. Update changelog and render towncrier fragments. 3. Release beta or rc. 4. Run benchmark and check for regressions. @@ -12,16 +12,30 @@ Release Process: 8. Announce the new version in Gitter channels and on the socials. 9. Improve this document. -### Bump version and update tag +### Bump version Modify `falcon/version.py` if it has not been updated since the previous release. Examine the rendered changelog to determine the appropriate SEMVER field to modify. -Update changelog filename in `pyproject.toml` to suit. +Note that we have dropped `setup.cfg` altogether, so `__version__` in +`falcon/version.py` must contain the **whole version** +(including the previously separately managed `tag_build`), for instance: +```python +# Development version +__version__ = '4.0.0.dev1' + +# First alpha +__version__ = '4.0.0a1' + +# Release candidate +__version__ = '4.0.0rc1' + +# Stable release +__version__ = '4.0.0' +``` -Update the build tag in `setup.cfg` under `[egg_info]` for pre-release builds, -or remove it (leaving it blank as in `tag_build =`) for a final release. +Update changelog filename in `pyproject.toml` to suit. ### Update changelog and render towncrier fragments @@ -30,22 +44,14 @@ the following template, and update the summary and changes to supported platforms to suit: ```rst -Changelog for Falcon 3.0.1 +Changelog for Falcon 4.0.1 ========================== Summary ------- This is a minor point release to take care of a couple of bugs that we did -not catch for 3.0.0. - -Changes to Supported Platforms ------------------------------- - -- CPython 3.10 is now fully supported. (`#1966 `__) -- Support for Python 3.6 is now deprecated and will be removed in Falcon 4.0. -- As with the previous release, Python 3.5 support remains deprecated and will - no longer be supported in Falcon 4.0. +not catch for 4.0.0. .. towncrier release notes start diff --git a/docs/_newsfragments/2253.misc.rst b/docs/_newsfragments/2253.misc.rst index 805753494..256f4a736 100644 --- a/docs/_newsfragments/2253.misc.rst +++ b/docs/_newsfragments/2253.misc.rst @@ -1,3 +1,3 @@ -The :ref:`utility functions` ``create_task()`` and ``get_running_loop()`` are -now deprecated in favor of their standard library counterparts, -:func:`asyncio.create_task` and `:func:`asyncio.get_running_loop`. +The :ref:`utility functions ` ``create_task()`` and +``get_running_loop()`` are now deprecated in favor of their standard library +counterparts, :func:`asyncio.create_task` and `:func:`asyncio.get_running_loop`. From 5e3d4d1039e9d09493c4f1f19e487f583eb9e2bc Mon Sep 17 00:00:00 2001 From: Vytautas Liuolia Date: Sat, 31 Aug 2024 16:50:01 +0200 Subject: [PATCH 10/11] chore: specify test dependencies --- pyproject.toml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pyproject.toml b/pyproject.toml index d7012c408..ba2a8e87b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -53,6 +53,9 @@ keywords = [ "cloud", ] +[project.optional-dependencies] +test = ["pytest"] + [project.scripts] falcon-bench = "falcon.cmd.bench:main" falcon-inspect-app = "falcon.cmd.inspect_app:main" From e46c447ac4d715d83319f776b234464e872832aa Mon Sep 17 00:00:00 2001 From: Vytautas Liuolia Date: Sat, 31 Aug 2024 21:34:44 +0200 Subject: [PATCH 11/11] chore: remove extraneous wheel build requirement --- pyproject.toml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index ba2a8e87b..5a9040bac 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,8 +1,7 @@ [build-system] build-backend = "setuptools.build_meta" requires = [ - "setuptools>=47", - "wheel>=0.34", + "setuptools>=61", "cython>=3.0.8; python_implementation == 'CPython'", # Skip cython when using pypy ]