Skip to content

Installation#

This section explains how to install RESTAlchemy and its typical dependencies.


Requirements#

  • A supported version of CPython (see RESTAlchemy on PyPI for exact versions).
  • A virtual environment is strongly recommended.
  • For SQL storage examples:
  • A running database (e.g. MySQL or PostgreSQL).
  • Matching Python drivers (e.g. mysql-connector-python, psycopg).

Install RESTAlchemy#

Create and activate a virtual environment (optional but recommended):

python -m venv .venv
source .venv/bin/activate

Install the library from PyPI:

pip install restalchemy

To work with all examples in this repository, also install extra dependencies from requirements.txt (in the repository root):

pip install -r requirements.txt

Verifying the installation#

Run Python and import RESTAlchemy:

import restalchemy
from restalchemy import version

print(version.__version__)

If this prints a version string without errors, the core installation works.


Optional: database drivers#

If you plan to use SQL storage:

  • MySQL:
  • Install a MySQL driver, for example:
    pip install mysql-connector-python
    
  • PostgreSQL:
  • Install a PostgreSQL driver, for example:
    pip install psycopg[binary]
    

Make sure the connection URLs you use in your code match the drivers and database you have installed.