pyrustapi 0.1.29__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 (70) hide show
  1. pyrustapi-0.1.29/.github/workflows/CI.yml +44 -0
  2. pyrustapi-0.1.29/.github/workflows/release.yml +107 -0
  3. pyrustapi-0.1.29/.gitignore +23 -0
  4. pyrustapi-0.1.29/Cargo.lock +2594 -0
  5. pyrustapi-0.1.29/Cargo.toml +38 -0
  6. pyrustapi-0.1.29/LICENSE +21 -0
  7. pyrustapi-0.1.29/PKG-INFO +100 -0
  8. pyrustapi-0.1.29/README.md +66 -0
  9. pyrustapi-0.1.29/ROADMAP.md +78 -0
  10. pyrustapi-0.1.29/benchmarks/benchmark.sh +32 -0
  11. pyrustapi-0.1.29/benchmarks/data/fastapi_app.py +41 -0
  12. pyrustapi-0.1.29/benchmarks/data/fastapi_cpu_app.py +38 -0
  13. pyrustapi-0.1.29/benchmarks/data/fastapi_edge_app.py +28 -0
  14. pyrustapi-0.1.29/benchmarks/data/fastapi_oha.py +44 -0
  15. pyrustapi-0.1.29/benchmarks/data/large.json +1 -0
  16. pyrustapi-0.1.29/benchmarks/data/mixed.json +1 -0
  17. pyrustapi-0.1.29/benchmarks/data/rustapi_app.py +36 -0
  18. pyrustapi-0.1.29/benchmarks/data/rustapi_cpu_app.py +43 -0
  19. pyrustapi-0.1.29/benchmarks/data/rustapi_edge_app.py +20 -0
  20. pyrustapi-0.1.29/benchmarks/data/rustapi_multiworker_app.py +12 -0
  21. pyrustapi-0.1.29/benchmarks/data/rustapi_oha.py +41 -0
  22. pyrustapi-0.1.29/benchmarks/data/rustapi_tier3_app.py +12 -0
  23. pyrustapi-0.1.29/benchmarks/data/tier_app.py +42 -0
  24. pyrustapi-0.1.29/benchmarks/data/validate.json +1 -0
  25. pyrustapi-0.1.29/benchmarks/run_3tier_benchmark.py +173 -0
  26. pyrustapi-0.1.29/benchmarks/run_comparison_benchmark.py +220 -0
  27. pyrustapi-0.1.29/benchmarks/run_cpu_stability_benchmark.py +248 -0
  28. pyrustapi-0.1.29/benchmarks/run_edgecase_benchmark.py +191 -0
  29. pyrustapi-0.1.29/benchmarks/run_native_tier3_benchmark.py +68 -0
  30. pyrustapi-0.1.29/benchmarks/run_real_oha_benchmark.py +214 -0
  31. pyrustapi-0.1.29/benchmarks/run_release_highspeed_benchmark.py +78 -0
  32. pyrustapi-0.1.29/docs/3tier_architecture_and_benchmarks.md +109 -0
  33. pyrustapi-0.1.29/docs/database_engine.md +45 -0
  34. pyrustapi-0.1.29/docs/docs.md +479 -0
  35. pyrustapi-0.1.29/docs/getting_started.md +126 -0
  36. pyrustapi-0.1.29/docs/mcp_server.md +59 -0
  37. pyrustapi-0.1.29/docs/native_business_logic.md +113 -0
  38. pyrustapi-0.1.29/docs/performance_and_benchmarks.md +33 -0
  39. pyrustapi-0.1.29/docs/power_primitives.md +55 -0
  40. pyrustapi-0.1.29/docs/response_types.md +57 -0
  41. pyrustapi-0.1.29/examples/app.py +95 -0
  42. pyrustapi-0.1.29/performance-reports/cpu_intensive_stability_report.md +39 -0
  43. pyrustapi-0.1.29/performance-reports/fastapi_vs_hybrid_vs_native.md +23 -0
  44. pyrustapi-0.1.29/performance-reports/fastapi_vs_rustapi_comparison.md +83 -0
  45. pyrustapi-0.1.29/performance-reports/performance_and_benchmarks.md +27 -0
  46. pyrustapi-0.1.29/performance-reports/rust_native_edgecases_report.md +53 -0
  47. pyrustapi-0.1.29/performance-reports/three_tier_architecture_evaluation.md +51 -0
  48. pyrustapi-0.1.29/pyproject.toml +54 -0
  49. pyrustapi-0.1.29/python/pyrustapi/__init__.py +7 -0
  50. pyrustapi-0.1.29/python/rustapi/__init__.py +108 -0
  51. pyrustapi-0.1.29/python/rustapi/__init__.pyi +218 -0
  52. pyrustapi-0.1.29/python/rustapi/background.py +7 -0
  53. pyrustapi-0.1.29/python/rustapi/depends.py +10 -0
  54. pyrustapi-0.1.29/python/rustapi/exceptions.py +11 -0
  55. pyrustapi-0.1.29/python/rustapi/py.typed +0 -0
  56. pyrustapi-0.1.29/python/rustapi/router.py +41 -0
  57. pyrustapi-0.1.29/python/rustapi/rust.rs +4463 -0
  58. pyrustapi-0.1.29/scratch/.gitkeep +0 -0
  59. pyrustapi-0.1.29/src/lib.rs +2142 -0
  60. pyrustapi-0.1.29/test-reports/junit.xml +1 -0
  61. pyrustapi-0.1.29/tests/test_3tier_architecture.py +113 -0
  62. pyrustapi-0.1.29/tests/test_basic.py +342 -0
  63. pyrustapi-0.1.29/tests/test_database_engine.py +60 -0
  64. pyrustapi-0.1.29/tests/test_imports.py +49 -0
  65. pyrustapi-0.1.29/tests/test_native_routes.py +7 -0
  66. pyrustapi-0.1.29/tests/test_overrides_and_coercion.py +81 -0
  67. pyrustapi-0.1.29/tests/test_reload_and_logging.py +72 -0
  68. pyrustapi-0.1.29/tests/test_response_model.py +74 -0
  69. pyrustapi-0.1.29/tests/test_responses_and_req_json.py +105 -0
  70. pyrustapi-0.1.29/tests/test_rust_power_modules.py +94 -0
@@ -0,0 +1,44 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ tags: ["v*"]
7
+ pull_request:
8
+ branches: [main]
9
+
10
+ jobs:
11
+ test:
12
+ name: Test (${{ matrix.os }})
13
+ runs-on: ${{ matrix.os }}
14
+ strategy:
15
+ fail-fast: false
16
+ matrix:
17
+ os: [ubuntu-latest, macos-latest, windows-latest]
18
+ steps:
19
+ - uses: actions/checkout@v4
20
+ - uses: actions/setup-python@v5
21
+ with:
22
+ python-version: "3.12"
23
+ - name: Install Rust
24
+ uses: dtolnay/rust-toolchain@stable
25
+ - name: Install dependencies
26
+ run: pip install maturin pytest requests pydantic
27
+ - name: Build wheel and install
28
+ shell: bash
29
+ run: |
30
+ maturin build --out dist
31
+ pip install --find-links=dist pyrustapi
32
+ - name: Run tests
33
+ run: pytest tests/ -v
34
+
35
+ build-sdist:
36
+ name: Build sdist
37
+ runs-on: ubuntu-latest
38
+ steps:
39
+ - uses: actions/checkout@v4
40
+ - name: Build sdist
41
+ uses: PyO3/maturin-action@v1
42
+ with:
43
+ command: sdist
44
+ args: --out dist
@@ -0,0 +1,107 @@
1
+ name: Build and Publish to PyPI
2
+
3
+ on:
4
+ push:
5
+ tags:
6
+ - 'v*'
7
+
8
+ jobs:
9
+ # ---------------------------------------------------
10
+ # STAGE 1: Build Source Distribution (sdist)
11
+ # ---------------------------------------------------
12
+ build-sdist:
13
+ name: Build Source Distribution (sdist)
14
+ runs-on: ubuntu-latest
15
+ steps:
16
+ - name: Checkout repository
17
+ uses: actions/checkout@v4
18
+
19
+ - name: Build sdist
20
+ uses: PyO3/maturin-action@v1
21
+ with:
22
+ command: sdist
23
+ args: --out dist
24
+
25
+ - name: Save sdist as Artifact
26
+ uses: actions/upload-artifact@v4
27
+ with:
28
+ name: sdist
29
+ path: dist
30
+
31
+ # ---------------------------------------------------
32
+ # STAGE 2: Build Wheels on all Operating Systems & Architectures
33
+ # ---------------------------------------------------
34
+ build-wheels:
35
+ name: Build Wheels (${{ matrix.platform.os }} - ${{ matrix.platform.target }})
36
+ runs-on: ${{ matrix.platform.os }}
37
+ strategy:
38
+ fail-fast: false
39
+ matrix:
40
+ platform:
41
+ - os: ubuntu-latest
42
+ target: x86_64
43
+ manylinux: auto
44
+ - os: ubuntu-latest
45
+ target: aarch64
46
+ manylinux: auto
47
+ continue_on_error: true
48
+ - os: macos-latest
49
+ target: x86_64
50
+ - os: macos-latest
51
+ target: aarch64
52
+ - os: windows-latest
53
+ target: x64
54
+
55
+ continue-on-error: ${{ matrix.platform.continue_on_error || false }}
56
+
57
+ steps:
58
+ - name: Checkout repository
59
+ uses: actions/checkout@v4
60
+
61
+ - name: Set up Python
62
+ uses: actions/setup-python@v5
63
+ with:
64
+ python-version: '3.12'
65
+
66
+ - name: Set up QEMU (for ARM64 cross-compilation)
67
+ if: matrix.platform.target == 'aarch64'
68
+ uses: docker/setup-qemu-action@v3
69
+
70
+ - name: Build Wheels
71
+ uses: PyO3/maturin-action@v1
72
+ env:
73
+ CFLAGS_aarch64_unknown_linux_gnu: "-D__ARM_ARCH=8 -march=armv8-a"
74
+ CFLAGS_aarch64_unknown_linux_musl: "-D__ARM_ARCH=8 -march=armv8-a"
75
+ with:
76
+ target: ${{ matrix.platform.target }}
77
+ manylinux: ${{ matrix.platform.manylinux || '' }}
78
+ command: build
79
+ args: --release --out dist
80
+
81
+ - name: Save Wheels as Artifacts
82
+ uses: actions/upload-artifact@v4
83
+ with:
84
+ name: wheels-${{ matrix.platform.os }}-${{ matrix.platform.target }}
85
+ path: dist
86
+
87
+ # ---------------------------------------------------
88
+ # STAGE 3: Publish all collected wheels & sdist to PyPI
89
+ # ---------------------------------------------------
90
+ publish:
91
+ name: Publish to PyPI
92
+ needs: [build-sdist, build-wheels]
93
+ if: always() && needs.build-sdist.result == 'success'
94
+ runs-on: ubuntu-latest
95
+ steps:
96
+ - name: Download all built artifacts
97
+ uses: actions/download-artifact@v4
98
+ with:
99
+ path: dist
100
+ pattern: '*'
101
+ merge-multiple: true
102
+
103
+ - name: Publish to PyPI
104
+ uses: pypa/gh-action-pypi-publish@release/v1
105
+ with:
106
+ password: ${{ secrets.PYPI_API_TOKEN }}
107
+ packages-dir: dist
@@ -0,0 +1,23 @@
1
+ # Rust
2
+ /target/
3
+ Cargo.lock
4
+
5
+ # Python
6
+ __pycache__/
7
+ *.pyc
8
+ *.egg-info/
9
+ .venv/
10
+ venv/
11
+ dist/
12
+ build/
13
+ *.so
14
+ *.pyd
15
+
16
+ # maturin
17
+ /target/wheels/
18
+
19
+ # OS / editor
20
+ .DS_Store
21
+ .vscode/
22
+ .idea/
23
+ *.log