alphaapi 0.2.0b0__tar.gz → 0.3.0b0__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.
Files changed (127) hide show
  1. {alphaapi-0.2.0b0 → alphaapi-0.3.0b0}/.github/workflows/ci.yml +35 -4
  2. alphaapi-0.3.0b0/.github/workflows/release.yml +53 -0
  3. {alphaapi-0.2.0b0 → alphaapi-0.3.0b0}/Cargo.lock +180 -28
  4. {alphaapi-0.2.0b0 → alphaapi-0.3.0b0}/Cargo.toml +17 -2
  5. alphaapi-0.3.0b0/PKG-INFO +180 -0
  6. alphaapi-0.3.0b0/README.md +142 -0
  7. {alphaapi-0.2.0b0 → alphaapi-0.3.0b0}/benchmarks/bench.py +29 -11
  8. alphaapi-0.3.0b0/benchmarks/connections.md +201 -0
  9. alphaapi-0.3.0b0/benchmarks/connload.rs +195 -0
  10. alphaapi-0.3.0b0/benchmarks/fd_probe.py +78 -0
  11. {alphaapi-0.2.0b0 → alphaapi-0.3.0b0}/benchmarks/loadgen.rs +36 -21
  12. alphaapi-0.3.0b0/benchmarks/pgo.md +81 -0
  13. {alphaapi-0.2.0b0 → alphaapi-0.3.0b0}/benchmarks/server_alpha.py +25 -1
  14. {alphaapi-0.2.0b0 → alphaapi-0.3.0b0}/benchmarks/server_fastapi.py +12 -0
  15. alphaapi-0.3.0b0/benchmarks/train_pgo.py +62 -0
  16. {alphaapi-0.2.0b0 → alphaapi-0.3.0b0}/docs/api/cli.md +7 -4
  17. {alphaapi-0.2.0b0 → alphaapi-0.3.0b0}/docs/api/index.md +2 -2
  18. {alphaapi-0.2.0b0 → alphaapi-0.3.0b0}/docs/api/security.md +35 -2
  19. {alphaapi-0.2.0b0 → alphaapi-0.3.0b0}/docs/api/sessions.md +2 -2
  20. {alphaapi-0.2.0b0 → alphaapi-0.3.0b0}/docs/api/settings.md +28 -2
  21. {alphaapi-0.2.0b0 → alphaapi-0.3.0b0}/docs/getting-started.md +30 -13
  22. {alphaapi-0.2.0b0 → alphaapi-0.3.0b0}/docs/index.md +6 -3
  23. {alphaapi-0.2.0b0 → alphaapi-0.3.0b0}/docs/tutorials/deployment.md +27 -3
  24. {alphaapi-0.2.0b0 → alphaapi-0.3.0b0}/examples/project/settings.py +1 -1
  25. {alphaapi-0.2.0b0 → alphaapi-0.3.0b0}/examples/test/test/settings.py +1 -1
  26. {alphaapi-0.2.0b0 → alphaapi-0.3.0b0}/pyproject.toml +3 -1
  27. {alphaapi-0.2.0b0 → alphaapi-0.3.0b0}/python/alphaapi/__init__.py +2 -0
  28. {alphaapi-0.2.0b0 → alphaapi-0.3.0b0}/python/alphaapi/_core.pyi +10 -1
  29. {alphaapi-0.2.0b0 → alphaapi-0.3.0b0}/python/alphaapi/app.py +91 -27
  30. {alphaapi-0.2.0b0 → alphaapi-0.3.0b0}/python/alphaapi/auth.py +22 -1
  31. {alphaapi-0.2.0b0 → alphaapi-0.3.0b0}/python/alphaapi/cli.py +9 -0
  32. {alphaapi-0.2.0b0 → alphaapi-0.3.0b0}/python/alphaapi/conf.py +4 -2
  33. {alphaapi-0.2.0b0 → alphaapi-0.3.0b0}/python/alphaapi/http/request.py +8 -2
  34. {alphaapi-0.2.0b0 → alphaapi-0.3.0b0}/python/alphaapi/http/response.py +6 -3
  35. {alphaapi-0.2.0b0 → alphaapi-0.3.0b0}/python/alphaapi/openapi.py +1 -1
  36. {alphaapi-0.2.0b0 → alphaapi-0.3.0b0}/python/alphaapi/scaffold.py +1 -1
  37. {alphaapi-0.2.0b0 → alphaapi-0.3.0b0}/python/alphaapi/views.py +3 -0
  38. {alphaapi-0.2.0b0 → alphaapi-0.3.0b0}/src/app.rs +726 -253
  39. alphaapi-0.3.0b0/src/jwt.rs +95 -0
  40. {alphaapi-0.2.0b0 → alphaapi-0.3.0b0}/src/lib.rs +4 -0
  41. {alphaapi-0.2.0b0 → alphaapi-0.3.0b0}/src/request.rs +23 -3
  42. {alphaapi-0.2.0b0 → alphaapi-0.3.0b0}/src/spec.rs +3 -0
  43. alphaapi-0.3.0b0/src/uring.rs +194 -0
  44. {alphaapi-0.2.0b0 → alphaapi-0.3.0b0}/src/util.rs +28 -1
  45. {alphaapi-0.2.0b0 → alphaapi-0.3.0b0}/tasks/tasks/settings.py +1 -1
  46. {alphaapi-0.2.0b0 → alphaapi-0.3.0b0}/tests/conftest.py +2 -2
  47. {alphaapi-0.2.0b0 → alphaapi-0.3.0b0}/tests/test_alpha.py +202 -3
  48. {alphaapi-0.2.0b0 → alphaapi-0.3.0b0}/tests/test_cli.py +8 -0
  49. alphaapi-0.3.0b0/tests/test_jwt.py +104 -0
  50. {alphaapi-0.2.0b0 → alphaapi-0.3.0b0}/tests/test_review_regressions.py +12 -0
  51. {alphaapi-0.2.0b0 → alphaapi-0.3.0b0}/tests/test_streaming_files.py +2 -2
  52. alphaapi-0.2.0b0/.github/workflows/release.yml +0 -24
  53. alphaapi-0.2.0b0/PKG-INFO +0 -663
  54. alphaapi-0.2.0b0/README.md +0 -629
  55. {alphaapi-0.2.0b0 → alphaapi-0.3.0b0}/.github/workflows/docs.yml +0 -0
  56. {alphaapi-0.2.0b0 → alphaapi-0.3.0b0}/.gitignore +0 -0
  57. {alphaapi-0.2.0b0 → alphaapi-0.3.0b0}/LICENSE +0 -0
  58. {alphaapi-0.2.0b0 → alphaapi-0.3.0b0}/docs/api/application.md +0 -0
  59. {alphaapi-0.2.0b0 → alphaapi-0.3.0b0}/docs/api/apps.md +0 -0
  60. {alphaapi-0.2.0b0 → alphaapi-0.3.0b0}/docs/api/binding.md +0 -0
  61. {alphaapi-0.2.0b0 → alphaapi-0.3.0b0}/docs/api/core.md +0 -0
  62. {alphaapi-0.2.0b0 → alphaapi-0.3.0b0}/docs/api/exceptions.md +0 -0
  63. {alphaapi-0.2.0b0 → alphaapi-0.3.0b0}/docs/api/middleware.md +0 -0
  64. {alphaapi-0.2.0b0 → alphaapi-0.3.0b0}/docs/api/observability.md +0 -0
  65. {alphaapi-0.2.0b0 → alphaapi-0.3.0b0}/docs/api/openapi.md +0 -0
  66. {alphaapi-0.2.0b0 → alphaapi-0.3.0b0}/docs/api/requests.md +0 -0
  67. {alphaapi-0.2.0b0 → alphaapi-0.3.0b0}/docs/api/responses.md +0 -0
  68. {alphaapi-0.2.0b0 → alphaapi-0.3.0b0}/docs/api/routing.md +0 -0
  69. {alphaapi-0.2.0b0 → alphaapi-0.3.0b0}/docs/api/static-files.md +0 -0
  70. {alphaapi-0.2.0b0 → alphaapi-0.3.0b0}/docs/api/streaming.md +0 -0
  71. {alphaapi-0.2.0b0 → alphaapi-0.3.0b0}/docs/api/templates.md +0 -0
  72. {alphaapi-0.2.0b0 → alphaapi-0.3.0b0}/docs/api/testing.md +0 -0
  73. {alphaapi-0.2.0b0 → alphaapi-0.3.0b0}/docs/api/views.md +0 -0
  74. {alphaapi-0.2.0b0 → alphaapi-0.3.0b0}/docs/stylesheets/extra.css +0 -0
  75. {alphaapi-0.2.0b0 → alphaapi-0.3.0b0}/docs/tutorials/blog.md +0 -0
  76. {alphaapi-0.2.0b0 → alphaapi-0.3.0b0}/docs/tutorials/index.md +0 -0
  77. {alphaapi-0.2.0b0 → alphaapi-0.3.0b0}/docs/tutorials/task-api.md +0 -0
  78. {alphaapi-0.2.0b0 → alphaapi-0.3.0b0}/examples/__init__.py +0 -0
  79. {alphaapi-0.2.0b0 → alphaapi-0.3.0b0}/examples/basic.py +0 -0
  80. {alphaapi-0.2.0b0 → alphaapi-0.3.0b0}/examples/manage.py +0 -0
  81. {alphaapi-0.2.0b0 → alphaapi-0.3.0b0}/examples/project/__init__.py +0 -0
  82. {alphaapi-0.2.0b0 → alphaapi-0.3.0b0}/examples/project/app.py +0 -0
  83. {alphaapi-0.2.0b0 → alphaapi-0.3.0b0}/examples/project/middleware.py +0 -0
  84. {alphaapi-0.2.0b0 → alphaapi-0.3.0b0}/examples/project/urls.py +0 -0
  85. {alphaapi-0.2.0b0 → alphaapi-0.3.0b0}/examples/project/views.py +0 -0
  86. {alphaapi-0.2.0b0 → alphaapi-0.3.0b0}/examples/test/manage.py +0 -0
  87. {alphaapi-0.2.0b0 → alphaapi-0.3.0b0}/examples/test/test/__init__.py +0 -0
  88. {alphaapi-0.2.0b0 → alphaapi-0.3.0b0}/examples/test/test/app.py +0 -0
  89. {alphaapi-0.2.0b0 → alphaapi-0.3.0b0}/examples/test/test/urls.py +0 -0
  90. {alphaapi-0.2.0b0 → alphaapi-0.3.0b0}/examples/test/test/views.py +0 -0
  91. {alphaapi-0.2.0b0 → alphaapi-0.3.0b0}/mkdocs.yml +0 -0
  92. {alphaapi-0.2.0b0 → alphaapi-0.3.0b0}/python/alphaapi/_debug.py +0 -0
  93. {alphaapi-0.2.0b0 → alphaapi-0.3.0b0}/python/alphaapi/_helpers.py +0 -0
  94. {alphaapi-0.2.0b0 → alphaapi-0.3.0b0}/python/alphaapi/apps.py +0 -0
  95. {alphaapi-0.2.0b0 → alphaapi-0.3.0b0}/python/alphaapi/cors.py +0 -0
  96. {alphaapi-0.2.0b0 → alphaapi-0.3.0b0}/python/alphaapi/csrf.py +0 -0
  97. {alphaapi-0.2.0b0 → alphaapi-0.3.0b0}/python/alphaapi/exceptions.py +0 -0
  98. {alphaapi-0.2.0b0 → alphaapi-0.3.0b0}/python/alphaapi/http/__init__.py +0 -0
  99. {alphaapi-0.2.0b0 → alphaapi-0.3.0b0}/python/alphaapi/http/multipart.py +0 -0
  100. {alphaapi-0.2.0b0 → alphaapi-0.3.0b0}/python/alphaapi/middleware.py +0 -0
  101. {alphaapi-0.2.0b0 → alphaapi-0.3.0b0}/python/alphaapi/observability.py +0 -0
  102. {alphaapi-0.2.0b0 → alphaapi-0.3.0b0}/python/alphaapi/params.py +0 -0
  103. {alphaapi-0.2.0b0 → alphaapi-0.3.0b0}/python/alphaapi/py.typed +0 -0
  104. {alphaapi-0.2.0b0 → alphaapi-0.3.0b0}/python/alphaapi/security.py +0 -0
  105. {alphaapi-0.2.0b0 → alphaapi-0.3.0b0}/python/alphaapi/sessions.py +0 -0
  106. {alphaapi-0.2.0b0 → alphaapi-0.3.0b0}/python/alphaapi/signed_cookies.py +0 -0
  107. {alphaapi-0.2.0b0 → alphaapi-0.3.0b0}/python/alphaapi/staticfiles.py +0 -0
  108. {alphaapi-0.2.0b0 → alphaapi-0.3.0b0}/python/alphaapi/templates.py +0 -0
  109. {alphaapi-0.2.0b0 → alphaapi-0.3.0b0}/python/alphaapi/testing.py +0 -0
  110. {alphaapi-0.2.0b0 → alphaapi-0.3.0b0}/python/alphaapi/urls.py +0 -0
  111. {alphaapi-0.2.0b0 → alphaapi-0.3.0b0}/python/alphaapi/welcome.py +0 -0
  112. {alphaapi-0.2.0b0 → alphaapi-0.3.0b0}/review.txt +0 -0
  113. {alphaapi-0.2.0b0 → alphaapi-0.3.0b0}/src/response.rs +0 -0
  114. {alphaapi-0.2.0b0 → alphaapi-0.3.0b0}/tasks/manage.py +0 -0
  115. {alphaapi-0.2.0b0 → alphaapi-0.3.0b0}/tasks/tasks/__init__.py +0 -0
  116. {alphaapi-0.2.0b0 → alphaapi-0.3.0b0}/tasks/tasks/app.py +0 -0
  117. {alphaapi-0.2.0b0 → alphaapi-0.3.0b0}/tasks/tasks/store.py +0 -0
  118. {alphaapi-0.2.0b0 → alphaapi-0.3.0b0}/tasks/tasks/urls.py +0 -0
  119. {alphaapi-0.2.0b0 → alphaapi-0.3.0b0}/tasks/tasks/views.py +0 -0
  120. {alphaapi-0.2.0b0 → alphaapi-0.3.0b0}/tests/test_binding.py +0 -0
  121. {alphaapi-0.2.0b0 → alphaapi-0.3.0b0}/tests/test_cli_tools.py +0 -0
  122. {alphaapi-0.2.0b0 → alphaapi-0.3.0b0}/tests/test_multipart.py +0 -0
  123. {alphaapi-0.2.0b0 → alphaapi-0.3.0b0}/tests/test_observability.py +0 -0
  124. {alphaapi-0.2.0b0 → alphaapi-0.3.0b0}/tests/test_openapi_static_templates.py +0 -0
  125. {alphaapi-0.2.0b0 → alphaapi-0.3.0b0}/tests/test_security_features.py +0 -0
  126. {alphaapi-0.2.0b0 → alphaapi-0.3.0b0}/tests/test_sessions_auth.py +0 -0
  127. {alphaapi-0.2.0b0 → alphaapi-0.3.0b0}/tests/test_test_client.py +0 -0
@@ -26,12 +26,28 @@ jobs:
26
26
  run: cargo test --all-targets
27
27
 
28
28
  python:
29
+ name: Python ${{ matrix.python-version }} (${{ matrix.target }})
29
30
  runs-on: ${{ matrix.os }}
31
+ env:
32
+ ALPHAAPI_TRANSPORT: ${{ matrix.transport }}
30
33
  strategy:
31
34
  fail-fast: false
32
35
  matrix:
33
- os: [ubuntu-latest, windows-latest]
36
+ target: [linux-tokio, linux-uring, windows-tokio]
34
37
  python-version: ["3.10", "3.11", "3.12", "3.13"]
38
+ include:
39
+ - target: linux-tokio
40
+ os: ubuntu-latest
41
+ transport: tokio
42
+ extras: dev,uvloop,rsloop
43
+ - target: linux-uring
44
+ os: ubuntu-latest
45
+ transport: uring
46
+ extras: dev,uvloop,rsloop
47
+ - target: windows-tokio
48
+ os: windows-latest
49
+ transport: tokio
50
+ extras: dev,rsloop
35
51
  steps:
36
52
  - uses: actions/checkout@v4
37
53
  - uses: actions/setup-python@v5
@@ -40,9 +56,24 @@ jobs:
40
56
  - uses: dtolnay/rust-toolchain@stable
41
57
  - uses: Swatinem/rust-cache@v2
42
58
  - name: Install package
43
- run: pip install -e ".[dev]"
44
- - name: Test
45
- run: pytest -q
59
+ run: python -m pip install -e ".[${{ matrix.extras }}]"
60
+ - name: Check rsloop import
61
+ run: python -c "import rsloop"
62
+ - name: Check uvloop import
63
+ if: runner.os == 'Linux'
64
+ run: python -c "import uvloop"
65
+ - name: Test with Tokio
66
+ if: matrix.transport == 'tokio'
67
+ run: python -m pytest -q
68
+ - name: Test with io_uring
69
+ if: matrix.transport == 'uring'
70
+ run: |
71
+ if [ "$(cat /proc/sys/kernel/io_uring_disabled)" != 0 ]; then
72
+ sudo sysctl -w kernel.io_uring_disabled=0
73
+ fi
74
+ # Derive one HTTP worker for server instances with no explicit worker count.
75
+ cpu=$(python -c 'import os; print(min(os.sched_getaffinity(0)))')
76
+ taskset -c "$cpu" python -m pytest -q
46
77
 
47
78
  lint:
48
79
  runs-on: ubuntu-latest
@@ -0,0 +1,53 @@
1
+ name: release
2
+
3
+ on:
4
+ release:
5
+ types: [published]
6
+
7
+ permissions:
8
+ contents: read
9
+
10
+ jobs:
11
+ build:
12
+ name: Build distributions (${{ matrix.os }})
13
+ runs-on: ${{ matrix.os }}
14
+ strategy:
15
+ matrix:
16
+ os: [ubuntu-latest, windows-latest]
17
+ steps:
18
+ - uses: actions/checkout@v4
19
+ - uses: actions/setup-python@v5
20
+ with:
21
+ python-version: "3.12"
22
+ - uses: dtolnay/rust-toolchain@stable
23
+ - name: Install Maturin
24
+ run: python -m pip install -q "maturin>=1.7,<2.0"
25
+ - name: Build wheel
26
+ run: maturin build --release --out dist
27
+ - name: Verify wheel
28
+ run: |
29
+ python -m pip install --no-index --find-links dist --only-binary :all: alphaapi
30
+ python -c "import alphaapi._core"
31
+ - name: Build sdist
32
+ if: runner.os == 'Linux'
33
+ run: maturin sdist --out dist
34
+ - uses: actions/upload-artifact@v4
35
+ with:
36
+ name: dist-${{ matrix.os }}
37
+ path: dist/
38
+ if-no-files-found: error
39
+
40
+ pypi:
41
+ name: Publish to PyPI
42
+ needs: build
43
+ runs-on: ubuntu-latest
44
+ permissions:
45
+ id-token: write
46
+ steps:
47
+ - uses: actions/download-artifact@v4
48
+ with:
49
+ pattern: dist-*
50
+ merge-multiple: true
51
+ path: dist/
52
+ - name: Publish to PyPI
53
+ uses: pypa/gh-action-pypi-publish@release/v1
@@ -4,23 +4,29 @@ version = 4
4
4
 
5
5
  [[package]]
6
6
  name = "alphaapi"
7
- version = "0.2.0-b"
7
+ version = "0.3.0-b"
8
8
  dependencies = [
9
+ "base64",
9
10
  "bytes",
10
11
  "form_urlencoded",
12
+ "futures-util",
13
+ "hmac",
11
14
  "http",
12
15
  "http-body-util",
13
16
  "hyper",
14
17
  "hyper-util",
15
18
  "itoa",
19
+ "libc",
16
20
  "matchit",
21
+ "pyaio",
17
22
  "pyo3",
18
- "pyo3-async-runtimes",
19
23
  "pythonize",
20
24
  "ryu",
21
25
  "serde",
22
26
  "serde_json",
27
+ "sha2",
23
28
  "tokio",
29
+ "tokio-uring",
24
30
  ]
25
31
 
26
32
  [[package]]
@@ -29,12 +35,69 @@ version = "1.1.2"
29
35
  source = "registry+https://github.com/rust-lang/crates.io-index"
30
36
  checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0"
31
37
 
38
+ [[package]]
39
+ name = "base64"
40
+ version = "0.22.1"
41
+ source = "registry+https://github.com/rust-lang/crates.io-index"
42
+ checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6"
43
+
44
+ [[package]]
45
+ name = "bitflags"
46
+ version = "1.3.2"
47
+ source = "registry+https://github.com/rust-lang/crates.io-index"
48
+ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
49
+
50
+ [[package]]
51
+ name = "block-buffer"
52
+ version = "0.10.4"
53
+ source = "registry+https://github.com/rust-lang/crates.io-index"
54
+ checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71"
55
+ dependencies = [
56
+ "generic-array",
57
+ ]
58
+
32
59
  [[package]]
33
60
  name = "bytes"
34
61
  version = "1.12.1"
35
62
  source = "registry+https://github.com/rust-lang/crates.io-index"
36
63
  checksum = "fc652a48c352aef3ea3aed32080501cf3ef6ed5da78602a020c991775b0aff04"
37
64
 
65
+ [[package]]
66
+ name = "cfg-if"
67
+ version = "1.0.5"
68
+ source = "registry+https://github.com/rust-lang/crates.io-index"
69
+ checksum = "4e7648175b45a9a48536d676f68d918270699102aa8dab5496df06904c914600"
70
+
71
+ [[package]]
72
+ name = "cpufeatures"
73
+ version = "0.2.17"
74
+ source = "registry+https://github.com/rust-lang/crates.io-index"
75
+ checksum = "59ed5838eebb26a2bb2e58f6d5b5316989ae9d08bab10e0e6d103e656d1b0280"
76
+ dependencies = [
77
+ "libc",
78
+ ]
79
+
80
+ [[package]]
81
+ name = "crypto-common"
82
+ version = "0.1.7"
83
+ source = "registry+https://github.com/rust-lang/crates.io-index"
84
+ checksum = "78c8292055d1c1df0cce5d180393dc8cce0abec0a7102adb6c7b1eef6016d60a"
85
+ dependencies = [
86
+ "generic-array",
87
+ "typenum",
88
+ ]
89
+
90
+ [[package]]
91
+ name = "digest"
92
+ version = "0.10.7"
93
+ source = "registry+https://github.com/rust-lang/crates.io-index"
94
+ checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292"
95
+ dependencies = [
96
+ "block-buffer",
97
+ "crypto-common",
98
+ "subtle",
99
+ ]
100
+
38
101
  [[package]]
39
102
  name = "equivalent"
40
103
  version = "1.0.3"
@@ -81,17 +144,6 @@ version = "0.3.34"
81
144
  source = "registry+https://github.com/rust-lang/crates.io-index"
82
145
  checksum = "92d699e522242e69e3003b94ecc1f960f3a5e015aa7c5d7486e65ad01dd94f5e"
83
146
 
84
- [[package]]
85
- name = "futures-macro"
86
- version = "0.3.34"
87
- source = "registry+https://github.com/rust-lang/crates.io-index"
88
- checksum = "9fb9654ba8355388abeb8dcb4fc62f511300867002afc858860463bdd9fe0c44"
89
- dependencies = [
90
- "proc-macro2",
91
- "quote",
92
- "syn 3.0.9",
93
- ]
94
-
95
147
  [[package]]
96
148
  name = "futures-sink"
97
149
  version = "0.3.34"
@@ -111,12 +163,21 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
111
163
  checksum = "0d50a92467f8ba5dd6e3ee5d4bd04d73ab2e4e1c44474a0674821dfce14b79bc"
112
164
  dependencies = [
113
165
  "futures-core",
114
- "futures-macro",
115
166
  "futures-task",
116
167
  "pin-project-lite",
117
168
  "slab",
118
169
  ]
119
170
 
171
+ [[package]]
172
+ name = "generic-array"
173
+ version = "0.14.7"
174
+ source = "registry+https://github.com/rust-lang/crates.io-index"
175
+ checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a"
176
+ dependencies = [
177
+ "typenum",
178
+ "version_check",
179
+ ]
180
+
120
181
  [[package]]
121
182
  name = "h2"
122
183
  version = "0.4.20"
@@ -148,6 +209,15 @@ version = "0.5.0"
148
209
  source = "registry+https://github.com/rust-lang/crates.io-index"
149
210
  checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea"
150
211
 
212
+ [[package]]
213
+ name = "hmac"
214
+ version = "0.12.1"
215
+ source = "registry+https://github.com/rust-lang/crates.io-index"
216
+ checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e"
217
+ dependencies = [
218
+ "digest",
219
+ ]
220
+
151
221
  [[package]]
152
222
  name = "http"
153
223
  version = "1.5.0"
@@ -238,6 +308,16 @@ dependencies = [
238
308
  "hashbrown",
239
309
  ]
240
310
 
311
+ [[package]]
312
+ name = "io-uring"
313
+ version = "0.6.4"
314
+ source = "registry+https://github.com/rust-lang/crates.io-index"
315
+ checksum = "595a0399f411a508feb2ec1e970a4a30c249351e30208960d58298de8660b0e5"
316
+ dependencies = [
317
+ "bitflags",
318
+ "libc",
319
+ ]
320
+
241
321
  [[package]]
242
322
  name = "itoa"
243
323
  version = "1.0.18"
@@ -306,6 +386,16 @@ dependencies = [
306
386
  "unicode-ident",
307
387
  ]
308
388
 
389
+ [[package]]
390
+ name = "pyaio"
391
+ version = "0.1.0"
392
+ source = "registry+https://github.com/rust-lang/crates.io-index"
393
+ checksum = "4b87dc4f355641d38d75efe36ccd55178f9a54780a438430bca1e9ccf648e048"
394
+ dependencies = [
395
+ "pyo3",
396
+ "tokio",
397
+ ]
398
+
309
399
  [[package]]
310
400
  name = "pyo3"
311
401
  version = "0.29.3"
@@ -320,19 +410,6 @@ dependencies = [
320
410
  "pyo3-macros",
321
411
  ]
322
412
 
323
- [[package]]
324
- name = "pyo3-async-runtimes"
325
- version = "0.29.0"
326
- source = "registry+https://github.com/rust-lang/crates.io-index"
327
- checksum = "b3ef68daa7316a3fac65e5e18b2203f010346de1c1c53456811a2624673ab046"
328
- dependencies = [
329
- "futures-channel",
330
- "futures-util",
331
- "once_cell",
332
- "pin-project-lite",
333
- "pyo3",
334
- ]
335
-
336
413
  [[package]]
337
414
  name = "pyo3-build-config"
338
415
  version = "0.29.3"
@@ -444,6 +521,17 @@ dependencies = [
444
521
  "zmij",
445
522
  ]
446
523
 
524
+ [[package]]
525
+ name = "sha2"
526
+ version = "0.10.9"
527
+ source = "registry+https://github.com/rust-lang/crates.io-index"
528
+ checksum = "a7507d819769d01a365ab707794a4084392c824f54a7a6a7862f8c3d0892b283"
529
+ dependencies = [
530
+ "cfg-if",
531
+ "cpufeatures",
532
+ "digest",
533
+ ]
534
+
447
535
  [[package]]
448
536
  name = "signal-hook-registry"
449
537
  version = "1.4.8"
@@ -466,6 +554,16 @@ version = "1.16.5"
466
554
  source = "registry+https://github.com/rust-lang/crates.io-index"
467
555
  checksum = "149309498a5f7334b12ddae0cad8aba81ce785fe91755068867e017cf98fee46"
468
556
 
557
+ [[package]]
558
+ name = "socket2"
559
+ version = "0.4.10"
560
+ source = "registry+https://github.com/rust-lang/crates.io-index"
561
+ checksum = "9f7916fc008ca5542385b89a3d3ce689953c143e9304a9bf8beec1de48994c0d"
562
+ dependencies = [
563
+ "libc",
564
+ "winapi",
565
+ ]
566
+
469
567
  [[package]]
470
568
  name = "socket2"
471
569
  version = "0.6.5"
@@ -476,6 +574,12 @@ dependencies = [
476
574
  "windows-sys",
477
575
  ]
478
576
 
577
+ [[package]]
578
+ name = "subtle"
579
+ version = "2.6.1"
580
+ source = "registry+https://github.com/rust-lang/crates.io-index"
581
+ checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292"
582
+
479
583
  [[package]]
480
584
  name = "syn"
481
585
  version = "2.0.119"
@@ -515,7 +619,7 @@ dependencies = [
515
619
  "mio",
516
620
  "pin-project-lite",
517
621
  "signal-hook-registry",
518
- "socket2",
622
+ "socket2 0.6.5",
519
623
  "tokio-macros",
520
624
  "windows-sys",
521
625
  ]
@@ -531,6 +635,20 @@ dependencies = [
531
635
  "syn 3.0.9",
532
636
  ]
533
637
 
638
+ [[package]]
639
+ name = "tokio-uring"
640
+ version = "0.5.0"
641
+ source = "registry+https://github.com/rust-lang/crates.io-index"
642
+ checksum = "748482e3e13584a34664a710168ad5068e8cb1d968aa4ffa887e83ca6dd27967"
643
+ dependencies = [
644
+ "futures-util",
645
+ "io-uring",
646
+ "libc",
647
+ "slab",
648
+ "socket2 0.4.10",
649
+ "tokio",
650
+ ]
651
+
534
652
  [[package]]
535
653
  name = "tokio-util"
536
654
  version = "0.7.20"
@@ -564,18 +682,52 @@ dependencies = [
564
682
  "once_cell",
565
683
  ]
566
684
 
685
+ [[package]]
686
+ name = "typenum"
687
+ version = "1.20.1"
688
+ source = "registry+https://github.com/rust-lang/crates.io-index"
689
+ checksum = "b6f5e870be6c3b371b77fe0ee0bafb859fa4964b4404c27de1d380043c4dda20"
690
+
567
691
  [[package]]
568
692
  name = "unicode-ident"
569
693
  version = "1.0.27"
570
694
  source = "registry+https://github.com/rust-lang/crates.io-index"
571
695
  checksum = "a2c754d6c33795a1c324727428e5a7dedb5b06195f9890bdbcba760d3e246563"
572
696
 
697
+ [[package]]
698
+ name = "version_check"
699
+ version = "0.9.5"
700
+ source = "registry+https://github.com/rust-lang/crates.io-index"
701
+ checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a"
702
+
573
703
  [[package]]
574
704
  name = "wasi"
575
705
  version = "0.11.1+wasi-snapshot-preview1"
576
706
  source = "registry+https://github.com/rust-lang/crates.io-index"
577
707
  checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b"
578
708
 
709
+ [[package]]
710
+ name = "winapi"
711
+ version = "0.3.9"
712
+ source = "registry+https://github.com/rust-lang/crates.io-index"
713
+ checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419"
714
+ dependencies = [
715
+ "winapi-i686-pc-windows-gnu",
716
+ "winapi-x86_64-pc-windows-gnu",
717
+ ]
718
+
719
+ [[package]]
720
+ name = "winapi-i686-pc-windows-gnu"
721
+ version = "0.4.0"
722
+ source = "registry+https://github.com/rust-lang/crates.io-index"
723
+ checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
724
+
725
+ [[package]]
726
+ name = "winapi-x86_64-pc-windows-gnu"
727
+ version = "0.4.0"
728
+ source = "registry+https://github.com/rust-lang/crates.io-index"
729
+ checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
730
+
579
731
  [[package]]
580
732
  name = "windows-link"
581
733
  version = "0.2.1"
@@ -1,6 +1,6 @@
1
1
  [package]
2
2
  name = "alphaapi"
3
- version = "0.2.0-b"
3
+ version = "0.3.0-b"
4
4
  edition = "2021"
5
5
  rust-version = "1.83"
6
6
  description = "A fast, Django-shaped async Python web framework powered by Rust"
@@ -11,9 +11,13 @@ readme = "README.md"
11
11
  name = "_core"
12
12
  crate-type = ["cdylib", "rlib"]
13
13
 
14
+ [[example]]
15
+ name = "connload"
16
+ path = "benchmarks/connload.rs"
17
+
14
18
  [dependencies]
15
19
  pyo3 = { version = "0.29.3", features = ["extension-module", "abi3-py39"] }
16
- pyo3-async-runtimes = "0.29"
20
+ pyaio = "0.1"
17
21
  pythonize = "0.29"
18
22
  tokio = { version = "1", features = ["rt-multi-thread", "net", "signal", "time", "sync", "macros"] }
19
23
  hyper = { version = "1", features = ["http1", "http2", "server"] }
@@ -25,9 +29,20 @@ form_urlencoded = "1"
25
29
  serde = { version = "1", features = ["derive"] }
26
30
  serde_json = "1"
27
31
  bytes = "1"
32
+ base64 = "0.22"
33
+ hmac = "0.12"
34
+ sha2 = "0.10"
28
35
  itoa = "1"
29
36
  ryu = "1"
30
37
 
38
+ [target.'cfg(target_os = "linux")'.dependencies]
39
+ futures-util = { version = "0.3", default-features = false, features = ["std"] }
40
+ libc = "0.2"
41
+ tokio-uring = "0.5"
42
+
43
+ [dev-dependencies]
44
+ tokio = { version = "1", features = ["io-util"] }
45
+
31
46
  [profile.release]
32
47
  lto = "thin"
33
48
  codegen-units = 1
@@ -0,0 +1,180 @@
1
+ Metadata-Version: 2.4
2
+ Name: alphaapi
3
+ Version: 0.3.0b0
4
+ Classifier: Development Status :: 4 - Beta
5
+ Classifier: Framework :: AsyncIO
6
+ Classifier: Intended Audience :: Developers
7
+ Classifier: License :: OSI Approved :: MIT License
8
+ Classifier: Programming Language :: Python :: 3
9
+ Classifier: Programming Language :: Rust
10
+ Classifier: Topic :: Internet :: WWW/HTTP :: HTTP Servers
11
+ Classifier: Typing :: Typed
12
+ Requires-Dist: fastapi>=0.110 ; extra == 'bench'
13
+ Requires-Dist: uvicorn>=0.30 ; extra == 'bench'
14
+ Requires-Dist: pytest>=8 ; extra == 'dev'
15
+ Requires-Dist: pydantic>=2 ; extra == 'dev'
16
+ Requires-Dist: mkdocs-material>=9 ; extra == 'docs'
17
+ Requires-Dist: mkdocstrings[python]>=0.26 ; extra == 'docs'
18
+ Requires-Dist: ruff>=0.6 ; extra == 'docs'
19
+ Requires-Dist: pydantic>=2 ; extra == 'pydantic'
20
+ Requires-Dist: rsloop>=0.1.70 ; python_full_version >= '3.10' and implementation_name == 'cpython' and extra == 'rsloop'
21
+ Requires-Dist: jinja2>=3 ; extra == 'templates'
22
+ Requires-Dist: uvloop>=0.19 ; implementation_name == 'cpython' and sys_platform != 'win32' and extra == 'uvloop'
23
+ Provides-Extra: bench
24
+ Provides-Extra: dev
25
+ Provides-Extra: docs
26
+ Provides-Extra: pydantic
27
+ Provides-Extra: rsloop
28
+ Provides-Extra: templates
29
+ Provides-Extra: uvloop
30
+ License-File: LICENSE
31
+ Summary: A Django-shaped, async-native Python web framework with a Rust core
32
+ Keywords: web,framework,http,rust,django,asyncio
33
+ Author: AlphaAPI contributors
34
+ License: MIT
35
+ Requires-Python: >=3.9
36
+ Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
37
+
38
+ # AlphaAPI
39
+
40
+ AlphaAPI is a Django-shaped, async-native Python web framework with a Rust HTTP
41
+ server. It provides URLconfs, middleware, typed request binding, streaming,
42
+ OpenAPI generation, and a test client that makes real HTTP requests. Bring your
43
+ own database layer.
44
+
45
+ AlphaAPI is in beta and its public API may evolve.
46
+
47
+ [Documentation](https://amogus-gggy.github.io/AlphaAPI/) ·
48
+ [PyPI](https://pypi.org/project/alphaapi/)
49
+
50
+ ## Install
51
+
52
+ AlphaAPI requires Python 3.9 or later. Use a virtual environment and install
53
+ from PyPI.
54
+
55
+ ```bash
56
+ python -m pip install alphaapi
57
+ ```
58
+
59
+ See [Getting started](docs/getting-started.md) for Windows PowerShell setup,
60
+ wheel availability, and source builds.
61
+
62
+ ## Quick start
63
+
64
+ Save this as `main.py`:
65
+
66
+ ```python
67
+ from alphaapi import Application, JsonResponse, path
68
+
69
+
70
+ async def index(request):
71
+ return JsonResponse({"hello": "world"})
72
+
73
+
74
+ async def read_item(request, item_id: int):
75
+ return JsonResponse({"item_id": item_id, "q": request.GET.get("q")})
76
+
77
+
78
+ app = Application(
79
+ urlpatterns=[
80
+ path("", index, name="index"),
81
+ path("items/<int:item_id>/", read_item, name="item"),
82
+ ],
83
+ )
84
+ ```
85
+
86
+ ```bash
87
+ alphaapi runserver main:app --port 8000
88
+ ```
89
+
90
+ Open `http://127.0.0.1:8000/items/42/?q=hello` to see the JSON response.
91
+
92
+ For a project with a settings module, URLconf, and management script, use the
93
+ scaffold commands:
94
+
95
+ ```bash
96
+ alphaapi startproject mysite
97
+ cd mysite
98
+ alphaapi startapp blog
99
+ python manage.py --port 8000
100
+ ```
101
+
102
+ See the [bundled examples](examples/) for both layouts and the
103
+ [CLI reference](docs/api/cli.md) for `routes`, `check`, and reload options.
104
+
105
+ ## Python event loop and HTTP transport
106
+
107
+ AlphaAPI runs async views, lifecycle hooks, and async streams on an application
108
+ loop. It uses `asyncio` by default. Set `EVENT_LOOP` or pass `--loop` to choose
109
+ another backend. `uvloop` is available on supported Unix platforms with CPython.
110
+ `rsloop` requires CPython 3.10 or later on a supported platform, including
111
+ Windows. `--loop auto` uses uvloop when available and asyncio otherwise.
112
+
113
+ ```bash
114
+ python -m pip install "alphaapi[rsloop]"
115
+ alphaapi runserver main:app --loop rsloop
116
+ ```
117
+
118
+ The Rust server selects its HTTP transport independently. On Linux, it tries
119
+ `io_uring` with one HTTP worker and uses Tokio if ring creation fails. Tokio
120
+ also handles multi-worker runs and runs on Windows and macOS. To require
121
+ `io_uring` on Linux:
122
+
123
+ ```bash
124
+ ALPHAAPI_TRANSPORT=uring alphaapi runserver main:app --workers 1
125
+ ```
126
+
127
+ Use `ALPHAAPI_TRANSPORT=tokio` on Linux to require Tokio. See the
128
+ [event-loop settings](docs/api/settings.md#python-event-loop) and the
129
+ [transport modes](docs/tutorials/deployment.md#http-transport) for details.
130
+
131
+ ## Documentation
132
+
133
+ - [Build a task API](docs/tutorials/task-api.md) or a [blog](docs/tutorials/blog.md).
134
+ - [Bind and validate request parameters](docs/api/binding.md),
135
+ [stream responses and files](docs/api/streaming.md), or publish an
136
+ [OpenAPI schema](docs/api/openapi.md).
137
+ - Organize [reusable apps](docs/api/apps.md) and serve
138
+ [static files](docs/api/static-files.md) or [Jinja2 templates](docs/api/templates.md).
139
+ - [Configure security](docs/api/security.md),
140
+ [sessions](docs/api/sessions.md), and [observability](docs/api/observability.md).
141
+ - [Deploy behind a reverse proxy](docs/tutorials/deployment.md) or browse the
142
+ [API reference](docs/api/index.md).
143
+
144
+ Build the site locally from the repository root. GitHub Pages is updated when a
145
+ GitHub release is published.
146
+
147
+ ```bash
148
+ python -m pip install -e ".[docs]"
149
+ mkdocs build --strict
150
+ ```
151
+
152
+ ## Testing and benchmarks
153
+
154
+ ```bash
155
+ python -m pip install -e ".[dev]"
156
+ python -m pytest -q
157
+ ```
158
+
159
+ [CI](.github/workflows/ci.yml) runs on CPython 3.10–3.13 with Tokio and io_uring
160
+ on Linux and Tokio on Windows. The backend tests cover `asyncio`, `auto`, and
161
+ `rsloop` on both platforms and `uvloop` on Linux. See the
162
+ [`Client` reference](docs/api/testing.md) to test an application.
163
+
164
+ The [benchmarks](benchmarks/) include a FastAPI comparison, a guide to testing
165
+ [fresh connections and open descriptors](benchmarks/connections.md), and a
166
+ [profile-guided build guide](benchmarks/pgo.md).
167
+
168
+ ```bash
169
+ python -m pip install -e ".[bench]"
170
+ python benchmarks/bench.py --fastapi
171
+ python benchmarks/bench.py --path /async-json --loop asyncio --loop rsloop
172
+ ```
173
+
174
+ Install the `rsloop` extra before comparing event loops. Use the same worker
175
+ count and HTTP transport across runs to compare backends.
176
+
177
+ ## License
178
+
179
+ [MIT](LICENSE)
180
+