Skip to main content

No project description provided

Project description

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

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

object_api-0.0.1.tar.gz (11.3 kB view details)

Uploaded Source

Built Distribution

object_api-0.0.1-py3-none-any.whl (13.9 kB view details)

Uploaded Python 3

File details

Details for the file object_api-0.0.1.tar.gz.

File metadata

  • Download URL: object_api-0.0.1.tar.gz
  • Upload date:
  • Size: 11.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.17

File hashes

Hashes for object_api-0.0.1.tar.gz
Algorithm Hash digest
SHA256 e935e858e433b028eb0a0b857097d1e4fd9985232c24ba5ec222e700e0951002
MD5 933a2fa94db1412c674f1cef7396787d
BLAKE2b-256 d212160455bfc7a3d9641e738f28c9ae4f13d43d8a520ce9478ee124bb837b29

See more details on using hashes here.

File details

Details for the file object_api-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: object_api-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 13.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.17

File hashes

Hashes for object_api-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 0ebc5e04360f1492c410b8a0827aac1823b0fe1982e12d5a679d348bf24a3970
MD5 fc218bc10b014afd66604684df0dbf64
BLAKE2b-256 883a3e2a7e526d4f066f6708cdb692690d1c10a6fcaeddc67a563323ef121955

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page