Name | yamja JSON |
Version |
0.1.0
JSON |
| download |
home_page | None |
Summary | Opinionated library for handling yaml configuration files and jinja2 templates |
upload_time | 2024-12-22 16:47:57 |
maintainer | None |
docs_url | None |
author | None |
requires_python | >=3.12 |
license | None |
keywords |
configuration
jinja2
templates
yaml
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# Yamja
WARNING: This is pre-release software.
Yamja is an opinionated library for handling yaml configuration files and jinja2 templates - designed for configuration driven development.
It was created after I've realized that I'm repeating the same pattern in many projects. It's not big (100 lines of code) but it offers a consistent and ergonomic way to handle configuration files.
example usage:
```python
cfg = yamja.load_config("./game_v1.yaml")
character = cfg.lookup('characters.marcus')
game_prompt = cfg.render('game_prompt', character=character)
```
## Features
- Load and merge YAML configuration files
- Use Jinja2 templates within your configuration
- Support for nested configuration lookups using dot notation
- Support for jinja2 macros
## Installation
```bash
pip install yamja
```
## Usage
### Basic Configuration Loading
```python
from yamja import load_config
# Load a single configuration file
config = load_config('config.yaml')
# Access values using dot notation
value = config.lookup('section.subsection.key')
# Access with default value
value = config.lookup('section.subsection.key', default='fallback')
```
### Template Rendering
```yaml
# config.yaml
templates:
greeting: "Hello {{ name }}!"
```
```python
# Render a template with variables
greeting = config.render('greeting', name='World')
```
### Multiple Configurations
```python
from yamja import load_configs
# Load multiple config files and merge them
configs = load_configs(['config.yaml', 'default.yaml'])
```
### Including Other Config Files
```yaml
# main.yaml
include:
- common.yaml
- specific.yaml
additional_settings:
key: value
```
## Requirements
- Python >= 3.12
- Jinja2 >= 3.1.4
- PyYAML >= 6.0.2
## License
MIT License - see [LICENSE](LICENSE) for details.
## Links
- [GitHub Repository](https://github.com/mobarski/yamja)
Raw data
{
"_id": null,
"home_page": null,
"name": "yamja",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.12",
"maintainer_email": null,
"keywords": "configuration, jinja2, templates, yaml",
"author": null,
"author_email": "mobarski <mobarski@gmail.com>",
"download_url": "https://files.pythonhosted.org/packages/76/ac/47382f7ac9a31bfdde1c97ece9d88b569735ddc04852124f6ecc80d701d5/yamja-0.1.0.tar.gz",
"platform": null,
"description": "# Yamja\n\nWARNING: This is pre-release software.\n\nYamja is an opinionated library for handling yaml configuration files and jinja2 templates - designed for configuration driven development.\n\nIt was created after I've realized that I'm repeating the same pattern in many projects. It's not big (100 lines of code) but it offers a consistent and ergonomic way to handle configuration files.\n\nexample usage:\n```python\ncfg = yamja.load_config(\"./game_v1.yaml\")\ncharacter = cfg.lookup('characters.marcus')\ngame_prompt = cfg.render('game_prompt', character=character)\n```\n\n\n## Features\n\n- Load and merge YAML configuration files\n- Use Jinja2 templates within your configuration\n- Support for nested configuration lookups using dot notation\n- Support for jinja2 macros\n\n## Installation\n\n```bash\npip install yamja\n```\n\n## Usage\n\n### Basic Configuration Loading\n\n```python\nfrom yamja import load_config\n\n# Load a single configuration file\nconfig = load_config('config.yaml')\n\n# Access values using dot notation\nvalue = config.lookup('section.subsection.key')\n\n# Access with default value\nvalue = config.lookup('section.subsection.key', default='fallback')\n```\n\n### Template Rendering\n\n```yaml\n# config.yaml\ntemplates:\n greeting: \"Hello {{ name }}!\"\n```\n\n```python\n# Render a template with variables\ngreeting = config.render('greeting', name='World')\n```\n\n### Multiple Configurations\n\n```python\nfrom yamja import load_configs\n\n# Load multiple config files and merge them\nconfigs = load_configs(['config.yaml', 'default.yaml'])\n```\n\n### Including Other Config Files\n\n```yaml\n# main.yaml\ninclude:\n - common.yaml\n - specific.yaml\n\nadditional_settings:\n key: value\n```\n\n## Requirements\n\n- Python >= 3.12\n- Jinja2 >= 3.1.4\n- PyYAML >= 6.0.2\n\n## License\n\nMIT License - see [LICENSE](LICENSE) for details.\n\n## Links\n\n- [GitHub Repository](https://github.com/mobarski/yamja)\n\n",
"bugtrack_url": null,
"license": null,
"summary": "Opinionated library for handling yaml configuration files and jinja2 templates",
"version": "0.1.0",
"project_urls": {
"Bug Tracker": "https://github.com/mobarski/yamja/issues",
"Documentation": "https://github.com/mobarski/yamja#readme",
"Homepage": "https://github.com/mobarski/yamja",
"Repository": "https://github.com/mobarski/yamja.git"
},
"split_keywords": [
"configuration",
" jinja2",
" templates",
" yaml"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "7b0b5b1ab19e2b5ba8b4ff24b910030410b11a92341db66e6f4b0a916c4b4876",
"md5": "b47a94feebff8737c81f098786b24b1a",
"sha256": "a851fcc671c5e6556418da7460737c0af2d52e360f0e1de294b76a3dc963d331"
},
"downloads": -1,
"filename": "yamja-0.1.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "b47a94feebff8737c81f098786b24b1a",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.12",
"size": 4341,
"upload_time": "2024-12-22T16:47:55",
"upload_time_iso_8601": "2024-12-22T16:47:55.430339Z",
"url": "https://files.pythonhosted.org/packages/7b/0b/5b1ab19e2b5ba8b4ff24b910030410b11a92341db66e6f4b0a916c4b4876/yamja-0.1.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "76ac47382f7ac9a31bfdde1c97ece9d88b569735ddc04852124f6ecc80d701d5",
"md5": "d240dc6363a04f5c3b8a7fe7b5307fd2",
"sha256": "b682736a036d1fc540e9c449c6bd130677a1a7adbd34e079886ea800a220f896"
},
"downloads": -1,
"filename": "yamja-0.1.0.tar.gz",
"has_sig": false,
"md5_digest": "d240dc6363a04f5c3b8a7fe7b5307fd2",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.12",
"size": 11491,
"upload_time": "2024-12-22T16:47:57",
"upload_time_iso_8601": "2024-12-22T16:47:57.383569Z",
"url": "https://files.pythonhosted.org/packages/76/ac/47382f7ac9a31bfdde1c97ece9d88b569735ddc04852124f6ecc80d701d5/yamja-0.1.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-12-22 16:47:57",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "mobarski",
"github_project": "yamja",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "yamja"
}