configjs
configjs is a Python package designed to simplify the process of reading and accessing configuration settings stored in a JSON file. With configjs, you can effortlessly load a "config.json" file from the working directory and access its contents using the package name as attributes.
Installation
Install configjs using pip:
pip install configjs
Usage
- Create a "config.json" file in your project's working directory with the desired configuration settings in JSON format:
{
"database": {
"host": "localhost",
"port": 5432,
"username": "user",
"password": "secret"
},
"api_key": "your_api_key"
}
- Import and use configjs in your Python code:
from configjs import Config
# Load the "config.json" file
config = Config()
# Access configuration settings using the package name as attributes
db_host = config.database.host
db_port = config.database.port
db_username = config.database.username
db_password = config.database.password
api_key = config.api_key
print(f"Database Host: {db_host}")
print(f"Database Port: {db_port}")
print(f"Database Username: {db_username}")
print(f"Database Password: {db_password}")
print(f"API Key: {api_key}")
- Replace the attribute names (database, host, port, username, password, api_key) with your actual configuration structure.
Notes
configjs assumes that the "config.json" file is in the working directory. The package name itself (config) is used as the top-level attribute to access the configuration settings. Feel free to customize "config.json" based on your project's needs and easily manage your configuration settings using configjs.
Metadata
Release files for configjs 0.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| configjs-0.1.2.tar.gz | 3.7 kB | Without provenance | Details for configjs-0.1.2.tar.gz |
Release files / configjs-0.1.2.tar.gz
| Download URL | configjs-0.1.2.tar.gz |
|---|---|
| Size | 3.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d59246918c42680b15484d84070a36a71a09f6b1435f61c684e76984c72750da
|
|
BLAKE2b-256 checksum How to use checksums |
3250a9ddae8424cf6bec2ea2020523ee9cebec1b9c0c3f2c4bf743a23059eae9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.6
|
Security for configjs 0.1.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.