Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

Plateforme

Plateforme Core - OSS (alpha release)

ci pypi downloads versions license

Plateforme enables you to build and deploy modern data-driven applications and services in seconds with the power of SQLAlchemy, Pydantic, and FastAPI.

Help

See the documentation for more details.

Installation

Install using pip install -U plateforme or conda install plateforme -c conda-forge.

For more details and advanced installation options, see the installation guide from the official documentation site.

A basic example

Create a simple application

from typing import Self

from plateforme import Plateforme
from plateforme.api import route
from plateforme.resources import ConfigDict, CRUDResource, Field

app = Plateforme(debug=True, database_engines='plateforme.db')

class Rocket(CRUDResource):
    code: str = Field(unique=True)
    name: str
    parts: list['RocketPart'] = Field(default_factory=list)
    launched: bool = False

    @route.post()
    async def launch(self) -> Self:
        self.launched = True
        return self

class RocketPart(CRUDResource):
    __config__ = ConfigDict(indexes=[{'rocket', 'code'}])
    rocket: Rocket
    code: str
    quantity: int

Validate and use data

some_data = {
    'code': 'FAL-9',
    'name': 'Falcon 9',
    'parts': [
        {'code': 'dragon', 'quantity': 1},
        {'code': 'raptor', 'quantity': 9},
        {'code': 'tank', 'quantity': 1},
    ],
}

rocket = Rocket.resource_validate(some_data)
print(repr(rocket))
#> Rocket(code='FAL-9')

print(repr(rocket.parts[0].code))
#> 'dragon'

Persist data

# Create the database schema
app.metadata.create_all()

# Persist the data
with app.session() as session:
    session.add(rocket)
    session.commit()

# Query the data
with app.session() as session:
    rocket = session.query(Rocket).filter_by(code='FAL-9').one()

print(repr(rocket))
#> Rocket(id=1, code='FAL-9')

Run the application

uvicorn main:app

Play with the API

Use the built-in CRUD and query engine

With the built-in CRUD and query engine, you can easily create, read, update, and delete resources. The following query finds all parts in rocket #1 whose part codes contain the sequence ra.

GET http://localhost:8000/rockets/1/parts?.code=like~*ra* HTTP/1.1
[
  {
    "id": 1,
    "type": "rocket_part",
    "code": "dragon",
    "quantity": 1
  },
  {
    "id": 2,
    "type": "rocket_part",
    "code": "raptor",
    "quantity": 9
  }
]

Use custom routes

You can also define custom routes to perform more complex operations. The following request launches rocket #1 and persists in the database the launched flag to true.

POST http://localhost:8000/rockets/1/launch HTTP/1.1
{
  "id": 1,
  "type": "rocket",
  "code": "FAL-9",
  "name": "Falcon 9",
  "parts": [
    ...
  ],
  "launched": true
}

Use the built-in CLI

Plateforme comes with a built-in CLI to help you automate common tasks. For instance, the following commands initialize a new project, build it, and start the server.

# Initialize the project
plateforme init

# Build the project
plateforme build

# Start the server
plateforme start --reload

For detailed documentation and more examples, see the official documentation.

Contributing

For guidance on setting up a development environment and how to make a contribution to Plateforme, read the contributing guidelines from the official documentation site.

Reporting a security vulnerability

See our security policy.

Metadata

Release files for plateforme 0.1.0a3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for plateforme 0.1.0a3
File Size Uploaded
plateforme-0.1.0a3.tar.gz 331.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for plateforme 0.1.0a3
File Interpreter ABI Platform
plateforme-0.1.0a3-py3-none-any.whl Python 3 none any Details

Total release size: 740.2 kB

Release files / plateforme-0.1.0a3.tar.gz

Download URL plateforme-0.1.0a3.tar.gz
Size 331.9 kB
Tags Source
SHA-256 checksum
How to use checksums
b674f5950d347c4b58529aaa0e548535f336594ac49af07b2d90cd1ba627f4e4
BLAKE2b-256 checksum
How to use checksums
2c7ca0029b7a6fcc005a6421c1440ee01136388a52ca77981c36b289f1319bd8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via python-httpx/0.27.0

Release files / plateforme-0.1.0a3-py3-none-any.whl

Download URL plateforme-0.1.0a3-py3-none-any.whl
Size 408.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3d79219083cad882e310b9023e33d081fc7b83b62d111b22c575702a9968f4b4
BLAKE2b-256 checksum
How to use checksums
d2b7b06ea31161b1bc7effe8ba81a2c529d91f73506dfe476925fd1bd27c14ac
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via python-httpx/0.27.0
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page