oot


Nameoot JSON
Version 0.1.0.3 PyPI version JSON
download
home_page
SummaryOrder of the Template: A Python package for parsing Jinja templates and YAML files with environment variables.
upload_time2023-07-31 11:16:21
maintainer
docs_urlNone
authorElsayed91
requires_python>=3.9,<4.0
licenseMIT
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Order of the Template (OOT)

In the sacred halls of Dev, the Order of the Template (OOT) stands as a bastion of structure and order amidst the chaos. The order, founded by the ancients, carries the mission of maintaining harmony between variables and templates, ensuring every template adheres to its rightful structure, and bringing light to the shadowy corners of Jinja and YAML.

The Order of the Template provides a noble toolkit for Python developers, aiding them in their quests to parse YAML files and Jinja templates, resolve environment variables, and validate schemas.

## The Code of the Order
### A Noble Quest

The Templars are trained not only in the ancient art of parsing Jinja templates but also in the mastery of environments, skillfully resolving environment variables. They are the keepers of schemas, using their wisdom to ensure that data structures adhere to their rightful schemas.

Consider a quest where a Templar must decode an ancient manuscript, a YAML file filled with Jinja templates and environment variables:

```yaml
# manuscript.yaml
Templar: {{ TEMPLAR_NAME|default('Unknown Templar') }}
HallOfHonor: ${HALL_OF_HONOR:"Hall of the Wicked"}
```
The Templar starts his task. He replaces the `TEMPLAR_NAME` variable with the name of a famous Templar. He then resolves the `HALL_OF_HONOR` environment variable, revealing the name of the sacred hall. Once the manuscript has been decoded, he validates it, ensuring it adheres to the ancient schema:

```python
from oot import parse_file

file_path = "manuscript.yaml"
variables = {"TEMPLAR_NAME": "Jacques de Molay"}
os.environ["HALL_OF_HONOR"] = "Hall of the Brave" # Environmental variables will be automatically substituted

# The Templar decodes the manuscript
manuscript = parse_file(file_path, context=variables)

# The manuscript is decoded:
assert manuscript == {"Templar": "Jacques de Molay", "HallOfHonor": "Hall of the Brave"}

# The Templar validates the manuscript against the ancient schema
schema_path = "schema.json"
manuscript = parse_file(file_path, context=variables, validation_schema=schema_path)
```

In the above example, `schema.json` might be a JSON schema file that defines the structure of the decoded manuscript:

```json
{
    "type": "object",
    "properties": {
        "Templar": {"type": "string"},
        "HallOfHonor": {"type": "string"}
    }
}
```

## Joining the Order

The Order welcomes all who seek order in their templates and harmony in their variables. To install the Order's toolkit, simple run:

```bash
pip install oot
```

May the Order guide you in your quests. 


## Closing Words

- OOT was born out of the re-occuring necessity to parse Jinja templates and resolve environment variables across multiple projects.
- To separate concerns, enhance productivity and spare myself the need to setup code and tests within each project, I encapsulated the functionality.
- OOT's primary objective is to painlessly handle the resolution of environmental variables and/or templating in your YAML files. 
- I came up with the name and theme. the README is a glorious work of `ChatGPT`.
            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "oot",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.9,<4.0",
    "maintainer_email": "",
    "keywords": "",
    "author": "Elsayed91",
    "author_email": "elsayed.is@outlook.com",
    "download_url": "https://files.pythonhosted.org/packages/b8/bb/f62055ec866e06162641e53d64f1298908d1542f2a0cccdf254631c32d44/oot-0.1.0.3.tar.gz",
    "platform": null,
    "description": "# Order of the Template (OOT)\n\nIn the sacred halls of Dev, the Order of the Template (OOT) stands as a bastion of structure and order amidst the chaos. The order, founded by the ancients, carries the mission of maintaining harmony between variables and templates, ensuring every template adheres to its rightful structure, and bringing light to the shadowy corners of Jinja and YAML.\n\nThe Order of the Template provides a noble toolkit for Python developers, aiding them in their quests to parse YAML files and Jinja templates, resolve environment variables, and validate schemas.\n\n## The Code of the Order\n### A Noble Quest\n\nThe Templars are trained not only in the ancient art of parsing Jinja templates but also in the mastery of environments, skillfully resolving environment variables. They are the keepers of schemas, using their wisdom to ensure that data structures adhere to their rightful schemas.\n\nConsider a quest where a Templar must decode an ancient manuscript, a YAML file filled with Jinja templates and environment variables:\n\n```yaml\n# manuscript.yaml\nTemplar: {{ TEMPLAR_NAME|default('Unknown Templar') }}\nHallOfHonor: ${HALL_OF_HONOR:\"Hall of the Wicked\"}\n```\nThe Templar starts his task. He replaces the `TEMPLAR_NAME` variable with the name of a famous Templar. He then resolves the `HALL_OF_HONOR` environment variable, revealing the name of the sacred hall. Once the manuscript has been decoded, he validates it, ensuring it adheres to the ancient schema:\n\n```python\nfrom oot import parse_file\n\nfile_path = \"manuscript.yaml\"\nvariables = {\"TEMPLAR_NAME\": \"Jacques de Molay\"}\nos.environ[\"HALL_OF_HONOR\"] = \"Hall of the Brave\" # Environmental variables will be automatically substituted\n\n# The Templar decodes the manuscript\nmanuscript = parse_file(file_path, context=variables)\n\n# The manuscript is decoded:\nassert manuscript == {\"Templar\": \"Jacques de Molay\", \"HallOfHonor\": \"Hall of the Brave\"}\n\n# The Templar validates the manuscript against the ancient schema\nschema_path = \"schema.json\"\nmanuscript = parse_file(file_path, context=variables, validation_schema=schema_path)\n```\n\nIn the above example, `schema.json` might be a JSON schema file that defines the structure of the decoded manuscript:\n\n```json\n{\n    \"type\": \"object\",\n    \"properties\": {\n        \"Templar\": {\"type\": \"string\"},\n        \"HallOfHonor\": {\"type\": \"string\"}\n    }\n}\n```\n\n## Joining the Order\n\nThe Order welcomes all who seek order in their templates and harmony in their variables. To install the Order's toolkit, simple run:\n\n```bash\npip install oot\n```\n\nMay the Order guide you in your quests. \n\n\n## Closing Words\n\n- OOT was born out of the re-occuring necessity to parse Jinja templates and resolve environment variables across multiple projects.\n- To separate concerns, enhance productivity and spare myself the need to setup code and tests within each project, I encapsulated the functionality.\n- OOT's primary objective is to painlessly handle the resolution of environmental variables and/or templating in your YAML files. \n- I came up with the name and theme. the README is a glorious work of `ChatGPT`.",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Order of the Template: A Python package for parsing Jinja templates and YAML files with environment variables.",
    "version": "0.1.0.3",
    "project_urls": null,
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "bad14e1e116d0726641daf1f67736d44b908c058f981d7fad786c7f88e3faf11",
                "md5": "7bc5755abcf614e96e7b17e1ea7f8c9e",
                "sha256": "c48a655e400b0173c7b1097ab4b96c044c120818aa8e89d1d2868e77256f325d"
            },
            "downloads": -1,
            "filename": "oot-0.1.0.3-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "7bc5755abcf614e96e7b17e1ea7f8c9e",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9,<4.0",
            "size": 7184,
            "upload_time": "2023-07-31T11:16:20",
            "upload_time_iso_8601": "2023-07-31T11:16:20.196778Z",
            "url": "https://files.pythonhosted.org/packages/ba/d1/4e1e116d0726641daf1f67736d44b908c058f981d7fad786c7f88e3faf11/oot-0.1.0.3-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "b8bbf62055ec866e06162641e53d64f1298908d1542f2a0cccdf254631c32d44",
                "md5": "ea8c4281c178f31babb1b26032891f6a",
                "sha256": "df95a54412e7562486ba21b9f24708b663aa6d6b0a44a142a61f0a646ae10a53"
            },
            "downloads": -1,
            "filename": "oot-0.1.0.3.tar.gz",
            "has_sig": false,
            "md5_digest": "ea8c4281c178f31babb1b26032891f6a",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9,<4.0",
            "size": 5205,
            "upload_time": "2023-07-31T11:16:21",
            "upload_time_iso_8601": "2023-07-31T11:16:21.646109Z",
            "url": "https://files.pythonhosted.org/packages/b8/bb/f62055ec866e06162641e53d64f1298908d1542f2a0cccdf254631c32d44/oot-0.1.0.3.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-07-31 11:16:21",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "oot"
}
        
Elapsed time: 0.14555s