Skip to content

Welcome to Stela

Stela were the "information files" of ancient times. This library aims to simplify your project configurations, proposing an opinionated way to manage your project using dotenv files, or using any source you need.

Motivation

Working with environment variables vs project settings and secrets can be hard.

  • Sometimes we need to define a default value for a secret, like a database url, to run unit tests.
  • Sometimes, we need to set different values for a setting, like an API url, for different environments.
  • Sometimes, we use dotenv on local development, but need to use other services, like vaults or secret managers, to retrieve these same settings and secrets on production.

This library was created to help simplify this process, by providing a single interface to access all data from multiple dotenv files, or if you need, from your custom logic to retrieve your project settings and secrets from another source.

About settings and secrets

In this documentation we talk a lot about these two concepts. What we meant:

  • settings: Any nonsensible value, which can be different between different environments. This data can be safety committed in your project. Example: API urls, Timeout values, etc..
  • secrets: Any sensible value, which you can't commit in you project. Examples: Tokens, Passwords, etc..

Why another library?

There are a lot of good libraries to work with project settings:

  • python-dotenv - One of the most popular. In fact, we use it under the hood to load the dotenv files.
  • python-decouple - Another good one, this library together with Dynaconf and Plaster were the main inspirations for this project until version 5.x
  • Pydantic - A very powerful solution for data validation, they provide a Settings Management tool, which is an good solution for that environment.

Why use Stela?

Our key features:

  1. Learn once, use everywhere. Stela aims to be easily used in any Python project or Framework.
  2. Separate settings from secrets from environments. Instead of using a single dotenv file to store all your settings, we use multiple dotenv files, one for each environment. This way, you can split secrets from settings, and you can have different values for the same environment variable in different environments.
  3. Easy to implement. Use the command stela init to initialize your project and configure .env and .gitignore files.
  4. Easy to use. To access you configuration just include from stela import env in your code. Simple as that.
  5. One Interface, Any Source. You're not limited to dotenv files. Create your custom logic to import data from any source you need.

Install

pip install stela

Currently this project supports:

  • Python 3.10, 3.11 and 3.12