runapi 0.1.1__tar.gz → 0.1.2__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.
- runapi-0.1.2/.github/workflows/publish.yml +115 -0
- {runapi-0.1.1 → runapi-0.1.2}/.gitignore +2 -2
- {runapi-0.1.1 → runapi-0.1.2}/LICENSE +21 -21
- {runapi-0.1.1 → runapi-0.1.2}/MANIFEST.in +18 -18
- {runapi-0.1.1 → runapi-0.1.2}/PKG-INFO +11 -3
- {runapi-0.1.1 → runapi-0.1.2}/README.md +737 -729
- {runapi-0.1.1 → runapi-0.1.2}/pyproject.toml +68 -68
- {runapi-0.1.1 → runapi-0.1.2}/runapi/__init__.py +173 -173
- {runapi-0.1.1 → runapi-0.1.2}/runapi/auth.py +313 -358
- {runapi-0.1.1 → runapi-0.1.2}/runapi/cli.py +671 -602
- {runapi-0.1.1 → runapi-0.1.2}/runapi/config.py +140 -140
- {runapi-0.1.1 → runapi-0.1.2}/runapi/core.py +222 -218
- {runapi-0.1.1 → runapi-0.1.2}/runapi/errors.py +337 -337
- {runapi-0.1.1 → runapi-0.1.2}/runapi/middleware.py +348 -382
- {runapi-0.1.1 → runapi-0.1.2}/tests/final_test.py +378 -378
- {runapi-0.1.1 → runapi-0.1.2}/tests/simple_test.py +188 -188
- {runapi-0.1.1 → runapi-0.1.2}/tests/test_runapi.py +385 -385
- {runapi-0.1.1 → runapi-0.1.2}/tests/test_runapi_installation.py +380 -380
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
name: Publish Python 🐍 distribution to PyPI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches:
|
|
6
|
+
- main
|
|
7
|
+
- master
|
|
8
|
+
release:
|
|
9
|
+
types: [published]
|
|
10
|
+
|
|
11
|
+
jobs:
|
|
12
|
+
check-version:
|
|
13
|
+
runs-on: ubuntu-latest
|
|
14
|
+
outputs:
|
|
15
|
+
is_new_version: ${{ steps.check.outputs.is_new_version }}
|
|
16
|
+
steps:
|
|
17
|
+
- uses: actions/checkout@v4
|
|
18
|
+
|
|
19
|
+
- name: Set up Python
|
|
20
|
+
uses: actions/setup-python@v5
|
|
21
|
+
with:
|
|
22
|
+
python-version: "3.11"
|
|
23
|
+
|
|
24
|
+
- name: Check if version is new
|
|
25
|
+
id: check
|
|
26
|
+
shell: python
|
|
27
|
+
run: |
|
|
28
|
+
import tomllib
|
|
29
|
+
import sys
|
|
30
|
+
import json
|
|
31
|
+
import os
|
|
32
|
+
from urllib.request import urlopen
|
|
33
|
+
from urllib.error import HTTPError
|
|
34
|
+
|
|
35
|
+
try:
|
|
36
|
+
with open("pyproject.toml", "rb") as f:
|
|
37
|
+
project = tomllib.load(f)
|
|
38
|
+
local_version = project["project"]["version"]
|
|
39
|
+
package_name = project["project"]["name"]
|
|
40
|
+
|
|
41
|
+
print(f"Checking version {local_version} for package {package_name}...")
|
|
42
|
+
|
|
43
|
+
try:
|
|
44
|
+
with urlopen(f"https://pypi.org/pypi/{package_name}/json") as response:
|
|
45
|
+
data = json.load(response)
|
|
46
|
+
pypi_versions = data["releases"].keys()
|
|
47
|
+
if local_version in pypi_versions:
|
|
48
|
+
print(f"Version {local_version} already exists on PyPI. Skipping build & publish.")
|
|
49
|
+
with open(os.environ['GITHUB_OUTPUT'], 'a') as fh:
|
|
50
|
+
print("is_new_version=false", file=fh)
|
|
51
|
+
else:
|
|
52
|
+
print(f"Version {local_version} is new! Proceeding.")
|
|
53
|
+
with open(os.environ['GITHUB_OUTPUT'], 'a') as fh:
|
|
54
|
+
print("is_new_version=true", file=fh)
|
|
55
|
+
except HTTPError as e:
|
|
56
|
+
if e.code == 404:
|
|
57
|
+
print("Package not found on PyPI (first deployment). Proceeding.")
|
|
58
|
+
with open(os.environ['GITHUB_OUTPUT'], 'a') as fh:
|
|
59
|
+
print("is_new_version=true", file=fh)
|
|
60
|
+
else:
|
|
61
|
+
print(f"Error checking PyPI: {e}")
|
|
62
|
+
sys.exit(1)
|
|
63
|
+
|
|
64
|
+
except Exception as e:
|
|
65
|
+
print(f"Error: {e}")
|
|
66
|
+
sys.exit(1)
|
|
67
|
+
|
|
68
|
+
build:
|
|
69
|
+
needs: check-version
|
|
70
|
+
if: needs.check-version.outputs.is_new_version == 'true'
|
|
71
|
+
name: Build distribution 📦
|
|
72
|
+
runs-on: ubuntu-latest
|
|
73
|
+
|
|
74
|
+
steps:
|
|
75
|
+
- uses: actions/checkout@v4
|
|
76
|
+
|
|
77
|
+
- name: Set up Python
|
|
78
|
+
uses: actions/setup-python@v5
|
|
79
|
+
with:
|
|
80
|
+
python-version: "3.11"
|
|
81
|
+
|
|
82
|
+
- name: Install build dependencies
|
|
83
|
+
run: |
|
|
84
|
+
python -m pip install --upgrade pip
|
|
85
|
+
pip install build
|
|
86
|
+
|
|
87
|
+
- name: Build a binary wheel and a source tarball
|
|
88
|
+
run: python -m build
|
|
89
|
+
|
|
90
|
+
- name: Store the distribution packages
|
|
91
|
+
uses: actions/upload-artifact@v4
|
|
92
|
+
with:
|
|
93
|
+
name: python-package-distributions
|
|
94
|
+
path: dist/
|
|
95
|
+
|
|
96
|
+
publish-to-pypi:
|
|
97
|
+
name: Publish Python 🐍 distribution to PyPI
|
|
98
|
+
needs: build
|
|
99
|
+
runs-on: ubuntu-latest
|
|
100
|
+
permissions:
|
|
101
|
+
id-token: write
|
|
102
|
+
|
|
103
|
+
steps:
|
|
104
|
+
- name: Download all the dists
|
|
105
|
+
uses: actions/download-artifact@v4
|
|
106
|
+
with:
|
|
107
|
+
name: python-package-distributions
|
|
108
|
+
path: dist/
|
|
109
|
+
|
|
110
|
+
- name: Publish distribution 📦 to PyPI
|
|
111
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
112
|
+
with:
|
|
113
|
+
password: ${{ secrets.PYPI_API_TOKEN }}
|
|
114
|
+
skip-existing: true
|
|
115
|
+
verbose: true
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
__pycache__/
|
|
2
|
-
dist/
|
|
1
|
+
__pycache__/
|
|
2
|
+
dist/
|
|
3
3
|
venv/
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2024 Amanpreet Singh
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 Amanpreet Singh
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
include README.md
|
|
2
|
-
include LICENSE
|
|
3
|
-
include pyproject.toml
|
|
4
|
-
recursive-include runapi *.py
|
|
5
|
-
recursive-exclude * __pycache__
|
|
6
|
-
recursive-exclude * *.py[co]
|
|
7
|
-
recursive-exclude * *.orig
|
|
8
|
-
recursive-exclude * *.rej
|
|
9
|
-
recursive-exclude * .git*
|
|
10
|
-
recursive-exclude * .DS_Store
|
|
11
|
-
exclude .gitignore
|
|
12
|
-
exclude test_*.py
|
|
13
|
-
exclude simple_test.py
|
|
14
|
-
exclude final_test.py
|
|
15
|
-
global-exclude *.pyc
|
|
16
|
-
global-exclude .pytest_cache
|
|
17
|
-
global-exclude venv
|
|
18
|
-
global-exclude __pycache__
|
|
1
|
+
include README.md
|
|
2
|
+
include LICENSE
|
|
3
|
+
include pyproject.toml
|
|
4
|
+
recursive-include runapi *.py
|
|
5
|
+
recursive-exclude * __pycache__
|
|
6
|
+
recursive-exclude * *.py[co]
|
|
7
|
+
recursive-exclude * *.orig
|
|
8
|
+
recursive-exclude * *.rej
|
|
9
|
+
recursive-exclude * .git*
|
|
10
|
+
recursive-exclude * .DS_Store
|
|
11
|
+
exclude .gitignore
|
|
12
|
+
exclude test_*.py
|
|
13
|
+
exclude simple_test.py
|
|
14
|
+
exclude final_test.py
|
|
15
|
+
global-exclude *.pyc
|
|
16
|
+
global-exclude .pytest_cache
|
|
17
|
+
global-exclude venv
|
|
18
|
+
global-exclude __pycache__
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: runapi
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.2
|
|
4
4
|
Summary: A Next.js-inspired file-based routing framework built on FastAPI
|
|
5
5
|
Project-URL: Homepage, https://github.com/Amanbig/runapi
|
|
6
6
|
Project-URL: Repository, https://github.com/Amanbig/runapi
|
|
@@ -742,13 +742,21 @@ Please include:
|
|
|
742
742
|
|
|
743
743
|
## Changelog
|
|
744
744
|
|
|
745
|
-
### v0.1.
|
|
745
|
+
### v0.1.2 (Latest)
|
|
746
|
+
- **New Feature**: Added `runapi start` command for production deployments (no-reload, multi-worker support)
|
|
747
|
+
- **Performance**: Optimized startup time by ignoring irrelevant directories during route discovery
|
|
748
|
+
- **Performance**: Replaced O(N) rate limiting with O(1) Fixed Window Counter algorithm
|
|
749
|
+
- **Performance**: Implemented streaming compression using `GZipMiddleware` for lower TTFB and memory usage
|
|
750
|
+
- **Security**: Refactored authentication to use standard `python-jose` library instead of manual implementation
|
|
751
|
+
- **CLI**: Optimized `runapi dev` startup speed and `runapi routes` robustness
|
|
752
|
+
|
|
753
|
+
### v0.1.1
|
|
746
754
|
- **Bug Fix**: Fixed `runapi dev` command failing to import main module
|
|
747
755
|
- **Enhancement**: Improved CLI error handling and validation
|
|
748
756
|
- **Enhancement**: Better Python path management for uvicorn integration
|
|
749
757
|
- **Enhancement**: Added pre-validation of main.py before server startup
|
|
750
758
|
|
|
751
|
-
### v0.1.
|
|
759
|
+
### v0.1.0
|
|
752
760
|
- Initial release
|
|
753
761
|
- File-based routing system
|
|
754
762
|
- JWT authentication
|