网页
综合
更新时间 2026-11-13 16:47:23
Release Notes — Bottle 0.14-dev documentation
自动蜘蛛
bottlepy.org
正文约 6000 字
This project loosly follows Semantic Versioning (major.minor.patch), with the exception that changes are allowed in minor releases as long as the change is necessary to match documentation, specification or expectation. In other words: Bugfixes do not count as backward incompatible changes, even if they technically change something from incorrect to correct and may break applications that rely on incorrect, undefined or undocumented behavior.
As long as the major version is still 0.x, breaking API changes are also allowed in minor releases, but we try our best to provide fallbacks and emit deprecation warnings for at least one minor release circle.
Upgrade to the most recent patch release available for your current minor release. (e.g. 0.12.3 to 0.12.25)
Read the release notes for the next minor release, run your tests and fix all deprecation warnings.
Upgrade to the next minor release (e.g. 0.12.25 to 0.13.2), run test again, fix all warnings and continue.
Support for old releases
Bugs and security issues are usually fixed in the latest minor release of the two most recent major releases (named stable and old-stable). With each new major release, stable becomes old-stable and the old old-stable will no longer receive regular updates. LTS releases (e.g. 0.12) are an exception. Those will continue to receive updates on a best-effort basis.
Deprecated APIs or behavior
Route.get_undecorated_callback() was able to look into closure cells to guess the original function wrapped by a decorator, but this is too aggressive in some cases and may return the wrong function. To avoid this, we will depend on proper use of @functools.wraps(orig) or functools.update_wrapper(wrapper, orig) in decorators in the future.
Dropped support for Python 2 (EOL: 2020-01-01) and removed workarounds or helpers that only make sense in a Python 2/3 dual codebase.
Dropped support for Python 3.8 (EOL: 2024-10-07).
Removed the RouteReset exception and associated logic.
Removed the bottle.py console script entrypoint in favour of the new bottle script. You can still execute bottle.py directly or via python -m bottle. The only change is that the command installed by pip or similar tools into the bin/Scripts folder of the (virtual) environment is now called bottle to avoid circular import errors.
Form values, query parameters, path elements and cookies are now always decoded as utf8 with errors=’surrogateescape’. This is the correct approach for almost all modern web applications, but still allows applications to recover the original byte sequence if needed. This also means that bottle.FormsDict no longer re-encodes PEP-3333 latin1 strings to utf8 on demand (via attribute access). The FormsDict.getunicode() and FormsDict.decode() methods are deprecated and do nothing, as all values are already transcoded to utf8.
bottle.HTTPError raised on invalid JSON now include the underlying exception in the exception field.
This release contains breaking changers, please read the notes below
Dropped support for Python versions that reached their end-of-life.
Bottle up to 0.12 supported an absurd range of Python versions (2.5 to 3.12) and keeping support for Python versions as ancient as 2.5 required a ton of workarounds and compromises, but served no real purpose. If you need support for older Python versions, you can stay on bottle 0.12. The updated list of tested and supported python releases is as follows:
Support for Python 2.5 was marked as deprecated since 0.12. We decided to go a step further and also remove support for 2.6 and 3.1 to 3.7 even if it was never deprecated explicitly in bottle. This means that this release is not backwards compatible in Python <2.7.3 or <3.8 environments. Maintainers for distributions or systems that still use these old python versions should not update to Bottle 0.13 and stick with 0.12 instead.
The documented API of the ConfigDict class is now considered stable and ready to use.
Python 2 support is now deprecated and will be dropped with the next release. This includes helpers and workarounds that only make sense in a Python 2/3 dual codebase (e.g. tonat() or the py3k flag).
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/<name> syntax.
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 local_property() helper is now deprecated.
The server adapter for google app engine is not useful anymore and marked as deprecated.
Bottle uses pickle to store arbitrary objects into signed cookies. This is safe, as long as the signature key remains a secret. Unfortunately, people tend to push code with signature keys to github all the time, so we decided to remove pickle-support from bottle. Signed cookies will now issue a deprecation warning if the value is not a string, and support for non-string values will be removed in 0.14. The global cookie_encode(), cookie_decode() and is_cookie_encoded() are now also deprecated. If you are using this feature, think about using json to serialize your objects before storing them into cookies, or switch to a session system that stores data server-side instead of client-side.
Removed APIs (deprecated since 0.12)
Plugins with the old API (api=1 or no api attribute) will no longer work.
Parameter order of Bottle.mount() changed in 0.10. The old order will now result in an error instead of a warning.
The ConfigDict class was introduced in 0.11 and changed during 0.12. Th
本页为82搜索生成的网页快照,内容来自站内索引;演示数据的原文链接仅作示例。