runapi 0.1.1__tar.gz → 0.1.3__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 (29) hide show
  1. runapi-0.1.3/.github/ISSUE_TEMPLATE/bug_report.md +27 -0
  2. runapi-0.1.3/.github/ISSUE_TEMPLATE/documentation.md +14 -0
  3. runapi-0.1.3/.github/ISSUE_TEMPLATE/feature_request.md +17 -0
  4. runapi-0.1.3/.github/PULL_REQUEST_TEMPLATE.md +24 -0
  5. runapi-0.1.3/.github/workflows/publish.yml +196 -0
  6. runapi-0.1.3/.gitignore +106 -0
  7. runapi-0.1.3/CONTRIBUTING.md +216 -0
  8. {runapi-0.1.1 → runapi-0.1.3}/LICENSE +21 -21
  9. {runapi-0.1.1 → runapi-0.1.3}/MANIFEST.in +18 -18
  10. {runapi-0.1.1 → runapi-0.1.3}/PKG-INFO +434 -12
  11. {runapi-0.1.1 → runapi-0.1.3}/README.md +1149 -729
  12. {runapi-0.1.1 → runapi-0.1.3}/pyproject.toml +115 -68
  13. {runapi-0.1.1 → runapi-0.1.3}/runapi/__init__.py +254 -174
  14. {runapi-0.1.1 → runapi-0.1.3}/runapi/auth.py +321 -359
  15. runapi-0.1.3/runapi/cli.py +1085 -0
  16. {runapi-0.1.1 → runapi-0.1.3}/runapi/config.py +143 -141
  17. {runapi-0.1.1 → runapi-0.1.3}/runapi/core.py +253 -219
  18. {runapi-0.1.1 → runapi-0.1.3}/runapi/errors.py +339 -338
  19. {runapi-0.1.1 → runapi-0.1.3}/runapi/middleware.py +342 -383
  20. runapi-0.1.3/runapi/repository.py +521 -0
  21. runapi-0.1.3/runapi/schemas.py +382 -0
  22. runapi-0.1.3/runapi/service.py +463 -0
  23. {runapi-0.1.1 → runapi-0.1.3}/tests/final_test.py +377 -379
  24. {runapi-0.1.1 → runapi-0.1.3}/tests/simple_test.py +188 -189
  25. runapi-0.1.3/tests/test_runapi.py +1080 -0
  26. {runapi-0.1.1 → runapi-0.1.3}/tests/test_runapi_installation.py +374 -381
  27. runapi-0.1.1/.gitignore +0 -3
  28. runapi-0.1.1/runapi/cli.py +0 -603
  29. runapi-0.1.1/tests/test_runapi.py +0 -386
@@ -0,0 +1,27 @@
1
+ ---
2
+ name: Bug report
3
+ about: Report a bug to help improve runapi
4
+ labels: bug
5
+ ---
6
+
7
+ ## Description
8
+ Clearly describe the bug.
9
+
10
+ ## Steps to Reproduce
11
+ 1.
12
+ 2.
13
+ 3.
14
+
15
+ ## Expected Behavior
16
+ What did you expect to happen?
17
+
18
+ ## Actual Behavior
19
+ What actually happened?
20
+
21
+ ## Environment
22
+ - OS:
23
+ - Python version:
24
+ - runapi version:
25
+
26
+ ## Additional Context
27
+ Logs, screenshots, or anything else helpful.
@@ -0,0 +1,14 @@
1
+ ---
2
+ name: Documentation issue
3
+ about: Improvements or fixes to documentation
4
+ labels: docs
5
+ ---
6
+
7
+ ## Description
8
+ What is missing, unclear, or incorrect?
9
+
10
+ ## Suggested Improvement
11
+ How should it be improved?
12
+
13
+ ## Additional Context
14
+ Links, screenshots, or references.
@@ -0,0 +1,17 @@
1
+ ---
2
+ name: Feature request
3
+ about: Suggest an idea or improvement
4
+ labels: enhancement
5
+ ---
6
+
7
+ ## Problem
8
+ What problem does this feature solve?
9
+
10
+ ## Proposed Solution
11
+ Describe your idea or approach.
12
+
13
+ ## Alternatives Considered
14
+ Have you considered other solutions?
15
+
16
+ ## Additional Context
17
+ Any extra information or examples.
@@ -0,0 +1,24 @@
1
+ ## Description
2
+ Please provide a clear and concise description of what this PR does.
3
+
4
+ ## Related Issue
5
+ Closes #
6
+
7
+ ## Type of Change
8
+ - [ ] Bug fix
9
+ - [ ] New feature
10
+ - [ ] Documentation update
11
+ - [ ] Tests
12
+ - [ ] Refactor
13
+
14
+ ## How Has This Been Tested?
15
+ Describe how you tested your changes:
16
+ - [ ] Unit tests
17
+ - [ ] Manual testing
18
+ - [ ] Not tested (explain why)
19
+
20
+ ## Checklist
21
+ - [ ] My code follows the project style
22
+ - [ ] I have added tests (if applicable)
23
+ - [ ] I have updated documentation (if needed)
24
+ - [ ] I have linked the related issue
@@ -0,0 +1,196 @@
1
+ name: CI/CD Pipeline
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - main
7
+ - master
8
+ pull_request:
9
+ branches:
10
+ - main
11
+ - master
12
+ release:
13
+ types: [published]
14
+
15
+ jobs:
16
+ lint:
17
+ name: Lint & Format Check
18
+ runs-on: ubuntu-latest
19
+ steps:
20
+ - uses: actions/checkout@v4
21
+
22
+ - name: Set up Python
23
+ uses: actions/setup-python@v5
24
+ with:
25
+ python-version: "3.11"
26
+
27
+ - name: Install linting tools
28
+ run: |
29
+ python -m pip install --upgrade pip
30
+ pip install ruff mypy
31
+
32
+ - name: Check formatting with Ruff
33
+ run: ruff format --check .
34
+
35
+ - name: Lint with Ruff
36
+ run: ruff check .
37
+
38
+ - name: Type check with mypy
39
+ run: mypy runapi --ignore-missing-imports
40
+ continue-on-error: true # Don't fail on type errors initially
41
+
42
+ test:
43
+ name: Test Python ${{ matrix.python-version }}
44
+ runs-on: ubuntu-latest
45
+ needs: lint
46
+ strategy:
47
+ fail-fast: false
48
+ matrix:
49
+ python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
50
+
51
+ steps:
52
+ - uses: actions/checkout@v4
53
+
54
+ - name: Set up Python ${{ matrix.python-version }}
55
+ uses: actions/setup-python@v5
56
+ with:
57
+ python-version: ${{ matrix.python-version }}
58
+
59
+ - name: Install dependencies
60
+ run: |
61
+ python -m pip install --upgrade pip
62
+ pip install -e ".[test]"
63
+
64
+ - name: Run tests
65
+ run: |
66
+ python tests/test_runapi.py
67
+
68
+ check-version:
69
+ runs-on: ubuntu-latest
70
+ needs: test
71
+ if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master')
72
+ outputs:
73
+ is_new_version: ${{ steps.check.outputs.is_new_version }}
74
+ version: ${{ steps.check.outputs.version }}
75
+ steps:
76
+ - uses: actions/checkout@v4
77
+
78
+ - name: Set up Python
79
+ uses: actions/setup-python@v5
80
+ with:
81
+ python-version: "3.11"
82
+
83
+ - name: Check if version is new
84
+ id: check
85
+ shell: python
86
+ run: |
87
+ import tomllib
88
+ import sys
89
+ import json
90
+ import os
91
+ from urllib.request import urlopen
92
+ from urllib.error import HTTPError
93
+
94
+ try:
95
+ with open("pyproject.toml", "rb") as f:
96
+ project = tomllib.load(f)
97
+ local_version = project["project"]["version"]
98
+ package_name = project["project"]["name"]
99
+
100
+ print(f"Checking version {local_version} for package {package_name}...")
101
+
102
+ # Output version for later jobs
103
+ with open(os.environ['GITHUB_OUTPUT'], 'a') as fh:
104
+ print(f"version={local_version}", file=fh)
105
+
106
+ try:
107
+ with urlopen(f"https://pypi.org/pypi/{package_name}/json") as response:
108
+ data = json.load(response)
109
+ pypi_versions = data["releases"].keys()
110
+ if local_version in pypi_versions:
111
+ print(f"Version {local_version} already exists on PyPI. Skipping build & publish.")
112
+ with open(os.environ['GITHUB_OUTPUT'], 'a') as fh:
113
+ print("is_new_version=false", file=fh)
114
+ else:
115
+ print(f"Version {local_version} is new! Proceeding.")
116
+ with open(os.environ['GITHUB_OUTPUT'], 'a') as fh:
117
+ print("is_new_version=true", file=fh)
118
+ except HTTPError as e:
119
+ if e.code == 404:
120
+ print("Package not found on PyPI (first deployment). Proceeding.")
121
+ with open(os.environ['GITHUB_OUTPUT'], 'a') as fh:
122
+ print("is_new_version=true", file=fh)
123
+ else:
124
+ print(f"Error checking PyPI: {e}")
125
+ sys.exit(1)
126
+
127
+ except Exception as e:
128
+ print(f"Error: {e}")
129
+ sys.exit(1)
130
+
131
+ build:
132
+ needs: check-version
133
+ if: needs.check-version.outputs.is_new_version == 'true'
134
+ name: Build distribution
135
+ runs-on: ubuntu-latest
136
+
137
+ steps:
138
+ - uses: actions/checkout@v4
139
+
140
+ - name: Set up Python
141
+ uses: actions/setup-python@v5
142
+ with:
143
+ python-version: "3.11"
144
+
145
+ - name: Install build dependencies
146
+ run: |
147
+ python -m pip install --upgrade pip
148
+ pip install build
149
+
150
+ - name: Build a binary wheel and a source tarball
151
+ run: python -m build
152
+
153
+ - name: Store the distribution packages
154
+ uses: actions/upload-artifact@v4
155
+ with:
156
+ name: python-package-distributions
157
+ path: dist/
158
+
159
+ publish-to-pypi:
160
+ name: Publish to PyPI
161
+ needs: build
162
+ runs-on: ubuntu-latest
163
+ permissions:
164
+ id-token: write
165
+
166
+ steps:
167
+ - name: Download all the dists
168
+ uses: actions/download-artifact@v4
169
+ with:
170
+ name: python-package-distributions
171
+ path: dist/
172
+
173
+ - name: Publish distribution to PyPI
174
+ uses: pypa/gh-action-pypi-publish@release/v1
175
+ with:
176
+ password: ${{ secrets.PYPI_API_TOKEN }}
177
+ skip-existing: true
178
+ verbose: true
179
+
180
+ create-release:
181
+ name: Create GitHub Release
182
+ needs: [publish-to-pypi, check-version]
183
+ runs-on: ubuntu-latest
184
+ permissions:
185
+ contents: write
186
+ steps:
187
+ - uses: actions/checkout@v4
188
+
189
+ - name: Create Release
190
+ uses: softprops/action-gh-release@v2
191
+ with:
192
+ tag_name: v${{ needs.check-version.outputs.version }}
193
+ name: v${{ needs.check-version.outputs.version }}
194
+ generate_release_notes: true
195
+ draft: false
196
+ prerelease: false
@@ -0,0 +1,106 @@
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+
6
+ # C extensions
7
+ *.so
8
+
9
+ # Distribution / packaging
10
+ .Python
11
+ build/
12
+ develop-eggs/
13
+ dist/
14
+ downloads/
15
+ eggs/
16
+ .eggs/
17
+ lib/
18
+ lib64/
19
+ parts/
20
+ sdist/
21
+ var/
22
+ wheels/
23
+ *.egg-info/
24
+ *.egg
25
+ MANIFEST
26
+
27
+ # PyInstaller
28
+ *.manifest
29
+ *.spec
30
+
31
+ # Installer logs
32
+ pip-log.txt
33
+ pip-delete-this-directory.txt
34
+
35
+ # Unit test / coverage reports
36
+ htmlcov/
37
+ .tox/
38
+ .nox/
39
+ .coverage
40
+ .coverage.*
41
+ .cache
42
+ nosetests.xml
43
+ coverage.xml
44
+ *.cover
45
+ *.py,cover
46
+ .hypothesis/
47
+ .pytest_cache/
48
+
49
+ # Translations
50
+ *.mo
51
+ *.pot
52
+
53
+ # Environments
54
+ .env
55
+ .venv
56
+ env/
57
+ venv/
58
+ ENV/
59
+ env.bak/
60
+ venv.bak/
61
+
62
+ # IDEs and editors
63
+ .idea/
64
+ .vscode/
65
+ *.swp
66
+ *.swo
67
+ *~
68
+ .project
69
+ .pydevproject
70
+ .settings/
71
+ *.sublime-project
72
+ *.sublime-workspace
73
+
74
+ # Jupyter Notebook
75
+ .ipynb_checkpoints
76
+
77
+ # pyenv
78
+ .python-version
79
+
80
+ # mypy
81
+ .mypy_cache/
82
+ .dmypy.json
83
+ dmypy.json
84
+
85
+ # Pyre
86
+ .pyre/
87
+
88
+ # Logs
89
+ *.log
90
+ logs/
91
+
92
+ # Local development
93
+ .DS_Store
94
+ Thumbs.db
95
+
96
+ # Temporary files
97
+ tmp/
98
+ temp/
99
+ *.tmp
100
+ *.bak
101
+
102
+ # Secrets (never commit these)
103
+ *.pem
104
+ *.key
105
+ secrets.json
106
+ credentials.json
@@ -0,0 +1,216 @@
1
+ # Contributing to runapi
2
+
3
+ Thank you for your interest in contributing to **runapi** 🚀
4
+ Every contribution matters — whether it’s code, documentation, tests, or ideas.
5
+
6
+ This guide explains **how to contribute**, **what to work on**, and **what is expected**.
7
+
8
+ ---
9
+
10
+ ## 🧠 About runapi
11
+
12
+ **runapi** is an opinionated framework built on top of **FastAPI**, focused on:
13
+
14
+ * File-based routing
15
+ * Improved developer experience
16
+ * Production-ready defaults
17
+
18
+ The project is still evolving, and contributions are welcome at all levels.
19
+
20
+ ---
21
+
22
+ ## 📋 Ways to Contribute
23
+
24
+ You can contribute by:
25
+
26
+ * Fixing bugs
27
+ * Improving documentation
28
+ * Adding examples
29
+ * Writing tests
30
+ * Improving developer experience
31
+ * Suggesting features
32
+
33
+ If you’re new to open source, look for issues labeled **`good first issue`**.
34
+
35
+ ---
36
+
37
+ ## 🟢 Getting Started
38
+
39
+ ### 1️⃣ Fork the Repository
40
+
41
+ Click **Fork** on GitHub and clone your fork:
42
+
43
+ ```bash
44
+ git clone https://github.com/Amanbig/runapi.git
45
+ cd runapi
46
+ ```
47
+
48
+ ---
49
+
50
+ ### 2️⃣ Create a Virtual Environment
51
+
52
+ ```bash
53
+ python -m venv venv
54
+ source venv/bin/activate # Linux / macOS
55
+ venv\Scripts\activate # Windows
56
+ ```
57
+
58
+ ---
59
+
60
+ ### 3️⃣ Install Dependencies
61
+
62
+ ```bash
63
+ pip install -r requirements.txt
64
+ ```
65
+
66
+ > **Python 3.9+ is required**
67
+
68
+ ---
69
+
70
+ ## ▶️ Running the Project Locally
71
+
72
+ If the project includes examples:
73
+
74
+ ```bash
75
+ cd examples
76
+ python main.py
77
+ ```
78
+
79
+ If not, refer to the README for current usage instructions.
80
+
81
+ ---
82
+
83
+ ## 🧩 Choosing an Issue
84
+
85
+ 1. Browse open issues
86
+ 2. Look for labels:
87
+
88
+ * `good first issue`
89
+ * `help wanted`
90
+ 3. Comment on the issue to let others know you’re working on it
91
+
92
+ Please wait for maintainer confirmation before starting work.
93
+
94
+ ---
95
+
96
+ ## 🌱 Branching Strategy
97
+
98
+ Create a new branch for your work:
99
+
100
+ ```bash
101
+ git checkout -b feature/short-description
102
+ ```
103
+
104
+ Examples:
105
+
106
+ * `fix/missing-route-error`
107
+ * `docs/file-based-routing`
108
+ * `test/router-discovery`
109
+
110
+ ---
111
+
112
+ ## 🛠️ Making Changes
113
+
114
+ * Keep changes **small and focused**
115
+ * Follow existing project structure
116
+ * Add tests when fixing bugs or adding features
117
+ * Update documentation when behavior changes
118
+
119
+ ---
120
+
121
+ ## 🧪 Running Tests
122
+
123
+ If tests are present:
124
+
125
+ ```bash
126
+ pytest
127
+ ```
128
+
129
+ Make sure all tests pass before opening a PR.
130
+
131
+ ---
132
+
133
+ ## ✍️ Commit Message Guidelines
134
+
135
+ Use clear and descriptive commit messages:
136
+
137
+ ```
138
+ type: short description
139
+ ```
140
+
141
+ Examples:
142
+
143
+ * `fix: improve error message for missing routes`
144
+ * `docs: add file-based routing explanation`
145
+ * `test: add router discovery tests`
146
+
147
+ ---
148
+
149
+ ## 🔁 Submitting a Pull Request
150
+
151
+ 1. Push your branch to your fork
152
+ 2. Open a Pull Request to the **main** branch
153
+ 3. Reference the related issue:
154
+
155
+ ```
156
+ Closes #12
157
+ ```
158
+ 4. Clearly explain:
159
+
160
+ * What was changed
161
+ * Why it was changed
162
+
163
+ Small, focused PRs are preferred over large ones.
164
+
165
+ ---
166
+
167
+ ## 🔍 Pull Request Checklist
168
+
169
+ Before submitting, make sure:
170
+
171
+ * [ ] Code follows project style
172
+ * [ ] Tests pass
173
+ * [ ] Documentation updated (if needed)
174
+ * [ ] PR references an issue
175
+
176
+ ---
177
+
178
+ ## 📐 Code Style Guidelines
179
+
180
+ * Prefer readability over cleverness
181
+ * Use meaningful variable names
182
+ * Keep functions small and focused
183
+ * Avoid unnecessary complexity
184
+
185
+ ---
186
+
187
+ ## 📄 Documentation Guidelines
188
+
189
+ * Keep explanations concise
190
+ * Use examples where possible
191
+ * Assume the reader is new to the project
192
+
193
+ ---
194
+
195
+ ## 🤝 Code of Conduct
196
+
197
+ Please be respectful and inclusive.
198
+ Harassment, discrimination, or abusive behavior will not be tolerated.
199
+
200
+ ---
201
+
202
+ ## ❓ Need Help?
203
+
204
+ If you’re stuck or unsure:
205
+
206
+ * Ask questions in the related issue
207
+ * Provide logs, errors, or screenshots if relevant
208
+
209
+ Maintainers are happy to help 🙂
210
+
211
+ ---
212
+
213
+ ## ❤️ Thank You
214
+
215
+ Your time and effort make **runapi** better for everyone.
216
+ Thanks for contributing!
@@ -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__