Skip to main content

Python Projects Configuration Manager

Project description

Myconfig

PyPI

PyPI Build Status PyPI PyPI - Downloads GitHub

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.*` 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:

{
    "password": 53156
}

Import the config object from settings.py in your code

from settings import config

print(config.username)
print(config.database.get('name'))

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


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.6.tar.gz (4.1 kB view hashes)

Uploaded Source

Built Distribution

myconfig-0.2.6-py3-none-any.whl (4.9 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page