| Name | pyconman JSON |
| Version |
1.0.1
JSON |
| download |
| home_page | https://mahajanankur.github.io |
| Summary | Package for managing and profiling JSON configurations in Python-based libraries and web applications. |
| upload_time | 2023-03-14 10:28:48 |
| maintainer | |
| docs_url | None |
| author | Ankur Mahajan |
| requires_python | >= 3 |
| license | Apache License |
| keywords |
|
| VCS |
|
| bugtrack_url |
|
| requirements |
No requirements were recorded.
|
| Travis-CI |
No Travis.
|
| coveralls test coverage |
No coveralls.
|
# Pyconman
[](https://badge.fury.io/py/pyconman)


[](https://github.com/mahajanankur/pyconman-py/blob/main/LICENSE)
[](https://pepy.tech/project/pyconman)
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](https://www.python.org/) 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.
```sh
python3 -m venv .venv && source .venv/bin/activate
```
To use pyconman, you can install it using pip by running the command.
```sh
$ 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:**
```json
{
"database": {
"host": "localhost",
"port": 5432,
"username": "dbuser",
"password": "dbpassword",
"database_name": "mydb"
},
"api_key": "1234567890",
"log_level": "debug"
}
```
**production.json:**
```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`:
```python
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**
Raw data
{
"_id": null,
"home_page": "https://mahajanankur.github.io",
"name": "pyconman",
"maintainer": "",
"docs_url": null,
"requires_python": ">= 3",
"maintainer_email": "",
"keywords": "",
"author": "Ankur Mahajan",
"author_email": "mahajanankur.nith@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/86/b9/e37532af3dfc8b1237efe2d0658d299302cd600d59cae11be1bfb64a7908/pyconman-1.0.1.tar.gz",
"platform": null,
"description": "# Pyconman\n[](https://badge.fury.io/py/pyconman)\n\n\n[](https://github.com/mahajanankur/pyconman-py/blob/main/LICENSE)\n[](https://pepy.tech/project/pyconman)\n\nPyconman 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.\n\n- **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.\n\n- **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.\n\n- **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.\n\n- **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.\n\n### Installation\n\nPyconman requires [Python](https://www.python.org/) to run.\n\nOnce 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.\n```sh\npython3 -m venv .venv && source .venv/bin/activate \n```\nTo use pyconman, you can install it using pip by running the command.\n```sh\n$ pip install pyconman\n```\n\n## Usage\nNext, 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.\n\nHere are two sample JSON configurations that you can use with the Pyconman package:\n\n**default.json:**\n```json\n{\n \"database\": {\n \"host\": \"localhost\",\n \"port\": 5432,\n \"username\": \"dbuser\",\n \"password\": \"dbpassword\",\n \"database_name\": \"mydb\"\n },\n \"api_key\": \"1234567890\",\n \"log_level\": \"debug\"\n}\n```\n**production.json:**\n\n```json\n{\n \"database\": {\n \"host\": \"prod-db-host\",\n \"username\": \"prod-db-user\",\n \"password\": \"prod-db-password\",\n \"props\": {\n \"timeout\": 10000,\n \"trans\": 100\n }\n }\n}\n```\n\nTo 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`:\n```python\nfrom pyconman import ConfigLoader\n\n# Load the configuration in the application scope.\nconfig = ConfigLoader.get_config()\nprop_1 = config.get(\"prop_1\")\n\n# Access nested JSON properties\nprop_n = config[\"prop_1\"][\"prop_2\"][\"prop_n\"]\n```\n\n---\nLicense\n----\n**Apache 2.0**",
"bugtrack_url": null,
"license": "Apache License",
"summary": "Package for managing and profiling JSON configurations in Python-based libraries and web applications.",
"version": "1.0.1",
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "86b9e37532af3dfc8b1237efe2d0658d299302cd600d59cae11be1bfb64a7908",
"md5": "3580e954a853382735a92f17ab542764",
"sha256": "67f0d78cfb812fe3383455bafda94b1484899f92996713aab03ca2c152c968ca"
},
"downloads": -1,
"filename": "pyconman-1.0.1.tar.gz",
"has_sig": false,
"md5_digest": "3580e954a853382735a92f17ab542764",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">= 3",
"size": 4005,
"upload_time": "2023-03-14T10:28:48",
"upload_time_iso_8601": "2023-03-14T10:28:48.010309Z",
"url": "https://files.pythonhosted.org/packages/86/b9/e37532af3dfc8b1237efe2d0658d299302cd600d59cae11be1bfb64a7908/pyconman-1.0.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-03-14 10:28:48",
"github": false,
"gitlab": false,
"bitbucket": false,
"lcname": "pyconman"
}