Getting StartedInstallation
Getting Started~ 4 min read

Installation

Python version

Flama is fully compatible with all Python supported versions. If you do not have any preference, we recommend you to use the latest version available.

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

python --version

If the version is prior to the oldest supported version, 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=<PYTHON_VERSION> --yesconda activate flama-dev
Creation of virtual environment with pyenv
pyenv install <PYTHON_VERSION>pyenv virtualenv <PYTHON_VERSION> flama-devpyenv 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 dependencies to add extra functionality to 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.

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

  • HTTPX: HTTPX is a fully featured HTTP client for Python 3, which provides sync and async APIs, and support for both HTTP/1.1 and HTTP/2.

These dependencies are automatically included when installing Flama if the appropriate extra is specified:

  • pydantic to make use of Pydantic schemas
  • typesystem to make use of Typesystem schemas
  • marshmallow to make use of Marshmallow schemas
  • database to interact with a database through SQlAlchemy functionality
  • client to interact with a Flama model, or a Flama application (e.g., for testing purposes), or any other HTTP resource

An example of installation including pydantic, database, and client would be as follows:

pip install flama[pydantic, database, client]

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.gitcd flamamake 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 --helpUsage: 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: model Interact with an ML model without server. 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>

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.