The Object API
ObjectAPI provides a concise negative-boilerplate paradigm for creating full-stack web applications with Python. It is built on top of FastAPI, SQLModel, and pydantic.
Features
- Active record pattern for database access
- Automatic get_by_id lookup for instance methods with route decorators
- Automatic CRUD routes
- Scheduled service methods
- Managed DB sessions for service methods and for each request
Installation
pip install object-api
Usage
from object_api import App, Entity, RouterBuilder, ServiceBuilder
app = App()
class User(Entity):
class Meta:
service = ServiceBuilder()
router = RouterBuilder()
new_private = ["pass"]
name: str
pass: str
age: int
@service.servicemethod
@classmethod
def remove_inactive(cls):
for user in User.get_all():
if user.age > 100:
user.delete()
@router.route()
def get_name(self):
return self.name
@router.post("/change_name")
def change_name(self, name: str):
self.name = name
self.save()
app = App()
app.run()
Documentation
https://github.com/ComputaCo/object-api
License
Metadata
Release files for object-api 0.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| object_api-0.0.1.tar.gz | 11.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| object_api-0.0.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 25.1 kB
Release files / object_api-0.0.1.tar.gz
| Download URL | object_api-0.0.1.tar.gz |
|---|---|
| Size | 11.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e935e858e433b028eb0a0b857097d1e4fd9985232c24ba5ec222e700e0951002
|
|
BLAKE2b-256 checksum How to use checksums |
d212160455bfc7a3d9641e738f28c9ae4f13d43d8a520ce9478ee124bb837b29
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.17
|
Release files / object_api-0.0.1-py3-none-any.whl
| Download URL | object_api-0.0.1-py3-none-any.whl |
|---|---|
| Size | 13.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
0ebc5e04360f1492c410b8a0827aac1823b0fe1982e12d5a679d348bf24a3970
|
|
BLAKE2b-256 checksum How to use checksums |
883a3e2a7e526d4f066f6708cdb692690d1c10a6fcaeddc67a563323ef121955
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.17
|