This release has been yanked by its maintainers, and will be ignored by installers, except when explicitly specified.
Reason given by maintainers: Rewrote in go instead
dotem
dotem is a simple Python package designed to streamline the process of loading environment variables into your shell from a .env.toml file. It aims to make the configuration of your development environment easier and more consistent.
Motivation
Managing environment variables is a common task in software development, and it can become cumbersome, especially when dealing with multiple configurations for different environments.
An example of a project with many different .env files:
project/
|-- env/
| |-- .env
| |-- .env.local
| |-- .env.development
| |-- .env.staging
| |-- .env.uat
| |-- .env.prod
| `-- ...
`-- ...
dotem was created with the following motivations:
- Simplicity: Provide a straightforward solution for loading environment variables, reducing the complexity of managing configurations using a single file
.env.toml. - Consistency: Establish a consistent approach to handling environment variables across projects, using a standardized
.env.tomlfile format. - Ease of Use: Make it easy for developers to "source" their environment variables in a single command call.
Installation
[!WARNING]
dotemis supported in Linux and Darwin machines only!
You can install dotem using pip. Run the following command:
pip install dotem
Then, in your .bashrc or .zshrc file, add the following line:
eval "$("dotem-cli" hook)"
Features
- Loading and unloading environment variables from a
.env.tomlfile. - Simple and lightweight.
- Support TOML format for easy configuration.
- Loading and unloading environment variables with inheritance.
Usage
-
Create a
.env.tomlfile with your environment variables.[development] API_KEY = "..." DATABASE_URL = "..." [production] API_KEY = "..." DATABASE_URL = "..."
-
In your shell, use
dotem load [profile]to load the environment variable into your shell.dotem load development
This will load the environment variables of that profile in your shell.
Commands
dotem load [profile]- Loads the environment variables defined in the profile.dotem unload [profle]- Unsets the environment variables defined in the profile.dotem edit- Edits the.env.tomlfile in the$EDITORdotem hook- A script to hook updotemdotem --help- Helpdotem [COMMAND] --help- Command help
Configuration
.env.toml search path
By default, dotem will look for the .env.toml file in the current working directory. If there are no .env.toml in the current working directory, it will check in the following order:
- Current working directory (
./env.toml). - Parent directory (
../.env.toml) $XDG_CONFIG_HOME/.config/dotem/.env.tomlor$HOME/.config/dotem/.env.tomlif$XDG_CONFIG_HOMEis not defined.$HOME/.env.toml
Default profiles
The [global] profile
The global profile is a profile that always gets loaded whenever you call dotem load [profile].
The [default] profile
If the profile in dotem load [profile] is empty, dotem will load the default profile. If a default profile is not set, it will raise an error.
Environment variable inheritance
dotem supports environment variable inheritance. Suppose we have the following .env.toml file:
[development]
API_KEY = "..."
DATABASE_URL = "..."
[development.zone-a]
ZONE_A_SECRET_USERNAME = "..."
ZONE_A_SECRET_PASSWORD = "..."
[development.zone-b]
ZONE_B_SECRET_USERNAME = "..."
ZONE_B_SECRET_PASSWORD = "..."
Running the command dotem load development.zone-a will load the parent's environment variables development and the child zone-a:
API_KEY = "..."DATABASE_URL = "..."ZONE_A_SECRET_USERNAME = "..."ZONE_A_SECRET_PASSWORD = "..."
[!NOTE]
If two of the same environment variable is set in the parent and child profile, dotem will use the environment variable set in the child's profile instead.
Contributing
Contributions, issues, and feature requests are welcome! Please feel free to submit a pull request or open an issue.
License
This project is licensed under the MIT License - see the LICENSE file for details.
Release files for dotem 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| dotem-0.1.1.tar.gz | 5.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| dotem-0.1.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 10.9 kB
Release files / dotem-0.1.1.tar.gz
| Download URL | dotem-0.1.1.tar.gz |
|---|---|
| Size | 5.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ce3e667c35046765c767661bfbac071df371165434bdef26a5141e45785b1c96
|
|
BLAKE2b-256 checksum How to use checksums |
b5e53c12dd1be9711a6c4479cb48945ab5668434626f1c6ac7eee18c7715fbcd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/4.0.2 CPython/3.11.7
|
Release files / dotem-0.1.1-py3-none-any.whl
| Download URL | dotem-0.1.1-py3-none-any.whl |
|---|---|
| Size | 5.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c2a77154841b50994a1c9d232b0af9843bbd45b08651d22dfaf85321abebee61
|
|
BLAKE2b-256 checksum How to use checksums |
7ed86c0ce2562b41f6411188fa392c7e462c2e00146557fc65dcafb8d144e7ae
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/4.0.2 CPython/3.11.7
|