From 1df15b7c2e04554cb72e13c44b7687d3218f2f3d Mon Sep 17 00:00:00 2001 From: Marcel Hellkamp Date: Fri, 13 Sep 2024 18:22:37 +0200 Subject: [PATCH 1/2] docs: Added deprecation note for Python 2.x to release notes. --- docs/changelog.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/changelog.rst b/docs/changelog.rst index 244acdce..2556d29a 100755 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -33,6 +33,7 @@ versions should not update to Bottle 0.13 and stick with 0.12 instead. .. rubric:: Deprecated APIs +* Python 2 support is now deprecated and will be dropped with the next release. * The old route syntax (``/hello/:name``) is deprecated in favor of the more readable and flexible ``/hello/`` syntax. * :meth:`Bottle.mount` now recognizes Bottle instance and will warn about parameters that are not compatible with the new mounting behavior. The old behavior (mount applications as WSGI callable) still works and is used as a fallback automatically. * The undocumented :func:`local_property` helper is now deprecated. From 66d96a914ff28140bd1cd5466239c11c665dddb8 Mon Sep 17 00:00:00 2001 From: Marcel Hellkamp Date: Mon, 16 Sep 2024 17:16:28 +0200 Subject: [PATCH 2/2] change: Deprecate bottle.py script install The executable script installed into (virtual) environments was named `bottle.py`, which could result in circular imports. The old name is now deprecated (but still installed) and the new executable ist named just `bottle`. --- bottle.py | 6 +++++- docs/changelog.rst | 2 ++ docs/deployment.rst | 8 ++++---- docs/tutorial.rst | 33 ++++++++++++++++++++++++--------- setup.py | 5 +++++ 5 files changed, 40 insertions(+), 14 deletions(-) diff --git a/bottle.py b/bottle.py index 141c0a98..08688da0 100755 --- a/bottle.py +++ b/bottle.py @@ -4671,5 +4671,9 @@ def _cli_error(cli_msg): config=config) -if __name__ == '__main__': # pragma: no coverage +def main(): _main(sys.argv) + + +if __name__ == '__main__': # pragma: no coverage + main() diff --git a/docs/changelog.rst b/docs/changelog.rst index 2556d29a..6ed41c12 100755 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -34,6 +34,7 @@ versions should not update to Bottle 0.13 and stick with 0.12 instead. .. rubric:: Deprecated APIs * Python 2 support is now deprecated and will be dropped with the next release. +* The command line executable installed along with bottle will be renamed from `bottle.py` to just `bottle`. You can still execute bottle directly as a script (e.g. `./bottle.py` or `python3 bottle.py`) or as a module (via `python3 -m bottle`). Just the executable installed by your packaging tool (e.g. `pip`) into the `bin` folder of your (virtual) environment will change. * The old route syntax (``/hello/:name``) is deprecated in favor of the more readable and flexible ``/hello/`` syntax. * :meth:`Bottle.mount` now recognizes Bottle instance and will warn about parameters that are not compatible with the new mounting behavior. The old behavior (mount applications as WSGI callable) still works and is used as a fallback automatically. * The undocumented :func:`local_property` helper is now deprecated. @@ -65,6 +66,7 @@ These changes might require special care when updating. * Signed cookies now use a stronger HMAC algorithm by default. This will result in old cookies to appear invalid after the update. Pass an explicit ``digestmod=hashlib.md5`` to :meth:`BaseRequest.get_cookie` and :meth:`BaseResponse.set_cookie` to get the old behavior. * Bottle now ships with its own multipart form data parser (borrowed from `multipart `_) and no longer relies on ``cgi.FieldStorage``, which was removed in Python 3.13. This may change the way broken (non-standard) form submissions are parsed. The new parser is more strict and correct than ohe old one. +* Installing bottle with `pip` or similar tools will now install an additional command line executable named `bottle` into the `bin` folder of your (virtual) environment. This will replace the now deprecated `bottle.py` executable in a later release. See above. .. rubric:: Other Improvements diff --git a/docs/deployment.rst b/docs/deployment.rst index d1fc0522..bbb0a056 100644 --- a/docs/deployment.rst +++ b/docs/deployment.rst @@ -48,13 +48,13 @@ The easiest way to increase performance is to install a multi-threaded server li run(server='cheroot', ...) # Pure Python, runs everywhere run(server='gunicorn', ...) # High performance -Or using the ``bottle.py`` command line interface: +Or using the ``bottle`` command line interface: .. code-block:: sh - ./bottle.py --server gunicorn [...] mymodule:app + python3 -m bottle --server gunicorn [...] mymodule:app -For production deployments gunicorn_ is a really good choice. It comes with its own command line utility that supports a lot more options than ``bottle.py``. Since :class:`Bottle` instances are WSGI applications, you can tell gunicorn_ (or any other WSGI server) to load your app instead of calling :func:`run` yourself: +For production deployments gunicorn_ is a really good choice. It comes with its own command line utility that supports a lot more options than bottle. Since :class:`Bottle` instances are WSGI applications, you can tell gunicorn_ (or any other WSGI server) to load your app instead of calling :func:`run` yourself: .. code-block:: sh @@ -65,7 +65,7 @@ This will start your application with 4 gunicorn workers and sane default settin Server adapters ------------------------------------------------------------------------------ -Bottle ships with a bunch of ready-to-use adapters for the most common WSGI servers so you can try out different server backends easily. You can select a server backend via `run(server='NAME')` or `bottle.py --server NAME`. Here is an incomplete list: +Bottle ships with a bunch of ready-to-use adapters for the most common WSGI servers so you can try out different server backends easily. You can select a server backend via `run(server='NAME')` or `python3 -m bottle --server NAME`. Here is an incomplete list: ======== ============ ====================================================== Name Homepage Description diff --git a/docs/tutorial.rst b/docs/tutorial.rst index e3c61b74..7e2600b0 100755 --- a/docs/tutorial.rst +++ b/docs/tutorial.rst @@ -30,9 +30,9 @@ It is usually a better idea to create a `virtualenv