bustapi 0.1.0__tar.gz → 0.1.5__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of bustapi might be problematic. Click here for more details.
- {bustapi-0.1.0 → bustapi-0.1.5}/.github/workflows/ci.yml +1 -4
- {bustapi-0.1.0 → bustapi-0.1.5}/.gitignore +3 -1
- bustapi-0.1.5/CHANGELOG.md +12 -0
- {bustapi-0.1.0 → bustapi-0.1.5}/Cargo.lock +38 -48
- {bustapi-0.1.0 → bustapi-0.1.5}/Cargo.toml +1 -0
- {bustapi-0.1.0 → bustapi-0.1.5}/LICENSE +1 -1
- bustapi-0.1.5/PKG-INFO +324 -0
- bustapi-0.1.5/README.md +271 -0
- bustapi-0.1.5/benchmarks/README.md +67 -0
- bustapi-0.1.5/benchmarks/apps/bustapi_app.py +12 -0
- bustapi-0.1.5/benchmarks/apps/fastapi_app.py +14 -0
- bustapi-0.1.5/benchmarks/apps/flask_app.py +12 -0
- bustapi-0.1.5/benchmarks/benchmark_server.py +129 -0
- bustapi-0.1.5/benchmarks/comprehensive_benchmark.py +336 -0
- bustapi-0.1.5/benchmarks/fastapi_server.py +41 -0
- bustapi-0.1.5/benchmarks/flask_server.py +44 -0
- bustapi-0.1.5/benchmarks/framework_comparison.py +323 -0
- bustapi-0.1.5/benchmarks/last_results.txt +3 -0
- bustapi-0.1.5/benchmarks/run_bench.py +211 -0
- bustapi-0.1.5/docs/README.md +71 -0
- bustapi-0.1.5/docs/api-reference.md +440 -0
- bustapi-0.1.5/docs/deployment.md +797 -0
- bustapi-0.1.5/docs/installation.md +152 -0
- bustapi-0.1.5/docs/quickstart.md +262 -0
- bustapi-0.1.5/examples/README.md +104 -0
- bustapi-0.1.5/examples/auto_docs/fastapi_style_docs.py +327 -0
- bustapi-0.1.5/examples/basic/hello_world.py +71 -0
- bustapi-0.1.5/examples/basic/routing.py +159 -0
- bustapi-0.1.5/examples/deployment/README.md +486 -0
- bustapi-0.1.5/examples/deployment/docker/Dockerfile +43 -0
- bustapi-0.1.5/examples/deployment/docker/docker-compose.yml +137 -0
- bustapi-0.1.5/examples/deployment/docker/gunicorn.conf.py +89 -0
- bustapi-0.1.5/examples/deployment/docker/requirements.txt +55 -0
- bustapi-0.1.5/examples/deployment/production_app.py +299 -0
- bustapi-0.1.5/examples/flask_compat/README.md +127 -0
- bustapi-0.1.5/examples/flask_compat/extension_compatibility_report.py +258 -0
- bustapi-0.1.5/examples/flask_compat/flask_extensions_test.py +323 -0
- bustapi-0.1.5/examples/flask_compat/simple_working_demo.py +109 -0
- bustapi-0.1.5/examples/flask_compat/working_extensions_test.py +195 -0
- {bustapi-0.1.0 → bustapi-0.1.5}/examples/flask_migration.py +58 -45
- {bustapi-0.1.0 → bustapi-0.1.5}/examples/hello_world.py +43 -35
- bustapi-0.1.5/examples/http_methods/http_methods.py +217 -0
- bustapi-0.1.5/examples/http_methods/test_http_methods.py +161 -0
- bustapi-0.1.5/examples/logging/colorful_logging_demo.py +146 -0
- bustapi-0.1.5/examples/logging/logging_demo.py +269 -0
- bustapi-0.1.5/examples/logging/simple_logging_test.py +64 -0
- bustapi-0.1.5/examples/real_world/todo_api.py +367 -0
- bustapi-0.1.5/examples/templates/jinja_templates.py +220 -0
- bustapi-0.1.5/examples/templates/templates/base.html +124 -0
- bustapi-0.1.5/examples/templates/templates/index.html +137 -0
- {bustapi-0.1.0 → bustapi-0.1.5}/pyproject.toml +26 -1
- {bustapi-0.1.0 → bustapi-0.1.5}/python/bustapi/__init__.py +10 -5
- {bustapi-0.1.0 → bustapi-0.1.5}/python/bustapi/app.py +338 -41
- {bustapi-0.1.0 → bustapi-0.1.5}/python/bustapi/helpers.py +28 -8
- bustapi-0.1.5/python/bustapi/logging.py +468 -0
- bustapi-0.1.5/python/bustapi/openapi/__init__.py +33 -0
- bustapi-0.1.5/python/bustapi/openapi/const.py +3 -0
- bustapi-0.1.5/python/bustapi/openapi/docs.py +269 -0
- bustapi-0.1.5/python/bustapi/openapi/models.py +128 -0
- bustapi-0.1.5/python/bustapi/openapi/utils.py +158 -0
- bustapi-0.1.5/python/bustapi/templating.py +30 -0
- {bustapi-0.1.0 → bustapi-0.1.5}/python/bustapi/testing.py +2 -1
- {bustapi-0.1.0 → bustapi-0.1.5}/src/bindings.rs +129 -30
- {bustapi-0.1.0 → bustapi-0.1.5}/src/response.rs +20 -0
- {bustapi-0.1.0 → bustapi-0.1.5}/src/router.rs +7 -6
- {bustapi-0.1.0 → bustapi-0.1.5}/src/server.rs +8 -0
- bustapi-0.1.5/tests/docs_test_all.py +72 -0
- bustapi-0.1.5/tests/docs_test_api_reference.py +327 -0
- bustapi-0.1.5/tests/docs_test_installation.py +167 -0
- bustapi-0.1.5/tests/docs_test_quickstart.py +409 -0
- bustapi-0.1.5/tests/docs_test_simple.py +260 -0
- bustapi-0.1.0/PKG-INFO +0 -233
- bustapi-0.1.0/PROGRESS_SUMMARY.md +0 -104
- bustapi-0.1.0/README.md +0 -184
- {bustapi-0.1.0 → bustapi-0.1.5}/.github/workflows/pypi.yml +0 -0
- {bustapi-0.1.0 → bustapi-0.1.5}/.github/workflows/rls.yml +0 -0
- {bustapi-0.1.0 → bustapi-0.1.5}/ARCHITECTURE.md +0 -0
- {bustapi-0.1.0 → bustapi-0.1.5}/IMPLEMENTATION_ROADMAP.md +0 -0
- {bustapi-0.1.0 → bustapi-0.1.5}/PROJECT_SPECIFICATION.md +0 -0
- {bustapi-0.1.0 → bustapi-0.1.5}/python/bustapi/blueprints.py +0 -0
- {bustapi-0.1.0 → bustapi-0.1.5}/python/bustapi/exceptions.py +0 -0
- {bustapi-0.1.0 → bustapi-0.1.5}/python/bustapi/flask_compat.py +0 -0
- {bustapi-0.1.0 → bustapi-0.1.5}/python/bustapi/py.typed +0 -0
- {bustapi-0.1.0 → bustapi-0.1.5}/python/bustapi/request.py +0 -0
- {bustapi-0.1.0 → bustapi-0.1.5}/python/bustapi/response.py +0 -0
- {bustapi-0.1.0 → bustapi-0.1.5}/src/lib.rs +0 -0
- {bustapi-0.1.0 → bustapi-0.1.5}/src/request.rs +0 -0
- {bustapi-0.1.0 → bustapi-0.1.5}/test_basic.py +0 -0
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented here.
|
|
4
|
+
|
|
5
|
+
## [0.1.1]
|
|
6
|
+
- Added Jinja2 templating helper and `render_template` API
|
|
7
|
+
- Added minimal OpenAPI JSON generator and `/openapi.json` endpoint
|
|
8
|
+
- CI: Make workflows platform-aware for virtualenv and maturin invocations
|
|
9
|
+
- CI: Flatten downloaded artifacts before PyPI publish
|
|
10
|
+
|
|
11
|
+
## [0.1.0]
|
|
12
|
+
- Initial release
|
|
@@ -40,20 +40,15 @@ checksum = "b0674a1ddeecb70197781e945de4b3b8ffb61fa939a5597bcf48503737663100"
|
|
|
40
40
|
|
|
41
41
|
[[package]]
|
|
42
42
|
name = "async-compression"
|
|
43
|
-
version = "0.4.
|
|
43
|
+
version = "0.4.30"
|
|
44
44
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
45
|
-
checksum = "
|
|
45
|
+
checksum = "977eb15ea9efd848bb8a4a1a2500347ed7f0bf794edf0dc3ddcf439f43d36b23"
|
|
46
46
|
dependencies = [
|
|
47
|
-
"brotli",
|
|
48
47
|
"compression-codecs",
|
|
49
48
|
"compression-core",
|
|
50
|
-
"flate2",
|
|
51
49
|
"futures-core",
|
|
52
|
-
"memchr",
|
|
53
50
|
"pin-project-lite",
|
|
54
51
|
"tokio",
|
|
55
|
-
"zstd",
|
|
56
|
-
"zstd-safe",
|
|
57
52
|
]
|
|
58
53
|
|
|
59
54
|
[[package]]
|
|
@@ -152,6 +147,7 @@ dependencies = [
|
|
|
152
147
|
"http-body-util",
|
|
153
148
|
"hyper",
|
|
154
149
|
"hyper-util",
|
|
150
|
+
"num_cpus",
|
|
155
151
|
"pyo3",
|
|
156
152
|
"pyo3-asyncio",
|
|
157
153
|
"pyo3-build-config",
|
|
@@ -197,16 +193,14 @@ checksum = "2fd1289c04a9ea8cb22300a459a72a385d7c73d3259e2ed7dcb2af674838cfa9"
|
|
|
197
193
|
|
|
198
194
|
[[package]]
|
|
199
195
|
name = "compression-codecs"
|
|
200
|
-
version = "0.4.
|
|
196
|
+
version = "0.4.30"
|
|
201
197
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
202
|
-
checksum = "
|
|
198
|
+
checksum = "485abf41ac0c8047c07c87c72c8fb3eb5197f6e9d7ded615dfd1a00ae00a0f64"
|
|
203
199
|
dependencies = [
|
|
204
200
|
"brotli",
|
|
205
201
|
"compression-core",
|
|
206
202
|
"flate2",
|
|
207
|
-
"futures-core",
|
|
208
203
|
"memchr",
|
|
209
|
-
"pin-project-lite",
|
|
210
204
|
"zstd",
|
|
211
205
|
"zstd-safe",
|
|
212
206
|
]
|
|
@@ -449,6 +443,12 @@ version = "0.4.1"
|
|
|
449
443
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
450
444
|
checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8"
|
|
451
445
|
|
|
446
|
+
[[package]]
|
|
447
|
+
name = "hermit-abi"
|
|
448
|
+
version = "0.5.2"
|
|
449
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
450
|
+
checksum = "fc0fef456e4baa96da950455cd02c081ca953b141298e41db3fc7e36b1da849c"
|
|
451
|
+
|
|
452
452
|
[[package]]
|
|
453
453
|
name = "http"
|
|
454
454
|
version = "1.3.1"
|
|
@@ -818,17 +818,16 @@ checksum = "78bed444cc8a2160f01cbcf811ef18cac863ad68ae8ca62092e8db51d51c761c"
|
|
|
818
818
|
dependencies = [
|
|
819
819
|
"libc",
|
|
820
820
|
"wasi 0.11.1+wasi-snapshot-preview1",
|
|
821
|
-
"windows-sys",
|
|
821
|
+
"windows-sys 0.59.0",
|
|
822
822
|
]
|
|
823
823
|
|
|
824
824
|
[[package]]
|
|
825
825
|
name = "nu-ansi-term"
|
|
826
|
-
version = "0.
|
|
826
|
+
version = "0.50.1"
|
|
827
827
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
828
|
-
checksum = "
|
|
828
|
+
checksum = "d4a28e057d01f97e61255210fcff094d74ed0466038633e95017f5beb68e4399"
|
|
829
829
|
dependencies = [
|
|
830
|
-
"
|
|
831
|
-
"winapi",
|
|
830
|
+
"windows-sys 0.52.0",
|
|
832
831
|
]
|
|
833
832
|
|
|
834
833
|
[[package]]
|
|
@@ -840,6 +839,16 @@ dependencies = [
|
|
|
840
839
|
"autocfg",
|
|
841
840
|
]
|
|
842
841
|
|
|
842
|
+
[[package]]
|
|
843
|
+
name = "num_cpus"
|
|
844
|
+
version = "1.17.0"
|
|
845
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
846
|
+
checksum = "91df4bbde75afed763b708b7eee1e8e7651e02d97f6d5dd763e89367e957b23b"
|
|
847
|
+
dependencies = [
|
|
848
|
+
"hermit-abi",
|
|
849
|
+
"libc",
|
|
850
|
+
]
|
|
851
|
+
|
|
843
852
|
[[package]]
|
|
844
853
|
name = "object"
|
|
845
854
|
version = "0.36.7"
|
|
@@ -855,12 +864,6 @@ version = "1.21.3"
|
|
|
855
864
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
856
865
|
checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d"
|
|
857
866
|
|
|
858
|
-
[[package]]
|
|
859
|
-
name = "overload"
|
|
860
|
-
version = "0.1.1"
|
|
861
|
-
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
862
|
-
checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39"
|
|
863
|
-
|
|
864
867
|
[[package]]
|
|
865
868
|
name = "parking_lot"
|
|
866
869
|
version = "0.12.4"
|
|
@@ -1190,7 +1193,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
|
1190
1193
|
checksum = "233504af464074f9d066d7b5416c5f9b894a5862a6506e306f7b816cdd6f1807"
|
|
1191
1194
|
dependencies = [
|
|
1192
1195
|
"libc",
|
|
1193
|
-
"windows-sys",
|
|
1196
|
+
"windows-sys 0.59.0",
|
|
1194
1197
|
]
|
|
1195
1198
|
|
|
1196
1199
|
[[package]]
|
|
@@ -1304,7 +1307,7 @@ dependencies = [
|
|
|
1304
1307
|
"slab",
|
|
1305
1308
|
"socket2",
|
|
1306
1309
|
"tokio-macros",
|
|
1307
|
-
"windows-sys",
|
|
1310
|
+
"windows-sys 0.59.0",
|
|
1308
1311
|
]
|
|
1309
1312
|
|
|
1310
1313
|
[[package]]
|
|
@@ -1441,9 +1444,9 @@ dependencies = [
|
|
|
1441
1444
|
|
|
1442
1445
|
[[package]]
|
|
1443
1446
|
name = "tracing-subscriber"
|
|
1444
|
-
version = "0.3.
|
|
1447
|
+
version = "0.3.20"
|
|
1445
1448
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1446
|
-
checksum = "
|
|
1449
|
+
checksum = "2054a14f5307d601f88daf0553e1cbf472acc4f2c51afab632431cdcd72124d5"
|
|
1447
1450
|
dependencies = [
|
|
1448
1451
|
"nu-ansi-term",
|
|
1449
1452
|
"sharded-slab",
|
|
@@ -1594,28 +1597,6 @@ dependencies = [
|
|
|
1594
1597
|
"unicode-ident",
|
|
1595
1598
|
]
|
|
1596
1599
|
|
|
1597
|
-
[[package]]
|
|
1598
|
-
name = "winapi"
|
|
1599
|
-
version = "0.3.9"
|
|
1600
|
-
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1601
|
-
checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419"
|
|
1602
|
-
dependencies = [
|
|
1603
|
-
"winapi-i686-pc-windows-gnu",
|
|
1604
|
-
"winapi-x86_64-pc-windows-gnu",
|
|
1605
|
-
]
|
|
1606
|
-
|
|
1607
|
-
[[package]]
|
|
1608
|
-
name = "winapi-i686-pc-windows-gnu"
|
|
1609
|
-
version = "0.4.0"
|
|
1610
|
-
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1611
|
-
checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
|
|
1612
|
-
|
|
1613
|
-
[[package]]
|
|
1614
|
-
name = "winapi-x86_64-pc-windows-gnu"
|
|
1615
|
-
version = "0.4.0"
|
|
1616
|
-
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1617
|
-
checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
|
|
1618
|
-
|
|
1619
1600
|
[[package]]
|
|
1620
1601
|
name = "windows-link"
|
|
1621
1602
|
version = "0.1.3"
|
|
@@ -1651,6 +1632,15 @@ dependencies = [
|
|
|
1651
1632
|
"windows-link",
|
|
1652
1633
|
]
|
|
1653
1634
|
|
|
1635
|
+
[[package]]
|
|
1636
|
+
name = "windows-sys"
|
|
1637
|
+
version = "0.52.0"
|
|
1638
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1639
|
+
checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d"
|
|
1640
|
+
dependencies = [
|
|
1641
|
+
"windows-targets",
|
|
1642
|
+
]
|
|
1643
|
+
|
|
1654
1644
|
[[package]]
|
|
1655
1645
|
name = "windows-sys"
|
|
1656
1646
|
version = "0.59.0"
|
bustapi-0.1.5/PKG-INFO
ADDED
|
@@ -0,0 +1,324 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: bustapi
|
|
3
|
+
Version: 0.1.5
|
|
4
|
+
Classifier: Development Status :: 3 - Alpha
|
|
5
|
+
Classifier: Intended Audience :: Developers
|
|
6
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
7
|
+
Classifier: Programming Language :: Python :: 3
|
|
8
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
9
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
10
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
11
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
13
|
+
Classifier: Programming Language :: Rust
|
|
14
|
+
Classifier: Topic :: Internet :: WWW/HTTP
|
|
15
|
+
Classifier: Topic :: Software Development :: Libraries :: Application Frameworks
|
|
16
|
+
Requires-Dist: black>=24.8.0
|
|
17
|
+
Requires-Dist: isort>=5.13.2
|
|
18
|
+
Requires-Dist: maturin>=1.9.3
|
|
19
|
+
Requires-Dist: pytest>=8.3.5
|
|
20
|
+
Requires-Dist: pytest-asyncio>=0.24.0
|
|
21
|
+
Requires-Dist: pytest-cov>=5.0.0
|
|
22
|
+
Requires-Dist: ruff>=0.12.10
|
|
23
|
+
Requires-Dist: typing-extensions>=4.0.0
|
|
24
|
+
Requires-Dist: werkzeug>=2.0.0
|
|
25
|
+
Requires-Dist: jinja2>=3.1
|
|
26
|
+
Requires-Dist: pydantic>=2.10.6
|
|
27
|
+
Requires-Dist: requests>=2.32.4
|
|
28
|
+
Requires-Dist: colorama>=0.4.6
|
|
29
|
+
Requires-Dist: pytest>=7.0 ; extra == 'dev'
|
|
30
|
+
Requires-Dist: pytest-asyncio>=0.21.0 ; extra == 'dev'
|
|
31
|
+
Requires-Dist: black>=22.0 ; extra == 'dev'
|
|
32
|
+
Requires-Dist: mypy>=1.0 ; extra == 'dev'
|
|
33
|
+
Requires-Dist: ruff>=0.1.0 ; extra == 'dev'
|
|
34
|
+
Requires-Dist: pre-commit>=3.0 ; extra == 'dev'
|
|
35
|
+
Requires-Dist: maturin>=1.0 ; extra == 'dev'
|
|
36
|
+
Requires-Dist: mkdocs>=1.5 ; extra == 'docs'
|
|
37
|
+
Requires-Dist: mkdocs-material>=9.0 ; extra == 'docs'
|
|
38
|
+
Requires-Dist: mkdocstrings[python]>=0.20 ; extra == 'docs'
|
|
39
|
+
Provides-Extra: dev
|
|
40
|
+
Provides-Extra: docs
|
|
41
|
+
License-File: LICENSE
|
|
42
|
+
Summary: High-performance Flask-compatible web framework with async support
|
|
43
|
+
Keywords: web,framework,async,performance,flask
|
|
44
|
+
Author-email: BustAPI Team <hello@bustapi.dev>
|
|
45
|
+
License: MIT
|
|
46
|
+
Requires-Python: >=3.8
|
|
47
|
+
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
|
|
48
|
+
Project-URL: Homepage, https://github.com/bustapi/bustapi
|
|
49
|
+
Project-URL: Documentation, https://bustapi.dev
|
|
50
|
+
Project-URL: Repository, https://github.com/bustapi/bustapi.git
|
|
51
|
+
Project-URL: Issues, https://github.com/bustapi/bustapi/issues
|
|
52
|
+
|
|
53
|
+
# 🚀 BustAPI
|
|
54
|
+
|
|
55
|
+
**High-Performance Python Web Framework Powered by Rust**
|
|
56
|
+
|
|
57
|
+
BustAPI is a modern, fast Python web framework that combines the simplicity of Flask with the performance of Rust. Built with PyO3 and Tokio, it delivers **native Rust performance** while maintaining Python's ease of use.
|
|
58
|
+
|
|
59
|
+
## ⚡ Performance
|
|
60
|
+
|
|
61
|
+
BustAPI achieves **539+ RPS** compared to Flask's 452 RPS and FastAPI's 451 RPS - delivering **20% better performance** through its Rust-powered backend.
|
|
62
|
+
|
|
63
|
+
| Framework | RPS | Improvement |
|
|
64
|
+
|-----------|-----|-------------|
|
|
65
|
+
| **BustAPI** | **539** | **Baseline** |
|
|
66
|
+
| Flask | 451 | +20% slower |
|
|
67
|
+
| FastAPI | 452 | +19% slower |
|
|
68
|
+
|
|
69
|
+
*Benchmarks: 100 concurrent connections, 10,000 total requests*
|
|
70
|
+
|
|
71
|
+
## 🎯 Key Features
|
|
72
|
+
|
|
73
|
+
- **🔥 High Performance**: Rust-powered backend with Python ease-of-use
|
|
74
|
+
- **🔄 Flask Compatible**: Drop-in replacement for most Flask applications
|
|
75
|
+
- **⚡ Async Support**: Native async/await support with Tokio runtime
|
|
76
|
+
- **📚 Auto Documentation**: FastAPI-style automatic OpenAPI/Swagger UI
|
|
77
|
+
- **🎨 Template Support**: Jinja2 template rendering out of the box
|
|
78
|
+
- **🔧 Extension Support**: Compatible with popular Flask extensions
|
|
79
|
+
- **🛡️ Type Safety**: Full type hints and Pydantic integration
|
|
80
|
+
- **🌐 All HTTP Methods**: GET, POST, PUT, DELETE, PATCH, HEAD, OPTIONS
|
|
81
|
+
|
|
82
|
+
## 🚀 Quick Start
|
|
83
|
+
|
|
84
|
+
### Installation
|
|
85
|
+
|
|
86
|
+
```bash
|
|
87
|
+
pip install bustapi
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
### Your First App
|
|
91
|
+
|
|
92
|
+
```python
|
|
93
|
+
from bustapi import BustAPI
|
|
94
|
+
|
|
95
|
+
app = BustAPI()
|
|
96
|
+
|
|
97
|
+
@app.route('/')
|
|
98
|
+
def hello():
|
|
99
|
+
return {'message': 'Hello, World!'}
|
|
100
|
+
|
|
101
|
+
@app.route('/users/<int:user_id>')
|
|
102
|
+
def get_user(user_id):
|
|
103
|
+
return {'user_id': user_id, 'name': f'User {user_id}'}
|
|
104
|
+
|
|
105
|
+
if __name__ == '__main__':
|
|
106
|
+
app.run(debug=True)
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
Visit `http://127.0.0.1:8000` to see your app in action!
|
|
110
|
+
|
|
111
|
+
### Auto Documentation
|
|
112
|
+
|
|
113
|
+
```python
|
|
114
|
+
from bustapi import BustAPI
|
|
115
|
+
|
|
116
|
+
app = BustAPI(
|
|
117
|
+
title="My API",
|
|
118
|
+
description="A high-performance API built with BustAPI",
|
|
119
|
+
version="1.0.0",
|
|
120
|
+
docs_url="/docs", # Swagger UI
|
|
121
|
+
redoc_url="/redoc", # ReDoc
|
|
122
|
+
openapi_url="/openapi.json"
|
|
123
|
+
)
|
|
124
|
+
|
|
125
|
+
@app.get("/users")
|
|
126
|
+
def get_users():
|
|
127
|
+
"""Get all users from the system."""
|
|
128
|
+
return {"users": []}
|
|
129
|
+
|
|
130
|
+
@app.post("/users")
|
|
131
|
+
def create_user():
|
|
132
|
+
"""Create a new user."""
|
|
133
|
+
return {"message": "User created"}, 201
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
- **Swagger UI**: `http://127.0.0.1:8000/docs`
|
|
137
|
+
- **ReDoc**: `http://127.0.0.1:8000/redoc`
|
|
138
|
+
- **OpenAPI Schema**: `http://127.0.0.1:8000/openapi.json`
|
|
139
|
+
|
|
140
|
+
## 🔧 HTTP Methods
|
|
141
|
+
|
|
142
|
+
BustAPI supports all HTTP methods with convenient decorators:
|
|
143
|
+
|
|
144
|
+
```python
|
|
145
|
+
from bustapi import BustAPI
|
|
146
|
+
|
|
147
|
+
app = BustAPI()
|
|
148
|
+
|
|
149
|
+
@app.get('/items')
|
|
150
|
+
def get_items():
|
|
151
|
+
return {'items': []}
|
|
152
|
+
|
|
153
|
+
@app.post('/items')
|
|
154
|
+
def create_item():
|
|
155
|
+
return {'message': 'Item created'}, 201
|
|
156
|
+
|
|
157
|
+
@app.put('/items/<int:item_id>')
|
|
158
|
+
def update_item(item_id):
|
|
159
|
+
return {'message': f'Item {item_id} updated'}
|
|
160
|
+
|
|
161
|
+
@app.delete('/items/<int:item_id>')
|
|
162
|
+
def delete_item(item_id):
|
|
163
|
+
return {'message': f'Item {item_id} deleted'}
|
|
164
|
+
|
|
165
|
+
@app.patch('/items/<int:item_id>')
|
|
166
|
+
def patch_item(item_id):
|
|
167
|
+
return {'message': f'Item {item_id} patched'}
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
## 🎨 Template Rendering
|
|
171
|
+
|
|
172
|
+
Full Jinja2 support with template inheritance:
|
|
173
|
+
|
|
174
|
+
```python
|
|
175
|
+
from bustapi import BustAPI, render_template
|
|
176
|
+
|
|
177
|
+
app = BustAPI()
|
|
178
|
+
|
|
179
|
+
@app.route('/')
|
|
180
|
+
def index():
|
|
181
|
+
return render_template('index.html',
|
|
182
|
+
title='BustAPI App',
|
|
183
|
+
message='Welcome to BustAPI!')
|
|
184
|
+
|
|
185
|
+
@app.route('/users')
|
|
186
|
+
def users():
|
|
187
|
+
users = [{'name': 'Alice'}, {'name': 'Bob'}]
|
|
188
|
+
return render_template('users.html', users=users)
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
## 📊 Request Handling
|
|
192
|
+
|
|
193
|
+
```python
|
|
194
|
+
from bustapi import BustAPI, request
|
|
195
|
+
|
|
196
|
+
app = BustAPI()
|
|
197
|
+
|
|
198
|
+
@app.route('/data', methods=['POST'])
|
|
199
|
+
def handle_data():
|
|
200
|
+
# JSON data
|
|
201
|
+
json_data = request.get_json()
|
|
202
|
+
|
|
203
|
+
# Form data
|
|
204
|
+
form_data = request.form
|
|
205
|
+
|
|
206
|
+
# Query parameters
|
|
207
|
+
args = request.args
|
|
208
|
+
|
|
209
|
+
# Headers
|
|
210
|
+
headers = request.headers
|
|
211
|
+
|
|
212
|
+
# Files
|
|
213
|
+
files = request.files
|
|
214
|
+
|
|
215
|
+
return {
|
|
216
|
+
'json': json_data,
|
|
217
|
+
'form': dict(form_data),
|
|
218
|
+
'args': dict(args),
|
|
219
|
+
'headers': dict(headers)
|
|
220
|
+
}
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
## 🔄 Flask Migration
|
|
224
|
+
|
|
225
|
+
BustAPI is designed as a drop-in replacement for Flask:
|
|
226
|
+
|
|
227
|
+
```python
|
|
228
|
+
# Flask code
|
|
229
|
+
from flask import Flask, jsonify, request
|
|
230
|
+
|
|
231
|
+
app = Flask(__name__)
|
|
232
|
+
|
|
233
|
+
@app.route('/api/users', methods=['GET', 'POST'])
|
|
234
|
+
def users():
|
|
235
|
+
if request.method == 'GET':
|
|
236
|
+
return jsonify({'users': []})
|
|
237
|
+
return jsonify({'message': 'User created'}), 201
|
|
238
|
+
|
|
239
|
+
# BustAPI equivalent (same code!)
|
|
240
|
+
from bustapi import BustAPI, jsonify, request
|
|
241
|
+
|
|
242
|
+
app = BustAPI()
|
|
243
|
+
|
|
244
|
+
@app.route('/api/users', methods=['GET', 'POST'])
|
|
245
|
+
def users():
|
|
246
|
+
if request.method == 'GET':
|
|
247
|
+
return jsonify({'users': []})
|
|
248
|
+
return jsonify({'message': 'User created'}), 201
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
## 📚 Documentation & Examples
|
|
252
|
+
|
|
253
|
+
- **[📖 Full Documentation](docs/)** - Complete guides and API reference
|
|
254
|
+
- **[🎯 Examples](examples/)** - Working examples for all features
|
|
255
|
+
- **[🚀 Quick Start Guide](docs/quickstart.md)** - Get started in minutes
|
|
256
|
+
- **[🔧 API Reference](docs/api-reference.md)** - Complete API documentation
|
|
257
|
+
|
|
258
|
+
## 🏗️ Production Deployment
|
|
259
|
+
|
|
260
|
+
### Using Gunicorn
|
|
261
|
+
|
|
262
|
+
```bash
|
|
263
|
+
pip install gunicorn
|
|
264
|
+
gunicorn -w 4 -b 0.0.0.0:8000 app:app
|
|
265
|
+
```
|
|
266
|
+
|
|
267
|
+
### Using Uvicorn
|
|
268
|
+
|
|
269
|
+
```bash
|
|
270
|
+
pip install uvicorn
|
|
271
|
+
uvicorn app:app --host 0.0.0.0 --port 8000 --workers 4
|
|
272
|
+
```
|
|
273
|
+
|
|
274
|
+
### Docker
|
|
275
|
+
|
|
276
|
+
```dockerfile
|
|
277
|
+
FROM python:3.11-slim
|
|
278
|
+
|
|
279
|
+
WORKDIR /app
|
|
280
|
+
COPY requirements.txt .
|
|
281
|
+
RUN pip install -r requirements.txt
|
|
282
|
+
|
|
283
|
+
COPY . .
|
|
284
|
+
EXPOSE 8000
|
|
285
|
+
|
|
286
|
+
CMD ["gunicorn", "-w", "4", "-b", "0.0.0.0:8000", "app:app"]
|
|
287
|
+
```
|
|
288
|
+
|
|
289
|
+
## 🧪 Testing
|
|
290
|
+
|
|
291
|
+
BustAPI includes a built-in test client:
|
|
292
|
+
|
|
293
|
+
```python
|
|
294
|
+
from bustapi.testing import TestClient
|
|
295
|
+
|
|
296
|
+
def test_app():
|
|
297
|
+
client = TestClient(app)
|
|
298
|
+
|
|
299
|
+
response = client.get('/')
|
|
300
|
+
assert response.status_code == 200
|
|
301
|
+
assert response.json() == {'message': 'Hello, World!'}
|
|
302
|
+
|
|
303
|
+
response = client.post('/users', json={'name': 'Alice'})
|
|
304
|
+
assert response.status_code == 201
|
|
305
|
+
```
|
|
306
|
+
|
|
307
|
+
## 🤝 Contributing
|
|
308
|
+
|
|
309
|
+
We welcome contributions! Please see our [Contributing Guide](CONTRIBUTING.md) for details.
|
|
310
|
+
|
|
311
|
+
## 📄 License
|
|
312
|
+
|
|
313
|
+
BustAPI is licensed under the MIT License. See [LICENSE](LICENSE) for details.
|
|
314
|
+
|
|
315
|
+
## 🙏 Acknowledgments
|
|
316
|
+
|
|
317
|
+
- Built with [PyO3](https://pyo3.rs/) for Python-Rust integration
|
|
318
|
+
- Powered by [Tokio](https://tokio.rs/) for async runtime
|
|
319
|
+
- Inspired by [Flask](https://flask.palletsprojects.com/) and [FastAPI](https://fastapi.tiangolo.com/)
|
|
320
|
+
|
|
321
|
+
---
|
|
322
|
+
|
|
323
|
+
**Made with ❤️ and ⚡ by the BustAPI team**
|
|
324
|
+
|