Getting StartedInstallation
Getting Started~ 3 min read

Installation

Python version

Flama is fully compatible with Python 3.8 and newer versions. If you do not have any preference, we recommend you to use the latest version.

As a first step, check the version of your active Python environment:

> python --version
Python 3.11.5

If the version is prior to 3.8, we suggest you to create a virtual environment with the latest version.

Creating a virtual environment

This section is not a comprehensive guide about the management of Python virtual environments. We encourage you to learn more about venv, pyenv or conda for a better understanding on how to manage virtual environments. Virtual environments allow the isolation of dependencies, which plays a crucial role to avoid breaking compatibility between different projects.

To create and activate a virtual environment with a compatible Python version you can take the following code snippets. Before you start working on a new project, it is very important to activate the corresponding environment. The last command line in both code snippets precisely activate the environment with conda or pyenv, respectively.

Creation of virtual environment with conda
> conda create --name flama-dev python=3.8 --yes
> conda activate flama-dev
Creation of virtual environment with pyenv
> pyenv install 3.8
> pyenv virtualenv 3.8 flama-dev
> pyenv local flama-dev

Install Flama

Core

Flama is a Python library hosted on PyPI, and can be easily installed with pip (the package installer for Python). Within the previously created and activated virtual environment, run the following command:

> pip install flama

After running this command line, you'll have Flama installed and ready to be used in your project.

Extras

You have installed the core functionality of Flama already. However, you might need some extra functionality when working in your project:

  • Pydantic: A library for data validation and settings management with support for type hints.

  • Typesystem: A comprehensive library for data validation typically used to define typed data schemas which provides data validation and object serialization & deserialization tools.

  • Marshmallow: A library for data validation and serialization/deserialization.

  • Forge (python): An elegant library for revising function signatures at runtime.

  • SQlAlchemy: SQL toolkit and Object Relational Mapper that gives application developers the full power and flexibility of SQL.

These dependencies are required if you want to use typed data schemas (pydantic, typesystems, marshmallow), or if you are going to use pagination (python-forge), or if you need to include a database (sqlalchemy) in your project.

If you use pydantic schemas, run:

> pip install flama[pydantic, pagination, database]

In case you want to use typesystem schemas, run:

> pip install flama[typesystem, pagination, database]

Or, if you prefer to use marshmallow schemas instead, run:

> pip install flama[marshmallow, pagination, database]

Development

If you want to contribute to Flama development, you will need to install it from the local folder where you have cloned the repository. Run the following command if this is your case:

> git clone [email protected]:vortico/flama.git
> cd flama
> make install

To keep learning you can now check out the Quickstart.

Flama CLI

After installing Flama you will have the Flama command-line interface (CLI) at your disposal.

The easiest and more practical way to check that everything was correctly installed is by running:

> flama --help
Usage: flama [OPTIONS] COMMAND [ARGS]...
Fire up your models with Flama 🔥
Options:
--version Check the version of your locally installed Flama
--help Get help about how to use Flama CLI
Commands:
run Run a Flama Application based on a route.
serve Serve an ML model file within a Flama Application.
start Start a Flama Application based on a config file.

To check what version of the library you have installed, simply run:

> flama --version
flama, version 1.5.2

If you get something similar to the above output, you are completely set. We recommend you to keep reading the documentation, and enjoy the journey.