diff --git a/bottle.py b/bottle.py index a3c759a7..7ac973c0 100755 --- a/bottle.py +++ b/bottle.py @@ -4658,5 +4658,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 0688b1c4..33e5fda3 100755 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -42,6 +42,8 @@ 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. @@ -73,6 +75,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:`Request.get_cookie ` and :meth:`Response.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 5714cd6c..af7c53c4 100755 --- a/docs/tutorial.rst +++ b/docs/tutorial.rst @@ -30,9 +30,9 @@ It is usually a better idea to create a `virtualenv