Skip to content

Commit 0b71524

Browse files
committed
Changed git actions, fixed examples in docs
1 parent 548121d commit 0b71524

File tree

15 files changed

+494
-63
lines changed

15 files changed

+494
-63
lines changed

.github/CONTRIBUTING.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ This guide explains how to get started, make contributions, write commits, open
1010
Install dependencies with:
1111

1212
```bash
13+
# Fork the repo on GitHub first, then:
1314
git clone https://github.com/yourusername/fastopenapi.git
1415
cd fastopenapi
1516
poetry install

.github/workflows/master-deploy.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,32 @@ on:
66
- 'v*'
77

88
jobs:
9+
coverage:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v3
13+
with:
14+
fetch-depth: 0
15+
16+
- name: Setup environment (coverage)
17+
uses: ./.github/actions/setup-env
18+
with:
19+
python-version: "3.10"
20+
install-flags: "--all-extras"
21+
22+
- name: Run tests with coverage
23+
run: |
24+
poetry run coverage run -m pytest
25+
poetry run coverage report
26+
poetry run coverage xml
27+
28+
- name: Upload coverage to Codecov
29+
env:
30+
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
31+
run: bash <(curl -s https://codecov.io/bash) -t $CODECOV_TOKEN -f coverage.xml
32+
933
deploy-prod:
34+
needs: coverage
1035
runs-on: ubuntu-latest
1136
env:
1237
POETRY_PYPI_TOKEN_PYPI: ${{ secrets.PYPI_API_TOKEN }}

.github/workflows/master.yml

Lines changed: 4 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ on:
44
push:
55
branches:
66
- master
7+
paths-ignore:
8+
- 'benchmarks/**'
9+
- 'docs/**'
10+
- 'examples/**'
711

812
jobs:
913
lint:
@@ -38,28 +42,3 @@ jobs:
3842

3943
- name: Run tests
4044
run: poetry run pytest
41-
42-
coverage:
43-
needs: test
44-
runs-on: ubuntu-latest
45-
steps:
46-
- uses: actions/checkout@v3
47-
with:
48-
fetch-depth: 0
49-
50-
- name: Setup environment (coverage)
51-
uses: ./.github/actions/setup-env
52-
with:
53-
python-version: "3.10"
54-
install-flags: "--all-extras"
55-
56-
- name: Run tests with coverage
57-
run: |
58-
poetry run coverage run -m pytest
59-
poetry run coverage report
60-
poetry run coverage xml
61-
62-
- name: Upload coverage to Codecov
63-
env:
64-
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
65-
run: bash <(curl -s https://codecov.io/bash) -t $CODECOV_TOKEN -f coverage.xml

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,7 @@ http://127.0.0.1:8000/redoc
306306

307307
## 📖 Documentation
308308

309-
Explore the [Docs](https://github.com/mr-fatalyst/fastopenapi/blob/master/docs/en/index.md) for an overview of FastOpenAPI, its core components, and usage guidelines. The documentation is continuously updated and improved.
309+
Explore the [Docs](https://fastopenapi.fatalyst.dev/) for an overview of FastOpenAPI, its core components, and usage guidelines. The documentation is continuously updated and improved.
310310

311311
---
312312

docs/de/docs/advanced/api_reference.md

Lines changed: 113 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -48,13 +48,119 @@ fastopenapi/
4848

4949
Jedes unterstützte Framework hat einen eigenen Router, der von `BaseRouter` erbt:
5050

51-
- **AioHttpRouter**
52-
- **FalconRouter**
53-
- **FlaskRouter**
54-
- **QuartRouter**
55-
- **SanicRouter**
56-
- **StarletteRouter**
57-
- **TornadoRouter**
51+
### AioHttpRouter
52+
53+
```python
54+
from aiohttp import web
55+
from fastopenapi.routers import AioHttpRouter
56+
57+
app = web.Application()
58+
router = AioHttpRouter(app=app)
59+
60+
@router.get("/status")
61+
async def status():
62+
return {"status": "ok"}
63+
```
64+
65+
---
66+
67+
### FalconRouter
68+
69+
```python
70+
import falcon.asgi
71+
from fastopenapi.routers import FalconRouter
72+
73+
app = falcon.asgi.App()
74+
router = FalconRouter(app=app)
75+
76+
@router.get("/status")
77+
async def status():
78+
return {"status": "ok"}
79+
```
80+
81+
---
82+
83+
### FlaskRouter
84+
85+
```python
86+
from flask import Flask
87+
from fastopenapi.routers import FlaskRouter
88+
89+
app = Flask(__name__)
90+
router = FlaskRouter(app=app)
91+
92+
@router.get("/hello")
93+
def hello(name: str):
94+
return {"message": f"Hello {name}"}
95+
```
96+
97+
---
98+
99+
### QuartRouter
100+
101+
```python
102+
from quart import Quart
103+
from fastopenapi.routers import QuartRouter
104+
105+
app = Quart(__name__)
106+
router = QuartRouter(app=app)
107+
108+
@router.get("/ping")
109+
async def ping():
110+
return {"pong": True}
111+
```
112+
113+
---
114+
115+
### SanicRouter
116+
117+
```python
118+
from sanic import Sanic
119+
from fastopenapi.routers import SanicRouter
120+
121+
app = Sanic("MySanicApp")
122+
router = SanicRouter(app=app)
123+
124+
@router.get("/info")
125+
async def info():
126+
return {"framework": "Sanic", "status": "running"}
127+
```
128+
129+
---
130+
131+
### StarletteRouter
132+
133+
Use for Starlette integration.
134+
135+
```python
136+
from starlette.applications import Starlette
137+
from fastopenapi.routers import StarletteRouter
138+
139+
app = Starlette()
140+
router = StarletteRouter(app=app)
141+
142+
@router.get("/check")
143+
async def check():
144+
return {"status": "healthy"}
145+
```
146+
147+
---
148+
149+
### TornadoRouter
150+
151+
Use for Tornado integration.
152+
153+
```python
154+
from tornado.web import Application
155+
from fastopenapi.routers import TornadoRouter
156+
157+
app = Application()
158+
router = TornadoRouter(app=app)
159+
160+
@router.get("/status")
161+
def status():
162+
return {"running": True}
163+
```
58164

59165
---
60166

docs/de/docs/contributing.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ Dieses Dokument erklärt, wie du loslegen kannst, Beiträge leistest, Commits er
1010
Installiere Abhängigkeiten mit:
1111

1212
```bash
13+
# Fork the repo on GitHub first, then:
1314
git clone https://github.com/yourusername/fastopenapi.git
1415
cd fastopenapi
1516
poetry install

docs/en/docs/contributing.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ This guide explains how to get started, make contributions, write commits, open
1010
Install dependencies with:
1111

1212
```bash
13+
# Fork the repo on GitHub first, then:
1314
git clone https://github.com/yourusername/fastopenapi.git
1415
cd fastopenapi
1516
poetry install
@@ -48,6 +49,7 @@ Tests cover both internal logic and integration with aiohttp, flask, sanic, and
4849
## Code Style
4950

5051
This project uses:
52+
5153
- `black` — code formatting
5254
- `flake8` — linting
5355
- `isort` — import sorting

docs/es/docs/advanced/api_reference.md

Lines changed: 114 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -48,17 +48,122 @@ fastopenapi/
4848

4949
## Routers por framework
5050

51-
FastOpenAPI ofrece una clase de router por framework:
51+
FastOpenAPI ofrece una clase de router por framework.
52+
Cada uno extiende `BaseRouter` y adapta las rutas a las interfaces específicas del framework.
5253

53-
- `AioHttpRouter`
54-
- `FalconRouter`
55-
- `FlaskRouter`
56-
- `QuartRouter`
57-
- `SanicRouter`
58-
- `StarletteRouter`
59-
- `TornadoRouter`
54+
### AioHttpRouter
6055

61-
Cada uno extiende `BaseRouter` y adapta las rutas a las interfaces específicas del framework.
56+
```python
57+
from aiohttp import web
58+
from fastopenapi.routers import AioHttpRouter
59+
60+
app = web.Application()
61+
router = AioHttpRouter(app=app)
62+
63+
@router.get("/status")
64+
async def status():
65+
return {"status": "ok"}
66+
```
67+
68+
---
69+
70+
### FalconRouter
71+
72+
```python
73+
import falcon.asgi
74+
from fastopenapi.routers import FalconRouter
75+
76+
app = falcon.asgi.App()
77+
router = FalconRouter(app=app)
78+
79+
@router.get("/status")
80+
async def status():
81+
return {"status": "ok"}
82+
```
83+
84+
---
85+
86+
### FlaskRouter
87+
88+
```python
89+
from flask import Flask
90+
from fastopenapi.routers import FlaskRouter
91+
92+
app = Flask(__name__)
93+
router = FlaskRouter(app=app)
94+
95+
@router.get("/hello")
96+
def hello(name: str):
97+
return {"message": f"Hello {name}"}
98+
```
99+
100+
---
101+
102+
### QuartRouter
103+
104+
```python
105+
from quart import Quart
106+
from fastopenapi.routers import QuartRouter
107+
108+
app = Quart(__name__)
109+
router = QuartRouter(app=app)
110+
111+
@router.get("/ping")
112+
async def ping():
113+
return {"pong": True}
114+
```
115+
116+
---
117+
118+
### SanicRouter
119+
120+
```python
121+
from sanic import Sanic
122+
from fastopenapi.routers import SanicRouter
123+
124+
app = Sanic("MySanicApp")
125+
router = SanicRouter(app=app)
126+
127+
@router.get("/info")
128+
async def info():
129+
return {"framework": "Sanic", "status": "running"}
130+
```
131+
132+
---
133+
134+
### StarletteRouter
135+
136+
Use for Starlette integration.
137+
138+
```python
139+
from starlette.applications import Starlette
140+
from fastopenapi.routers import StarletteRouter
141+
142+
app = Starlette()
143+
router = StarletteRouter(app=app)
144+
145+
@router.get("/check")
146+
async def check():
147+
return {"status": "healthy"}
148+
```
149+
150+
---
151+
152+
### TornadoRouter
153+
154+
Use for Tornado integration.
155+
156+
```python
157+
from tornado.web import Application
158+
from fastopenapi.routers import TornadoRouter
159+
160+
app = Application()
161+
router = TornadoRouter(app=app)
162+
163+
@router.get("/status")
164+
def status():
165+
return {"running": True}
166+
```
62167

63168
---
64169

docs/es/docs/contributing.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ Esta guía explica cómo comenzar, realizar aportes, escribir commits, abrir pul
1010
Instala las dependencias con:
1111

1212
```bash
13+
# Fork the repo on GitHub first, then:
1314
git clone https://github.com/yourusername/fastopenapi.git
1415
cd fastopenapi
1516
poetry install

0 commit comments

Comments
 (0)