lightapi 0.1.4__tar.gz → 0.1.5__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.
- {lightapi-0.1.4 → lightapi-0.1.5}/PKG-INFO +3 -7
- {lightapi-0.1.4 → lightapi-0.1.5}/README.md +2 -6
- {lightapi-0.1.4 → lightapi-0.1.5}/docs/api-reference/core.md +2 -12
- {lightapi-0.1.4 → lightapi-0.1.5}/docs/api-reference/rest.md +4 -2
- {lightapi-0.1.4 → lightapi-0.1.5}/docs/getting-started/quickstart.md +1 -3
- {lightapi-0.1.4 → lightapi-0.1.5}/docs/index.md +2 -0
- {lightapi-0.1.4 → lightapi-0.1.5}/docs/technical-reference/core-api.md +1 -1
- {lightapi-0.1.4 → lightapi-0.1.5}/lightapi/lightapi.py +1 -0
- {lightapi-0.1.4 → lightapi-0.1.5}/pyproject.toml +1 -1
- {lightapi-0.1.4 → lightapi-0.1.5}/run_server.py +1 -3
- {lightapi-0.1.4 → lightapi-0.1.5}/.github/workflows/pages-publish.yml +0 -0
- {lightapi-0.1.4 → lightapi-0.1.5}/.github/workflows/python-publish.yml +0 -0
- {lightapi-0.1.4 → lightapi-0.1.5}/.github/workflows/test-dev.yml +0 -0
- {lightapi-0.1.4 → lightapi-0.1.5}/.gitignore +0 -0
- {lightapi-0.1.4 → lightapi-0.1.5}/LICENSE +0 -0
- {lightapi-0.1.4 → lightapi-0.1.5}/docs/.pages +0 -0
- {lightapi-0.1.4 → lightapi-0.1.5}/docs/advanced/.pages +0 -0
- {lightapi-0.1.4 → lightapi-0.1.5}/docs/advanced/authentication.md +0 -0
- {lightapi-0.1.4 → lightapi-0.1.5}/docs/advanced/caching.md +0 -0
- {lightapi-0.1.4 → lightapi-0.1.5}/docs/advanced/filtering.md +0 -0
- {lightapi-0.1.4 → lightapi-0.1.5}/docs/advanced/middleware.md +0 -0
- {lightapi-0.1.4 → lightapi-0.1.5}/docs/advanced/pagination.md +0 -0
- {lightapi-0.1.4 → lightapi-0.1.5}/docs/advanced/validation.md +0 -0
- {lightapi-0.1.4 → lightapi-0.1.5}/docs/api-reference/.pages +0 -0
- {lightapi-0.1.4 → lightapi-0.1.5}/docs/api-reference/auth.md +0 -0
- {lightapi-0.1.4 → lightapi-0.1.5}/docs/api-reference/cache.md +0 -0
- {lightapi-0.1.4 → lightapi-0.1.5}/docs/api-reference/database.md +0 -0
- {lightapi-0.1.4 → lightapi-0.1.5}/docs/api-reference/exceptions.md +0 -0
- {lightapi-0.1.4 → lightapi-0.1.5}/docs/api-reference/filters.md +0 -0
- {lightapi-0.1.4 → lightapi-0.1.5}/docs/api-reference/index.md +0 -0
- {lightapi-0.1.4 → lightapi-0.1.5}/docs/api-reference/models.md +0 -0
- {lightapi-0.1.4 → lightapi-0.1.5}/docs/api-reference/pagination.md +0 -0
- {lightapi-0.1.4 → lightapi-0.1.5}/docs/api-reference/swagger.md +0 -0
- {lightapi-0.1.4 → lightapi-0.1.5}/docs/api-reference/validation.md +0 -0
- {lightapi-0.1.4 → lightapi-0.1.5}/docs/deployment/.pages +0 -0
- {lightapi-0.1.4 → lightapi-0.1.5}/docs/deployment/docker.md +0 -0
- {lightapi-0.1.4 → lightapi-0.1.5}/docs/deployment/production.md +0 -0
- {lightapi-0.1.4 → lightapi-0.1.5}/docs/deployment/security.md +0 -0
- {lightapi-0.1.4 → lightapi-0.1.5}/docs/examples/.pages +0 -0
- {lightapi-0.1.4 → lightapi-0.1.5}/docs/examples/auth.md +0 -0
- {lightapi-0.1.4 → lightapi-0.1.5}/docs/examples/basic-crud.md +0 -0
- {lightapi-0.1.4 → lightapi-0.1.5}/docs/examples/basic-rest.md +0 -0
- {lightapi-0.1.4 → lightapi-0.1.5}/docs/examples/caching.md +0 -0
- {lightapi-0.1.4 → lightapi-0.1.5}/docs/examples/custom-application.md +0 -0
- {lightapi-0.1.4 → lightapi-0.1.5}/docs/examples/filtering-pagination.md +0 -0
- {lightapi-0.1.4 → lightapi-0.1.5}/docs/examples/middleware.md +0 -0
- {lightapi-0.1.4 → lightapi-0.1.5}/docs/examples/validation.md +0 -0
- {lightapi-0.1.4 → lightapi-0.1.5}/docs/getting-started/.pages +0 -0
- {lightapi-0.1.4 → lightapi-0.1.5}/docs/getting-started/configuration.md +0 -0
- {lightapi-0.1.4 → lightapi-0.1.5}/docs/getting-started/first-steps.md +0 -0
- {lightapi-0.1.4 → lightapi-0.1.5}/docs/getting-started/installation.md +0 -0
- {lightapi-0.1.4 → lightapi-0.1.5}/docs/getting-started/introduction.md +0 -0
- {lightapi-0.1.4 → lightapi-0.1.5}/docs/technical-reference/.pages +0 -0
- {lightapi-0.1.4 → lightapi-0.1.5}/docs/technical-reference/cache.md +0 -0
- {lightapi-0.1.4 → lightapi-0.1.5}/docs/technical-reference/endpoints.md +0 -0
- {lightapi-0.1.4 → lightapi-0.1.5}/docs/technical-reference/handlers.md +0 -0
- {lightapi-0.1.4 → lightapi-0.1.5}/docs/technical-reference/middleware.md +0 -0
- {lightapi-0.1.4 → lightapi-0.1.5}/docs/technical-reference/models.md +0 -0
- {lightapi-0.1.4 → lightapi-0.1.5}/docs/troubleshooting.md +0 -0
- {lightapi-0.1.4 → lightapi-0.1.5}/docs/tutorial/.pages +0 -0
- {lightapi-0.1.4 → lightapi-0.1.5}/docs/tutorial/basic-api.md +0 -0
- {lightapi-0.1.4 → lightapi-0.1.5}/docs/tutorial/database.md +0 -0
- {lightapi-0.1.4 → lightapi-0.1.5}/docs/tutorial/endpoints.md +0 -0
- {lightapi-0.1.4 → lightapi-0.1.5}/docs/tutorial/requests.md +0 -0
- {lightapi-0.1.4 → lightapi-0.1.5}/docs/tutorial/responses.md +0 -0
- {lightapi-0.1.4 → lightapi-0.1.5}/examples/README.md +0 -0
- {lightapi-0.1.4 → lightapi-0.1.5}/examples/__init__.py +0 -0
- {lightapi-0.1.4 → lightapi-0.1.5}/examples/auth_example.py +0 -0
- {lightapi-0.1.4 → lightapi-0.1.5}/examples/basic_rest_api.py +0 -0
- {lightapi-0.1.4 → lightapi-0.1.5}/examples/caching_example.py +0 -0
- {lightapi-0.1.4 → lightapi-0.1.5}/examples/custom_snippet.py +0 -0
- {lightapi-0.1.4 → lightapi-0.1.5}/examples/example.py +0 -0
- {lightapi-0.1.4 → lightapi-0.1.5}/examples/filtering_pagination_example.py +0 -0
- {lightapi-0.1.4 → lightapi-0.1.5}/examples/middleware_example.py +0 -0
- {lightapi-0.1.4 → lightapi-0.1.5}/examples/relationships_example.py +0 -0
- {lightapi-0.1.4 → lightapi-0.1.5}/examples/swagger_example.py +0 -0
- {lightapi-0.1.4 → lightapi-0.1.5}/examples/user_goal_example.py +0 -0
- {lightapi-0.1.4 → lightapi-0.1.5}/examples/validation_example.py +0 -0
- {lightapi-0.1.4 → lightapi-0.1.5}/lightapi/__init__.py +0 -0
- {lightapi-0.1.4 → lightapi-0.1.5}/lightapi/auth.py +0 -0
- {lightapi-0.1.4 → lightapi-0.1.5}/lightapi/base_endpoint.py +0 -0
- {lightapi-0.1.4 → lightapi-0.1.5}/lightapi/cache.py +0 -0
- {lightapi-0.1.4 → lightapi-0.1.5}/lightapi/config.py +0 -0
- {lightapi-0.1.4 → lightapi-0.1.5}/lightapi/core.py +0 -0
- {lightapi-0.1.4 → lightapi-0.1.5}/lightapi/database.py +0 -0
- {lightapi-0.1.4 → lightapi-0.1.5}/lightapi/exceptions.py +0 -0
- {lightapi-0.1.4 → lightapi-0.1.5}/lightapi/filters.py +0 -0
- {lightapi-0.1.4 → lightapi-0.1.5}/lightapi/handlers.py +0 -0
- {lightapi-0.1.4 → lightapi-0.1.5}/lightapi/models.py +0 -0
- {lightapi-0.1.4 → lightapi-0.1.5}/lightapi/pagination.py +0 -0
- {lightapi-0.1.4 → lightapi-0.1.5}/lightapi/rest.py +0 -0
- {lightapi-0.1.4 → lightapi-0.1.5}/lightapi/swagger.py +0 -0
- {lightapi-0.1.4 → lightapi-0.1.5}/mkdocs.yml +0 -0
- {lightapi-0.1.4 → lightapi-0.1.5}/pytest.ini +0 -0
- {lightapi-0.1.4 → lightapi-0.1.5}/requirements.txt +0 -0
- {lightapi-0.1.4 → lightapi-0.1.5}/tests/__init__.py +0 -0
- {lightapi-0.1.4 → lightapi-0.1.5}/tests/conftest.py +0 -0
- {lightapi-0.1.4 → lightapi-0.1.5}/tests/test_additional_features.py +0 -0
- {lightapi-0.1.4 → lightapi-0.1.5}/tests/test_auth.py +0 -0
- {lightapi-0.1.4 → lightapi-0.1.5}/tests/test_auth_example.py +0 -0
- {lightapi-0.1.4 → lightapi-0.1.5}/tests/test_basic_rest_api.py +0 -0
- {lightapi-0.1.4 → lightapi-0.1.5}/tests/test_cache.py +0 -0
- {lightapi-0.1.4 → lightapi-0.1.5}/tests/test_caching_example.py +0 -0
- {lightapi-0.1.4 → lightapi-0.1.5}/tests/test_clients.py +0 -0
- {lightapi-0.1.4 → lightapi-0.1.5}/tests/test_core.py +0 -0
- {lightapi-0.1.4 → lightapi-0.1.5}/tests/test_custom_snippet.py +0 -0
- {lightapi-0.1.4 → lightapi-0.1.5}/tests/test_example.py +0 -0
- {lightapi-0.1.4 → lightapi-0.1.5}/tests/test_filtering_pagination_example.py +0 -0
- {lightapi-0.1.4 → lightapi-0.1.5}/tests/test_filters.py +0 -0
- {lightapi-0.1.4 → lightapi-0.1.5}/tests/test_from_config.py +0 -0
- {lightapi-0.1.4 → lightapi-0.1.5}/tests/test_helpers.py +0 -0
- {lightapi-0.1.4 → lightapi-0.1.5}/tests/test_integration.py +0 -0
- {lightapi-0.1.4 → lightapi-0.1.5}/tests/test_middleware.py +0 -0
- {lightapi-0.1.4 → lightapi-0.1.5}/tests/test_middleware_example.py +0 -0
- {lightapi-0.1.4 → lightapi-0.1.5}/tests/test_pagination.py +0 -0
- {lightapi-0.1.4 → lightapi-0.1.5}/tests/test_rest.py +0 -0
- {lightapi-0.1.4 → lightapi-0.1.5}/tests/test_swagger.py +0 -0
- {lightapi-0.1.4 → lightapi-0.1.5}/tests/test_validation_example.py +0 -0
- {lightapi-0.1.4 → lightapi-0.1.5}/update_version.py +0 -0
- {lightapi-0.1.4 → lightapi-0.1.5}/uv.lock +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: lightapi
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.5
|
|
4
4
|
Summary: A lightweight framework for building API endpoints using Python's native libraries.
|
|
5
5
|
Project-URL: Repository, https://github.com/henriqueblobato/LightApi
|
|
6
6
|
Project-URL: Issues, https://github.com/henriqueblobato/LightApi/issues
|
|
@@ -145,12 +145,8 @@ sqlite3 mydata.db "CREATE TABLE users (id INTEGER PRIMARY KEY AUTOINCREMENT, nam
|
|
|
145
145
|
#### 3. Start the API
|
|
146
146
|
```python
|
|
147
147
|
from lightapi import LightApi
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
api = LightApi.from_config('my_api_config.yaml')
|
|
151
|
-
app = api.app
|
|
152
|
-
|
|
153
|
-
aiohttp.web.run_app(app, port=8080)
|
|
148
|
+
api = LightApi.from_config('config.yaml')
|
|
149
|
+
api.run(host="0.0.0.0", port=8081)
|
|
154
150
|
```
|
|
155
151
|
|
|
156
152
|
#### 4. Use the API (with curl)
|
|
@@ -93,12 +93,8 @@ sqlite3 mydata.db "CREATE TABLE users (id INTEGER PRIMARY KEY AUTOINCREMENT, nam
|
|
|
93
93
|
#### 3. Start the API
|
|
94
94
|
```python
|
|
95
95
|
from lightapi import LightApi
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
api = LightApi.from_config('my_api_config.yaml')
|
|
99
|
-
app = api.app
|
|
100
|
-
|
|
101
|
-
aiohttp.web.run_app(app, port=8080)
|
|
96
|
+
api = LightApi.from_config('config.yaml')
|
|
97
|
+
api.run(host="0.0.0.0", port=8081)
|
|
102
98
|
```
|
|
103
99
|
|
|
104
100
|
#### 4. Use the API (with curl)
|
|
@@ -83,24 +83,14 @@ app.add_middleware([
|
|
|
83
83
|
**Parameters:**
|
|
84
84
|
- `middleware_classes` (List[Type[Middleware]]): List of middleware classes to add
|
|
85
85
|
|
|
86
|
-
#### run()
|
|
86
|
+
#### run(host: str = "0.0.0.0", port: int = 8000, debug: bool = False) -> None
|
|
87
87
|
|
|
88
|
-
Starts the
|
|
89
|
-
|
|
90
|
-
```python
|
|
91
|
-
app.run(
|
|
92
|
-
host="0.0.0.0",
|
|
93
|
-
port=8000,
|
|
94
|
-
debug=True,
|
|
95
|
-
reload=True
|
|
96
|
-
)
|
|
97
|
-
```
|
|
88
|
+
Starts the server. This is the only supported way to start the application. Do not use external libraries to start the server directly.
|
|
98
89
|
|
|
99
90
|
**Parameters:**
|
|
100
91
|
- `host` (str): Server host address
|
|
101
92
|
- `port` (int): Server port number
|
|
102
93
|
- `debug` (bool): Enable debug mode
|
|
103
|
-
- `reload` (bool): Enable auto-reload on code changes
|
|
104
94
|
|
|
105
95
|
### Advanced Configuration
|
|
106
96
|
|
|
@@ -747,8 +747,10 @@ class User(RestEndpoint):
|
|
|
747
747
|
- [Core API](core.md) - Core framework functionality
|
|
748
748
|
- [Models](models.md) - Data models and schemas
|
|
749
749
|
- [Filtering](filters.md) - Advanced filtering options
|
|
750
|
-
- [Pagination](pagination.md) - Pagination configuration
|
|
750
|
+
- [Pagination](pagination.md) - Pagination configuration
|
|
751
751
|
|
|
752
752
|
- Only GET, POST, PUT, PATCH, DELETE HTTP verbs are supported. OPTIONS and HEAD are not available.
|
|
753
753
|
- All required fields must be defined as NOT NULL in your database schema for correct enforcement.
|
|
754
|
-
- The API will return 409 Conflict if you attempt to create or update a record missing a NOT NULL field, or violating a UNIQUE or FOREIGN KEY constraint.
|
|
754
|
+
- The API will return 409 Conflict if you attempt to create or update a record missing a NOT NULL field, or violating a UNIQUE or FOREIGN KEY constraint.
|
|
755
|
+
|
|
756
|
+
To start your API, always use `api.run(host, port)`. Do not use external libraries or 'app = api.app' to start the server directly.
|
|
@@ -70,10 +70,8 @@ sqlite3 mydata.db "CREATE TABLE users (id INTEGER PRIMARY KEY AUTOINCREMENT, nam
|
|
|
70
70
|
**3. Start the API:**
|
|
71
71
|
```python
|
|
72
72
|
from lightapi import LightApi
|
|
73
|
-
import aiohttp.web
|
|
74
73
|
api = LightApi.from_config('my_api_config.yaml')
|
|
75
|
-
|
|
76
|
-
aiohttp.web.run_app(app, port=8080)
|
|
74
|
+
api.run(host="0.0.0.0", port=8080)
|
|
77
75
|
```
|
|
78
76
|
|
|
79
77
|
**4. Use the API (with curl):**
|
|
@@ -158,3 +158,5 @@ LightAPI is released under the [MIT License](https://github.com/henriqueblobato/
|
|
|
158
158
|
|
|
159
159
|
> **Note:** Only GET, POST, PUT, PATCH, DELETE HTTP verbs are supported. OPTIONS and HEAD are not available. Required fields must be NOT NULL in the schema. Constraint violations (NOT NULL, UNIQUE, FK) return 409.
|
|
160
160
|
|
|
161
|
+
> To start your API, always use `api.run(host, port)`. Do not use external libraries or 'app = api.app' to start the server directly.
|
|
162
|
+
|
|
@@ -50,7 +50,7 @@ Adds application-wide middleware.
|
|
|
50
50
|
|
|
51
51
|
#### run(host: str = "0.0.0.0", port: int = 8000, debug: bool = False) -> None
|
|
52
52
|
|
|
53
|
-
Starts the
|
|
53
|
+
Starts the server. This is the only supported way to start the application. Do not use external libraries to start the server directly.
|
|
54
54
|
|
|
55
55
|
- **Parameters:**
|
|
56
56
|
- `host`: Host address to bind (default: `"0.0.0.0"`).
|
|
@@ -119,6 +119,7 @@ class LightApi:
|
|
|
119
119
|
port (int): The port number on which the server will listen. Defaults to 8000.
|
|
120
120
|
"""
|
|
121
121
|
self.app.add_routes(self.routes)
|
|
122
|
+
# Only use this method to start the server
|
|
122
123
|
web.run_app(self.app, host=host, port=port)
|
|
123
124
|
|
|
124
125
|
@classmethod
|
|
@@ -6,7 +6,7 @@ build-backend = "hatchling.build"
|
|
|
6
6
|
|
|
7
7
|
[project]
|
|
8
8
|
name = "lightapi"
|
|
9
|
-
version = "0.1.
|
|
9
|
+
version = "0.1.5"
|
|
10
10
|
description = "A lightweight framework for building API endpoints using Python's native libraries."
|
|
11
11
|
readme = "README.md"
|
|
12
12
|
requires-python = ">=3.8.1"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|