dotenv
A minimal module for working with dotenv files.
Examples
>>> from dotenv import load_dotenv, getenv
>>> load_dotenv()
Load the dotenv file from .env. If any error occurs, nothing will happen.
However, if the value is being retrieved from a load_dotenv() call:
>>> env = load_dotenv()
>>> print(env) # `None` if all is alright.
>>> print(env) # In case of `Exception`, Houston, we have a problem.
>>> load_dotenv(verbose=True)
In this case, if there's an exception, the function will raise it.
>>> key: str = getenv("API_KEY")
getenv() returns the value from the environment by the key if it exists.
If the key doesn't exist, getenv() will raise a KeyError.
To avoid this exception:
>>> max_connections: Union[str, int] = getenv("MAX_CONNECTIONS", default=100)
You can pass any value as the default argument, which prevents the exception!
However, as you can see, max_connections might be str, which could be problematic.
To avoid this, getenv() provides a way to cast the result:
>>> max_connections: int = getenv("MAX_CONNECTIONS", into=int)
Now max_connections will be of type int.
Installation
> pip install git+https://github.com/stefanlight8/dotenv
Requirements
- Python 3.6<
Metadata
Release files for minenv 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| minenv-0.1.0.tar.gz | 4.2 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| minenv-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 9.0 kB
Release files / minenv-0.1.0.tar.gz
| Download URL | minenv-0.1.0.tar.gz |
|---|---|
| Size | 4.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ed3b7426ff7272c689241e836a2771eb85783d37a075cffecbb4eec5cc9e85bf
|
|
BLAKE2b-256 checksum How to use checksums |
e52604ad85af412942cf188aaa53cee750db7a0e69932018ed3a20c02969b406
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.5.2
|
Release files / minenv-0.1.0-py3-none-any.whl
| Download URL | minenv-0.1.0-py3-none-any.whl |
|---|---|
| Size | 4.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f7079f5903a93f3351e851e4a34dd666c626e7f41f8717783fdc4d0af81cd012
|
|
BLAKE2b-256 checksum How to use checksums |
678247034b5edc0bff509e1ed1370bedc9915adc779eca93ce2fe12685d0a8b6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.5.2
|
Security for minenv 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.