Skip to main content

Package for managing and profiling JSON configurations in Python-based libraries and web applications.

Project description

Pyconman

PyPI PyPI - Status PyPI - Python Version License Downloads

Pyconman is a useful package for managing JSON configurations in Python-based applications. The package provides a system for managing different configurations for different environments, making it easier to handle secure and critical configurations.

  • Environment-specific configurations: Pyconman allows you to manage different configurations for different environments (e.g., development, staging, production), making it easier to handle environment-specific configurations.

  • Simpler configuration management: Pyconman provides a simple and convenient way to manage and access configurations in your Python code, without having to write custom code for handling different configurations.

  • Security: Pyconman helps you manage secure and critical configurations by allowing you to store sensitive information (e.g., API keys, passwords) in a separate configuration file that is not checked into source control.

  • Easy to use: Pyconman is easy to use and requires minimal setup, making it a great choice for developers who want a simple and reliable way to manage configurations in their Python applications.

Installation

Pyconman requires Python to run.

Once installed, you can create a Python virtual environment by running the command in your project directory. This will create a virtual environment and activate it.

python3 -m venv .venv && source .venv/bin/activate 

To use pyconman, you can install it using pip by running the command.

$ pip install pyconman

Usage

Next, create a folder called configs in your project root directory, and create a file called default.json in it. This file will contain the default configuration properties for your application. If you want to use a different environment, you can pass that environment's name in the ENV variable to override the specific properties for that environment. Please look in the example folder for further information.

Here are two sample JSON configurations that you can use with the Pyconman package:

default.json:

{
    "database": {
        "host": "localhost",
        "port": 5432,
        "username": "dbuser",
        "password": "dbpassword",
        "database_name": "mydb"
    },
    "api_key": "1234567890",
    "log_level": "debug"
}

production.json:

{
    "database": {
        "host": "prod-db-host",
        "username": "prod-db-user",
        "password": "prod-db-password",
        "props": {
            "timeout": 10000,
            "trans": 100
        }
    }
}

To load the configuration in your application, you can use the ConfigLoader class provided by pyconman. Here's an example of how you can use it test.py:

from pyconman import ConfigLoader

# Load the configuration in the application scope.
config = ConfigLoader.get_config()
prop_1 = config.get("prop_1")

# Access nested JSON properties
prop_n = config["prop_1"]["prop_2"]["prop_n"]

License

Apache 2.0

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

pyconman-1.0.1.tar.gz (4.0 kB view details)

Uploaded Source

File details

Details for the file pyconman-1.0.1.tar.gz.

File metadata

  • Download URL: pyconman-1.0.1.tar.gz
  • Upload date:
  • Size: 4.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.8.9

File hashes

Hashes for pyconman-1.0.1.tar.gz
Algorithm Hash digest
SHA256 67f0d78cfb812fe3383455bafda94b1484899f92996713aab03ca2c152c968ca
MD5 3580e954a853382735a92f17ab542764
BLAKE2b-256 86b9e37532af3dfc8b1237efe2d0658d299302cd600d59cae11be1bfb64a7908

See more details on using hashes here.

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