REST HTTP Abstraction Library
Project description
RESTAlchemy
RESTAlchemy is a Python toolkit for building HTTP REST APIs on top of a flexible data model and storage abstraction.
It combines:
A Data Model (DM) layer for defining domain models and validation.
A Storage layer for persisting models (for example, SQL databases).
An API layer for exposing models as RESTful HTTP resources.
Optional OpenAPI support for discoverable, documented APIs.
Features
Clear separation between domain models, storage implementation details, and HTTP API.
Strongly typed, validated data model with reusable properties.
Minimal boilerplate to expose models as REST resources.
Built-in migration tooling for evolving database schemas.
Documentation
All documentation is available in four languages. The structure of files and sections is identical across languages:
English: docs/en/index.md
Russian: docs/ru/index.md
German: docs/de/index.md
Chinese: docs/zh/index.md
If you are new to RESTAlchemy, start with:
Quick start
Install from PyPI:
pip install restalchemy
Define a simple DM model (simplified from the getting started guide):
from restalchemy.dm import models
from restalchemy.dm import properties
from restalchemy.dm import types
class FooModel(models.ModelWithUUID):
value = properties.property(types.Integer(), required=True)
For a complete in-memory REST service example, including controllers, routes and a WSGI application, see docs/en/getting-started.md.
Examples
Real code examples live in the examples/ directory:
examples/restapi_foo_bar_service.py – a simple REST API service built with in-memory storage.
examples/dm_mysql_storage.py – data model with MySQL storage example.
examples/openapi_app.py – example API with OpenAPI specification generation.
Migration commands
RESTAlchemy provides command-line tools for managing database migrations.
<migration number>-<message>-<hash>.py
$ ra-rename-migrations -p <path-to-migrations>
Create migrations:
$ ra-new-migration --path examples/migrations/ --message "1st migration" $ ra-new-migration --path examples/migrations/ --message "2st migration" --depend 1st $ ra-new-migration --path examples/migrations/ --message "3st migration" --depend 2st $ ra-new-migration --path examples/migrations/ --message "4st migration" $ ra-new-migration --path examples/migrations/ --message "5st migration" --depend 3st --depend 4st
Apply migrations:
$ ra-apply-migration --path examples/migrations/ --db-connection mysql://test:test@localhost/test -m 5st > upgrade 1st > upgrade 2st > upgrade 3st > upgrade 4st > upgrade 5st
Rolled back migrations:
$ ra-rollback-migration --path examples/migrations/ --db-connection mysql://test:test@localhost/test -m 4st > downgrade 5st > downgrade 4st
$ ra-rollback-migration --path examples/migrations/ --db-connection mysql://test:test@localhost/test -m 1st > downgrade 3st > downgrade 2st > downgrade 1st
Tests
Tests are managed via tox. The default environment list includes Python 3.8, 3.10, 3.12 and 3.13.
Run the full test suite:
tox
Run tests for a specific Python version (for example, Python 3.10):
tox -e py310
Run functional tests (require access to a MySQL database):
export DATABASE_URI="mysql://root:@localhost:3306/radatabase"
tox -e py310-functional
Run functional tests with PostgreSQL:
export DATABASE_URI="postgresql://postgres:password@localhost:5432/radatabase"
tox -e py310-functional
License
RESTAlchemy is licensed under the Apache License, Version 2.0.
Copyright (c) Genesis Corporation, 2025.
See the LICENSE file in this repository or https://www.apache.org/licenses/LICENSE-2.0 for the full license text.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file restalchemy-14.6.0.tar.gz.
File metadata
- Download URL: restalchemy-14.6.0.tar.gz
- Upload date:
- Size: 276.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0bf094c83481eaf1f8f396ec649dcfbf9a1d0ec9873f51fc2e76e7fa73807521
|
|
| MD5 |
7de86d57bbe237ecae2eb21e8502bc62
|
|
| BLAKE2b-256 |
92981c0df52850c20687ca3fcbeeea576cdcc9895d19216b216d60675cd8a7f2
|
Provenance
The following attestation bundles were made for restalchemy-14.6.0.tar.gz:
Publisher:
publish-to-pypi.yml on infraguys/restalchemy
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
restalchemy-14.6.0.tar.gz -
Subject digest:
0bf094c83481eaf1f8f396ec649dcfbf9a1d0ec9873f51fc2e76e7fa73807521 - Sigstore transparency entry: 782169421
- Sigstore integration time:
-
Permalink:
infraguys/restalchemy@f26142b7f4a9c87c2b77a563c0119e120cb5c57e -
Branch / Tag:
refs/tags/14.6.0 - Owner: https://github.com/infraguys
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-to-pypi.yml@f26142b7f4a9c87c2b77a563c0119e120cb5c57e -
Trigger Event:
push
-
Statement type:
File details
Details for the file restalchemy-14.6.0-py3-none-any.whl.
File metadata
- Download URL: restalchemy-14.6.0-py3-none-any.whl
- Upload date:
- Size: 264.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cbea5f9d28135e72d89c737de9b2821ba473d4b396e9e8a256955877bf69ecfb
|
|
| MD5 |
5cd9cf0a30b86ae773b1e8bd94da27f5
|
|
| BLAKE2b-256 |
69e8b79a15d56ad8098353abd7a1f0dbb44defe76118e1a2906e0edca885822c
|
Provenance
The following attestation bundles were made for restalchemy-14.6.0-py3-none-any.whl:
Publisher:
publish-to-pypi.yml on infraguys/restalchemy
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
restalchemy-14.6.0-py3-none-any.whl -
Subject digest:
cbea5f9d28135e72d89c737de9b2821ba473d4b396e9e8a256955877bf69ecfb - Sigstore transparency entry: 782169422
- Sigstore integration time:
-
Permalink:
infraguys/restalchemy@f26142b7f4a9c87c2b77a563c0119e120cb5c57e -
Branch / Tag:
refs/tags/14.6.0 - Owner: https://github.com/infraguys
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-to-pypi.yml@f26142b7f4a9c87c2b77a563c0119e120cb5c57e -
Trigger Event:
push
-
Statement type: