Getting Started¶
Set up Envist in minutes and load typed configuration straight from your .env files. This guide walks through prerequisites, installation, and the core workflow.
Prerequisites¶
- Python 3.7 or newer
- An existing
.envfile (optional but recommended) - Familiarity with standard environment variables
Installation¶
pip (recommended)¶
Conda¶
Poetry¶
From source¶
Your First Typed .env¶
Create a .env file alongside your application:
APP_NAME <str> = Envist Demo
PORT <int> = 8080
DEBUG <bool> = true
DATABASE_URL <str> = postgresql://user:pass@localhost:5432/app
ALLOWED_HOSTS <list> = localhost, 127.0.0.1
Load it in Python:
from envist import Envist
env = Envist()
print(env.get("APP_NAME")) # 'Envist Demo'
print(env.get("PORT")) # 8080
print(env.get("ALLOWED_HOSTS")) # ['localhost', '127.0.0.1']
Core Workflow¶
- Annotate values in
.envwith<type>descriptors. - Instantiate
Envist()in your codebase. - Retrieve values with
env.get()or dictionary-style access (env["KEY"]). - Update configuration dynamically using
env.set()andenv.save()if required.
Switching Files¶
Pass a custom path when you need environment-specific configs:
Combine configurations by instantiating multiple readers and merging dictionaries. See Multiple Environments for patterns.
Accepting Empty Values¶
Some workflows require declaring keys without immediate values. Enable this by setting accept_empty=True:
Disabling Auto Casting¶
To keep raw stringsāuseful during incremental migrationsāset auto_cast=False and override per lookup:
Next Steps¶
- Learn about the declarative syntax in Smart .env Syntax.
- Explore complex data types in Type Casting & Data Shapes.
- Add runtime safeguards with the Validation Recipes.