Remote env for python
Project description
pyremoteenv
pyremoteenv is a Python package that allows you to configure your application with environment variables loaded from a remote registry.
Currently, the supported backend is ZooKeeper, but it's easy to extend to support other backends.
Installation
Install pyremoteenv using pip:
pip install pyremoteenv
The only supported backend is ZooKeeper. Install dependencies for it
pip install pyremoteenv[zk]
Requirements
- Python 3.9+
- kazoo - For ZooKeeper support.
Usage
import os
import remoteenv
remote_env = remoteenv.Env('zk')
with remote_env:
# Write to remote config
remote_env.set('TEST', 'test')
# Read from remote config and set environment variables
remote_env.read_to_os()
print(os.environ['TEST'])
# Read from remote config and write to django-environ
remote_env.read_to_file(file=buffer)
environ.Env.read_env(buffer, overwrite=True)
remote_env.delete('TEST')
# Use znodes tree to find custom or default variable from remote config
remote_env.get('DATABASE_HOST')
remote_env.get('service_1/host_4/DATABASE_HOST')
remote_env.read_to_os('service_1', 'service_1/host_4')
More examples can be found in the examples.
TODO
- More backends: plain text, json, firebase
- Watching mechanism to interact or inject new values immediately on change
Contributing
Contributions are welcome! If you'd like to enhance the functionality or fix issues, kindly follow these steps:
- Fork the repository on GitHub.
- Clone your fork:
git clone https://github.com/Romamo/pyremoteenv.git
- Make your changes and test them.
- Submit a pull request.
License
This project is licensed under the MIT License. See the LICENSE file for more details.
Support
If you encounter any issues or have questions, feel free to open an issue on the GitHub Issues Page.
Happy coding! 🚀
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pyremoteenv-0.2.5.tar.gz.
File metadata
- Download URL: pyremoteenv-0.2.5.tar.gz
- Upload date:
- Size: 7.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.9.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
670ec3fe2d90b4d03924d794fae7bcb59fddcccd81b2ba44a60ec4098b6516ae
|
|
| MD5 |
6d3e6887305e941d9c7cf2c0cfc5827d
|
|
| BLAKE2b-256 |
71356da3640e19385cb1423f63123c6f4c10add22026f1286a96b6330d15bb9f
|
File details
Details for the file pyremoteenv-0.2.5-py3-none-any.whl.
File metadata
- Download URL: pyremoteenv-0.2.5-py3-none-any.whl
- Upload date:
- Size: 8.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.9.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
67b6a4c99ac1b303393a62e7a61fb9d5b29e0bb8e911b425a5ac84037d9a396c
|
|
| MD5 |
97139b868f4cc813c12bfd1d2d262744
|
|
| BLAKE2b-256 |
8ce6d81130e7cc72bb1d13069d7bf0120e8be4346fb9ea9dd237db9a254e175d
|