Python Projects Configuration Manager
Project description
Myconfig
Quick start
Install
pip install myconfig
Initialize Myconfig on project root directory
cd project/path/
myconfig -i json
Configuring your Python project environment...
File settings.py was created.
The settings.json file was created to hold public settings and .secrets.json file was created to hold private settings.
Also .secrets.json was added to .gitignore.
You can also use other formats: myconfig -i <format> (json | yaml | toml)
Using Myconfig
Add to settings.json
common project settings:
{
"username": "admin",
"ips": ["127.0.0.1", "198.*.*.*"],
"database": {
"name": "database_name",
"port": 5555
}
}
Or put private settings in .secrets.json
:
{
"database": {
"password": 53156
}
}
Import the config
object from settings.py
in your code
from settings import config
print(config.username)
print(config.database.name)
print(config.database.password)
File
settings.py
from myconfig import MyConfig config = MyConfig(['settings.json', '.secrets.json'])You can also only take variables from the .env file: myconfig -i
from myconfig import MyConfig config = MyConfig()
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
myconfig-0.2.9.tar.gz
(5.4 kB
view details)
Built Distribution
File details
Details for the file myconfig-0.2.9.tar.gz
.
File metadata
- Download URL: myconfig-0.2.9.tar.gz
- Upload date:
- Size: 5.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.9.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9b7960d4c47109592da13209cfd8d362a5aff970f1221ff12692615ab80b38fd |
|
MD5 | 9a16871248953cb20dfcac974d204526 |
|
BLAKE2b-256 | 681b58d2231182827e75a6e95337d155b556cb97851342642305ecf7e03a709f |
File details
Details for the file myconfig-0.2.9-py3-none-any.whl
.
File metadata
- Download URL: myconfig-0.2.9-py3-none-any.whl
- Upload date:
- Size: 6.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.9.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | afc7554e221e197ff1487508357a5ad09f136c7d9077ac0ddebe886f3bcdb95b |
|
MD5 | 52b6b6dc57cbe68f1263382173b2e9fc |
|
BLAKE2b-256 | 965c342f45dccd3590493ffd137ee116684ab798618a67f218d4a98f583c9fa2 |