plateforme


Nameplateforme JSON
Version 0.1.0a2 PyPI version JSON
download
home_pageNone
SummaryThe Python framework for Data Applications
upload_time2025-02-22 17:58:45
maintainerNone
docs_urlNone
authorRodolphe Barbanneau
requires_python>=3.11
licenseMIT License Copyright (c) 2023 Plateforme Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
keywords api app application asgi async fastapi framework json plateforme platform pydantic rest services sqlalchemy uvicorn web
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            <p style="text-align: center">
  <a href="https://docs.plateforme.io"><img src="https://raw.githubusercontent.com/plateformeio/plateforme/refs/heads/main/docs/banner.png" alt="Plateforme"></a>
</p>

# Plateforme Core - OSS (alpha release)

[![ci](https://img.shields.io/github/actions/workflow/status/plateformeio/plateforme/ci.yml?branch=main&logo=github&label=ci)](https://github.com/plateformeio/plateforme/actions?query=event%3Apush+branch%3Amain+workflow%3Aci)
[![pypi](https://img.shields.io/pypi/v/plateforme.svg)](https://pypi.python.org/pypi/plateforme)
[![downloads](https://static.pepy.tech/badge/plateforme/month)](https://pepy.tech/project/plateforme)
[![versions](https://img.shields.io/pypi/pyversions/plateforme.svg)](https://github.com/plateformeio/plateforme)
[![license](https://img.shields.io/github/license/plateformeio/plateforme.svg)](https://github.com/plateformeio/plateforme/blob/main/LICENSE)

Plateforme enables you to build and deploy modern data-driven applications and services in seconds with the power of [SQLAlchemy](https://github.com/sqlalchemy/sqlalchemy), [Pydantic](https://github.com/plateforme/plateforme), and [FastAPI](https://github.com/tiangolo/fastapi).

## Help

See the [documentation](https://docs.plateforme.io) 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](https://docs.plateforme.io/latest/start/install) from the official documentation site.

## A basic example

### Create a simple application

```python
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

```python
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

```python
# 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

```bash
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`.

```http
GET http://localhost:8000/rockets/1/parts?.code=like~*ra* HTTP/1.1
```

```json
[
  {
    "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`.

```http
POST http://localhost:8000/rockets/1/launch HTTP/1.1
```

```json
{
  "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.

```bash
# 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](https://docs.plateforme.io/latest/start).

## Contributing

For guidance on setting up a development environment and how to make a contribution to Plateforme, read the [contributing guidelines](https://docs.plateforme.io/latest/about/community/contributing) from the official documentation site.

## Reporting a security vulnerability

See our [security policy](https://github.com/plateformeio/plateforme/security/policy).

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "plateforme",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.11",
    "maintainer_email": null,
    "keywords": "api, app, application, asgi, async, fastapi, framework, json, plateforme, platform, pydantic, rest, services, sqlalchemy, uvicorn, web",
    "author": "Rodolphe Barbanneau",
    "author_email": null,
    "download_url": "https://files.pythonhosted.org/packages/9e/7b/5b0489c47ffba2d823100524f01f4f8836e42b9dbce52dc0dbdb2e5a2d09/plateforme-0.1.0a2.tar.gz",
    "platform": null,
    "description": "<p style=\"text-align: center\">\n  <a href=\"https://docs.plateforme.io\"><img src=\"https://raw.githubusercontent.com/plateformeio/plateforme/refs/heads/main/docs/banner.png\" alt=\"Plateforme\"></a>\n</p>\n\n# Plateforme Core - OSS (alpha release)\n\n[![ci](https://img.shields.io/github/actions/workflow/status/plateformeio/plateforme/ci.yml?branch=main&logo=github&label=ci)](https://github.com/plateformeio/plateforme/actions?query=event%3Apush+branch%3Amain+workflow%3Aci)\n[![pypi](https://img.shields.io/pypi/v/plateforme.svg)](https://pypi.python.org/pypi/plateforme)\n[![downloads](https://static.pepy.tech/badge/plateforme/month)](https://pepy.tech/project/plateforme)\n[![versions](https://img.shields.io/pypi/pyversions/plateforme.svg)](https://github.com/plateformeio/plateforme)\n[![license](https://img.shields.io/github/license/plateformeio/plateforme.svg)](https://github.com/plateformeio/plateforme/blob/main/LICENSE)\n\nPlateforme enables you to build and deploy modern data-driven applications and services in seconds with the power of [SQLAlchemy](https://github.com/sqlalchemy/sqlalchemy), [Pydantic](https://github.com/plateforme/plateforme), and [FastAPI](https://github.com/tiangolo/fastapi).\n\n## Help\n\nSee the [documentation](https://docs.plateforme.io) for more details.\n\n## Installation\n\nInstall using `pip install -U plateforme` or `conda install plateforme -c conda-forge`.\n\nFor more details and advanced installation options, see the [installation guide](https://docs.plateforme.io/latest/start/install) from the official documentation site.\n\n## A basic example\n\n### Create a simple application\n\n```python\nfrom typing import Self\n\nfrom plateforme import Plateforme\nfrom plateforme.api import route\nfrom plateforme.resources import ConfigDict, CRUDResource, Field\n\napp = Plateforme(debug=True, database_engines='plateforme.db')\n\nclass Rocket(CRUDResource):\n    code: str = Field(unique=True)\n    name: str\n    parts: list['RocketPart'] = Field(default_factory=list)\n    launched: bool = False\n\n    @route.post()\n    async def launch(self) -> Self:\n        self.launched = True\n        return self\n\nclass RocketPart(CRUDResource):\n    __config__ = ConfigDict(indexes=[{'rocket', 'code'}])\n    rocket: Rocket\n    code: str\n    quantity: int\n```\n\n### Validate and use data\n\n```python\nsome_data = {\n    'code': 'FAL-9',\n    'name': 'Falcon 9',\n    'parts': [\n        {'code': 'dragon', 'quantity': 1},\n        {'code': 'raptor', 'quantity': 9},\n        {'code': 'tank', 'quantity': 1},\n    ],\n}\n\nrocket = Rocket.resource_validate(some_data)\nprint(repr(rocket))\n#> Rocket(code='FAL-9')\n\nprint(repr(rocket.parts[0].code))\n#> 'dragon'\n```\n\n### Persist data\n\n```python\n# Create the database schema\napp.metadata.create_all()\n\n# Persist the data\nwith app.session() as session:\n    session.add(rocket)\n    session.commit()\n\n# Query the data\nwith app.session() as session:\n    rocket = session.query(Rocket).filter_by(code='FAL-9').one()\n\nprint(repr(rocket))\n#> Rocket(id=1, code='FAL-9')\n```\n\n### Run the application\n\n```bash\nuvicorn main:app\n```\n\n### Play with the API\n\n#### Use the built-in CRUD and query engine\n\nWith 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`.\n\n```http\nGET http://localhost:8000/rockets/1/parts?.code=like~*ra* HTTP/1.1\n```\n\n```json\n[\n  {\n    \"id\": 1,\n    \"type\": \"rocket_part\",\n    \"code\": \"dragon\",\n    \"quantity\": 1\n  },\n  {\n    \"id\": 2,\n    \"type\": \"rocket_part\",\n    \"code\": \"raptor\",\n    \"quantity\": 9\n  }\n]\n```\n\n#### Use custom routes\n\nYou 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`.\n\n```http\nPOST http://localhost:8000/rockets/1/launch HTTP/1.1\n```\n\n```json\n{\n  \"id\": 1,\n  \"type\": \"rocket\",\n  \"code\": \"FAL-9\",\n  \"name\": \"Falcon 9\",\n  \"parts\": [\n    ...\n  ],\n  \"launched\": true\n}\n```\n\n### Use the built-in CLI\n\nPlateforme 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.\n\n```bash\n# Initialize the project\nplateforme init\n\n# Build the project\nplateforme build\n\n# Start the server\nplateforme start --reload\n```\n\nFor detailed documentation and more examples, see the [official documentation](https://docs.plateforme.io/latest/start).\n\n## Contributing\n\nFor guidance on setting up a development environment and how to make a contribution to Plateforme, read the [contributing guidelines](https://docs.plateforme.io/latest/about/community/contributing) from the official documentation site.\n\n## Reporting a security vulnerability\n\nSee our [security policy](https://github.com/plateformeio/plateforme/security/policy).\n",
    "bugtrack_url": null,
    "license": "MIT License\n        \n        Copyright (c) 2023 Plateforme\n        \n        Permission is hereby granted, free of charge, to any person obtaining a copy\n        of this software and associated documentation files (the \"Software\"), to deal\n        in the Software without restriction, including without limitation the rights\n        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n        copies of the Software, and to permit persons to whom the Software is\n        furnished to do so, subject to the following conditions:\n        \n        The above copyright notice and this permission notice shall be included in all\n        copies or substantial portions of the Software.\n        \n        THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n        SOFTWARE.",
    "summary": "The Python framework for Data Applications",
    "version": "0.1.0a2",
    "project_urls": {
        "Documentation": "https://github.com/plateformeio/plateforme#readme",
        "Homepage": "https://plateforme.io/",
        "Issues": "https://github.com/plateformeio/plateforme/issues",
        "Source": "https://github.com/plateformeio/plateforme"
    },
    "split_keywords": [
        "api",
        " app",
        " application",
        " asgi",
        " async",
        " fastapi",
        " framework",
        " json",
        " plateforme",
        " platform",
        " pydantic",
        " rest",
        " services",
        " sqlalchemy",
        " uvicorn",
        " web"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "a822641d870bfe8ab373c3007c897ba2a5b154258bff72a312b1d705de91f6c2",
                "md5": "7e9f974a57677f2508bd0bfe71da6f97",
                "sha256": "ef3ab4ff0cb4f50c888c8322313510e727fd84f25fa336c4b2c92758062bb1c9"
            },
            "downloads": -1,
            "filename": "plateforme-0.1.0a2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "7e9f974a57677f2508bd0bfe71da6f97",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.11",
            "size": 405542,
            "upload_time": "2025-02-22T17:58:46",
            "upload_time_iso_8601": "2025-02-22T17:58:46.910366Z",
            "url": "https://files.pythonhosted.org/packages/a8/22/641d870bfe8ab373c3007c897ba2a5b154258bff72a312b1d705de91f6c2/plateforme-0.1.0a2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "9e7b5b0489c47ffba2d823100524f01f4f8836e42b9dbce52dc0dbdb2e5a2d09",
                "md5": "6b7fb4d7ad8b62a151ce6f4b2e19167d",
                "sha256": "1d236497eaba8ef4aebd349df05f17f13d919b2ef6973b35214e72b560e3bbab"
            },
            "downloads": -1,
            "filename": "plateforme-0.1.0a2.tar.gz",
            "has_sig": false,
            "md5_digest": "6b7fb4d7ad8b62a151ce6f4b2e19167d",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.11",
            "size": 329194,
            "upload_time": "2025-02-22T17:58:45",
            "upload_time_iso_8601": "2025-02-22T17:58:45.519707Z",
            "url": "https://files.pythonhosted.org/packages/9e/7b/5b0489c47ffba2d823100524f01f4f8836e42b9dbce52dc0dbdb2e5a2d09/plateforme-0.1.0a2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-02-22 17:58:45",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "plateformeio",
    "github_project": "plateforme#readme",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "plateforme"
}
        
Elapsed time: 0.41212s