# 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:
```text
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.toml` file format.
- Ease of Use: Make it easy for developers to "source" their environment variables in a single command call.
## Installation
> [!WARNING]
> `dotem` is supported in Linux and Darwin machines only!
You can install `dotem` using pip. Run the following command:
```bash
pip install dotem
```
Then, in your `.bashrc` or `.zshrc` file, add the following line:
```bash
eval "$("dotem-cli" hook)"
```
## Features
- Loading and unloading environment variables from a `.env.toml` file.
- Simple and lightweight.
- Support TOML format for easy configuration.
- Loading and unloading environment variables with inheritance.
## Usage
1. Create a `.env.toml` file with your environment variables.
```toml
[development]
API_KEY = "..."
DATABASE_URL = "..."
[production]
API_KEY = "..."
DATABASE_URL = "..."
```
2. In your shell, use `dotem load [profile]` to load the environment variable into your shell.
```bash
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.toml` file in the `$EDITOR`
- `dotem hook` - A script to hook up `dotem`
- `dotem --help` - Help
- `dotem [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:
1. Current working directory (`./env.toml`).
2. Parent directory (`../.env.toml`)
3. `$XDG_CONFIG_HOME/.config/dotem/.env.toml` or `$HOME/.config/dotem/.env.toml` if `$XDG_CONFIG_HOME` is not defined.
4. `$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:
```toml
[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](LICENSE) file for details.
Raw data
{
"_id": null,
"home_page": "https://github.com/hanhwanglim/dotem",
"name": "dotem",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.8,<4.0",
"maintainer_email": "",
"keywords": "",
"author": "Han Hwang Lim",
"author_email": "hanhwanglim@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/b5/e5/3c12dd1be9711a6c4479cb48945ab5668434626f1c6ac7eee18c7715fbcd/dotem-0.1.1.tar.gz",
"platform": null,
"description": "# dotem\n\ndotem 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.\n\n## Motivation\n\nManaging environment variables is a common task in software development, and it can become cumbersome, especially when dealing with multiple configurations for different environments.\n\nAn example of a project with many different `.env` files:\n\n```text\nproject/\n|-- env/\n| |-- .env\n| |-- .env.local\n| |-- .env.development\n| |-- .env.staging\n| |-- .env.uat\n| |-- .env.prod\n| `-- ...\n`-- ...\n```\n\ndotem was created with the following motivations:\n\n- Simplicity: Provide a straightforward solution for loading environment variables, reducing the complexity of managing configurations using a single file `.env.toml`.\n- Consistency: Establish a consistent approach to handling environment variables across projects, using a standardized `.env.toml` file format.\n- Ease of Use: Make it easy for developers to \"source\" their environment variables in a single command call.\n\n## Installation\n\n> [!WARNING] \n> `dotem` is supported in Linux and Darwin machines only!\n\nYou can install `dotem` using pip. Run the following command:\n\n```bash\npip install dotem\n```\n\nThen, in your `.bashrc` or `.zshrc` file, add the following line:\n\n```bash\neval \"$(\"dotem-cli\" hook)\"\n```\n\n## Features\n\n- Loading and unloading environment variables from a `.env.toml` file.\n- Simple and lightweight.\n- Support TOML format for easy configuration.\n- Loading and unloading environment variables with inheritance.\n\n## Usage\n\n1. Create a `.env.toml` file with your environment variables.\n\n ```toml\n [development]\n API_KEY = \"...\"\n DATABASE_URL = \"...\"\n\n [production]\n API_KEY = \"...\"\n DATABASE_URL = \"...\"\n ```\n\n2. In your shell, use `dotem load [profile]` to load the environment variable into your shell.\n\n ```bash\n dotem load development\n ```\n\n This will load the environment variables of that profile in your shell.\n\n### Commands\n\n- `dotem load [profile]` - Loads the environment variables defined in the profile.\n- `dotem unload [profle]` - Unsets the environment variables defined in the profile.\n- `dotem edit` - Edits the `.env.toml` file in the `$EDITOR`\n- `dotem hook` - A script to hook up `dotem`\n- `dotem --help` - Help\n- `dotem [COMMAND] --help` - Command help\n\n## Configuration\n\n### `.env.toml` search path\n\nBy 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:\n\n1. Current working directory (`./env.toml`).\n2. Parent directory (`../.env.toml`)\n3. `$XDG_CONFIG_HOME/.config/dotem/.env.toml` or `$HOME/.config/dotem/.env.toml` if `$XDG_CONFIG_HOME` is not defined.\n4. `$HOME/.env.toml`\n\n### Default profiles\n\n#### The `[global]` profile\n\nThe `global` profile is a profile that always gets loaded whenever you call `dotem load [profile]`.\n\n#### The `[default]` profile\n\nIf 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.\n\n### Environment variable inheritance\n\n`dotem` supports environment variable inheritance. Suppose we have the following `.env.toml` file:\n\n```toml\n[development]\nAPI_KEY = \"...\"\nDATABASE_URL = \"...\"\n\n[development.zone-a]\nZONE_A_SECRET_USERNAME = \"...\"\nZONE_A_SECRET_PASSWORD = \"...\"\n\n[development.zone-b]\nZONE_B_SECRET_USERNAME = \"...\"\nZONE_B_SECRET_PASSWORD = \"...\"\n```\n\nRunning the command `dotem load development.zone-a` will load the parent's environment variables `development` and the child `zone-a`:\n\n- `API_KEY = \"...\"`\n- `DATABASE_URL = \"...\"`\n- `ZONE_A_SECRET_USERNAME = \"...\"`\n- `ZONE_A_SECRET_PASSWORD = \"...\"`\n\n> [!NOTE] \n> 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.\n\n## Contributing\n\nContributions, issues, and feature requests are welcome! Please feel free to submit a pull request or open an issue.\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\n\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "An environment variable loader for your shell",
"version": "0.1.1",
"project_urls": {
"Homepage": "https://github.com/hanhwanglim/dotem",
"Repository": "https://github.com/hanhwanglim/dotem"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "7ed86c0ce2562b41f6411188fa392c7e462c2e00146557fc65dcafb8d144e7ae",
"md5": "4295faf26895484453d4a0892171108e",
"sha256": "c2a77154841b50994a1c9d232b0af9843bbd45b08651d22dfaf85321abebee61"
},
"downloads": -1,
"filename": "dotem-0.1.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "4295faf26895484453d4a0892171108e",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8,<4.0",
"size": 5784,
"upload_time": "2024-01-08T20:29:22",
"upload_time_iso_8601": "2024-01-08T20:29:22.624700Z",
"url": "https://files.pythonhosted.org/packages/7e/d8/6c0ce2562b41f6411188fa392c7e462c2e00146557fc65dcafb8d144e7ae/dotem-0.1.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "b5e53c12dd1be9711a6c4479cb48945ab5668434626f1c6ac7eee18c7715fbcd",
"md5": "616ec367b99a257d144eb856dc141fdf",
"sha256": "ce3e667c35046765c767661bfbac071df371165434bdef26a5141e45785b1c96"
},
"downloads": -1,
"filename": "dotem-0.1.1.tar.gz",
"has_sig": false,
"md5_digest": "616ec367b99a257d144eb856dc141fdf",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8,<4.0",
"size": 5107,
"upload_time": "2024-01-08T20:29:24",
"upload_time_iso_8601": "2024-01-08T20:29:24.216319Z",
"url": "https://files.pythonhosted.org/packages/b5/e5/3c12dd1be9711a6c4479cb48945ab5668434626f1c6ac7eee18c7715fbcd/dotem-0.1.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-01-08 20:29:24",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "hanhwanglim",
"github_project": "dotem",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "dotem"
}