Pboot
Pboot 是一个轻量级的 WSGI Web 应用框架,目标是让项目启动足够快,同时又能平滑扩展到复杂应用。
from pboot import Pboot
app = Pboot(__name__)
@app.route("/")
def hello():
return "Hello, Pboot!"
$ pboot run
* Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)
特性
- 轻量:核心只依赖 Werkzeug、Jinja、Click、ItsDangerous、MarkupSafe 与 Blinker
- 灵活:Pboot 只提供建议,不强制依赖或项目结构,开发者可以自由选择工具链
- 可扩展:通过统一的扩展接口,ORM、缓存、CSRF、HTTP 安全头等能力按需接入
- 完备:内置路由、模板、会话、蓝图、信号、测试客户端与 CLI
安装
$ pip install pboot
生态
| 扩展 | 说明 |
|---|---|
| pboot-pbatis | 基于 pbatis ORM 的数据库支持 |
| pboot-wtf | 表单渲染、校验、CSRF 防护与文件上传 |
| pboot-caching | 多后端缓存支持 |
| pboot-talisman | HTTP 安全响应头 |
| pboot-mongoengine | MongoEngine 集成 |
核心概念
应用与路由
from pboot import Pboot
app = Pboot(__name__)
@app.route("/users/<int:user_id>")
def show_user(user_id):
return f"User {user_id}"
@app.post("/users")
def create_user():
return "created", 201
蓝图
from pboot import Blueprint
bp = Blueprint("api", __name__)
@bp.route("/ping")
def ping():
return "pong"
模板
from pboot import render_template
@app.route("/hello/<name>")
def hello(name):
return render_template("hello.html", name=name)
配置
配置来自多种来源,按优先级从高到低依次为:
- 直接传给
Pboot(...)的构造参数 - 环境变量
- 配置文件
- 默认值
app.config["SECRET_KEY"] = "your-secret"
命令行
$ pboot --help
$ pboot run --port 8080
$ pboot routes
$ pboot shell
测试
Pboot 提供测试客户端与独立的测试运行器:
from pboot import Pboot
app = Pboot(__name__)
@app.route("/")
def index():
return "ok"
def test_index():
client = app.test_client()
assert client.get("/").data == b"ok"
环境变量
| 变量 | 说明 |
|---|---|
PBOOT_APP |
指定要加载的应用或工厂函数 |
PBOOT_DEBUG |
开启调试模式 |
PBOOT_RUN_PORT |
指定开发服务器端口 |
PBOOT_SKIP_DOTENV |
跳过 .pbootenv / .env 加载 |
参与贡献
问题反馈、功能建议与代码贡献都欢迎通过 pboot-org/pboot 提交。
许可证
BSD-3-Clause,详见 LICENSE.txt。
Metadata
Release files for pboot 3.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pboot-3.2.0.tar.gz | 834.9 kB | With provenance | Details for pboot-3.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pboot-3.2.0-py3-none-any.whl | Python 3 | none | any | Details for pboot-3.2.0-py3-none-any.whl |
Total release size: 941.3 kB
Release files / pboot-3.2.0.tar.gz
| Download URL | pboot-3.2.0.tar.gz |
|---|---|
| Size | 834.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c2835bca21f17aaafe5bea4a7b9f2b28a08392c67e3462d34e63a4e9c0cd932c
|
|
BLAKE2b-256 checksum How to use checksums |
67e13472dbb639f7585db7ecd14c9356573c422c2c5eb4dbec1ce8286843c3a0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 2, 2026.
Transparency logRelease files / pboot-3.2.0-py3-none-any.whl
| Download URL | pboot-3.2.0-py3-none-any.whl |
|---|---|
| Size | 106.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d1283cbfc9a3e5302617583cd9fd7ed845db942a3a18126486b5d0b0f484056e
|
|
BLAKE2b-256 checksum How to use checksums |
31ed8aaac3b51f41330c0047f0c3bad23d4d980e9fa41323ee59bf7978036c22
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 2, 2026.
Transparency logSecurity for pboot 3.2.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for pboot-3.2.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 2, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.