https://github.com/andrie/py-config
config package for python
https://github.com/andrie/py-config
Last synced: about 1 month ago
JSON representation
config package for python
- Host: GitHub
- URL: https://github.com/andrie/py-config
- Owner: andrie
- License: mit
- Created: 2023-05-13T18:16:06.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2024-02-16T11:18:28.000Z (over 1 year ago)
- Last Synced: 2025-02-14T13:16:57.278Z (3 months ago)
- Language: Python
- Homepage: https://andrie.github.io/py-config/
- Size: 3.49 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.ipynb
- License: LICENSE
Awesome Lists containing this project
README
{
"cells": [
{
"cell_type": "raw",
"metadata": {},
"source": [
"---\n",
"format: gfm\n",
"---"
],
"id": "f97014cc"
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# config\n",
"\n",
"The `config` package makes it easy to manage environment specific\n",
"configuration values. For example, you might want to use distinct values\n",
"for development, testing, and production environments.\n",
"\n",
"## Installation\n",
"\n",
"The package is not yet available on PyPI, but you can install it from GitHub:\n",
"\n",
"``` sh\n",
"pip install git+https://github.com/andrie/py-config\n",
"```\n",
"\n",
"Tip: add this to your `requirements.txt` file:\n",
"\n",
"``` sh\n",
"config @ git+https://github.com/andrie/py-config\n",
"```\n",
"\n",
"And then use `pip install -r requirements.txt` to install the package.\n",
"\n",
"## How to use\n",
"\n",
"Given this `config.yaml` file:\n",
"\n",
"``` yaml\n",
"default:\n",
" trials: 5\n",
" dataset: \"data-sampled.csv\"\n",
" \n",
"production:\n",
" trials: 30\n",
" dataset: \"data.csv\"\n",
"```\n",
"\n",
"You can read the config file:\n"
],
"id": "63b042b7"
},
{
"cell_type": "code",
"metadata": {},
"source": [
"import config.core as config"
],
"id": "c08d8cac",
"execution_count": null,
"outputs": []
},
{
"cell_type": "code",
"metadata": {},
"source": [
"config.config_get('trials')"
],
"id": "bdfb6cc4",
"execution_count": null,
"outputs": []
},
{
"cell_type": "code",
"metadata": {},
"source": [
"config.config_get('trials', 'production')"
],
"id": "36074cbd",
"execution_count": null,
"outputs": []
}
],
"metadata": {
"kernelspec": {
"name": "python3",
"language": "python",
"display_name": "Python 3 (ipykernel)"
}
},
"nbformat": 4,
"nbformat_minor": 5
}