python-lenv
Welcome to the lenv package page! This package allows you to quickly, efficiently and conveniently load environment variables into a class!
Features
- Loading environment variables into class variables by variable name
- Configuring the loading of changes using a variable of class
meta
Installation
You can use your favorite package manager to install/update the lenv package. For example, pip, as in this example:
python3 -m pip install -U python-lenv
Usage/Examples
dotenv
First of all, let's define our .env file, which will be located in the startup directory of the main file.
I put the TOKEN and API_KEY there, in the future we will be able to get them through class variables
TOKEN=FOlCLYqcM.ZRgpwq.IrUyWYwjwSvFmCITCbmOBqvbqpZLWNrufvQKsrawplHMAwICSjBJvSlkJFaeENCrYkdOUeqSwmwQoMbTEJLLFLIGDLXaWF.HsNqciQnXitjhzXO
API_KEY=a3edffac-f4cc-4e68-9fd3-11e942fc7ea6
python
Finally, we come to our first example. We can use class variables to get environment variables directly through the class.
import lenv
class Config(lenv.EnvironmentLoader):
# This configuration is not important, the default is used `lenv.DefaultMetadata`
# which has a file path like .env in it. But for example, let's leave it
meta = lenv.ConfigurableMetadata(dotenv_path=".env")
# These class variables will be used directly to access environment variables -O-
TOKEN: str
API_KEY: str
assert Config.TOKEN == 'FOlCLYqcM.ZRgpwq.IrUyWYwjwSvFmCITCbmOBqvbqpZLWNrufvQKsrawplHMAwICSjBJvSlkJFaeENCrYkdOUeqSwmwQoMbTEJLLFLIGDLXaWF.HsNqciQnXitjhzXO'
assert Config.API_KEY == 'a3edffac-f4cc-4e68-9fd3-11e942fc7ea6'
License
lenv is distributed under the terms of the MIT license.
Metadata
Release files for python-lenv 0.5.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 | Actions |
|---|---|---|---|---|
| python_lenv-0.5.0.tar.gz | 5.0 kB | Without provenance | Details for python_lenv-0.5.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| python_lenv-0.5.0-py3-none-any.whl | Python 3 | none | any | Details for python_lenv-0.5.0-py3-none-any.whl |
Total release size: 11.3 kB
Release files / python_lenv-0.5.0.tar.gz
| Download URL | python_lenv-0.5.0.tar.gz |
|---|---|
| Size | 5.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3de753d6e1654d54147508e701deef81e1480754006349bd975da3456050b809
|
|
BLAKE2b-256 checksum How to use checksums |
0b2927e040f62d55a9258548288916f79e35e067c70508d21367a06226b8a3bb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.9.19
|
Release files / python_lenv-0.5.0-py3-none-any.whl
| Download URL | python_lenv-0.5.0-py3-none-any.whl |
|---|---|
| Size | 6.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ad97638d47df0a5603511b7407d8dc8c0acf35b921cf18d04f4bdaeca66b9b6c
|
|
BLAKE2b-256 checksum How to use checksums |
bfca5a3b97140dc7d8c751727805380b6b14df050d6802bf840901d9b8d3616e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.9.19
|
Security for python-lenv 0.5.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.