Skip to main content

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

Release files for pyconman 1.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pyconman 1.0.1
File Size Uploaded
pyconman-1.0.1.tar.gz 4.0 kB Details

Release files / pyconman-1.0.1.tar.gz

Download URL pyconman-1.0.1.tar.gz
Size 4.0 kB
Tags Source
SHA-256 checksum
How to use checksums
67f0d78cfb812fe3383455bafda94b1484899f92996713aab03ca2c152c968ca
BLAKE2b-256 checksum
How to use checksums
86b9e37532af3dfc8b1237efe2d0658d299302cd600d59cae11be1bfb64a7908
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.8.9

Release history Release notifications | RSS feed

This release

1.0.1 This release

1 release file

1.0.0

1 release file

0.0.5

1 release file

0.0.4

1 release file

0.0.3

1 release file

0.0.2

1 release file

0.0.1

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page