Skip to main content

yamole

Build Status PyPI package

Dig through the JSON references inside a YAML file, the kind of situation you may run into when parsing OpenAPI files.

The result is a single, big YAML file with all the references resolved (i.e. with their contents replaced in the corresponding places).

yamole also includes small features that help you parse OpenAPI files, like combining all the elements in an allOf key into a single object.

Installation

yamole is available as a PyPI module, so you can install it using pip:

$ pip install yamole

Usage

Using yamole is pretty straightforward. The parser is available through the YamoleParser class:

with open('input_file.yaml') as file:
    parser = YamoleParser(file,
        merge_allof=False,  # Combine allOfs into single dicts and disable
                            # inheritance for "example" keys (def: True)
        max_depth=314)  # Allow a maximum of 314 nesting levels (def: 1000)

output_str = parser.dumps()

parser.data['some-key']  # The dict with the parsed file's structure

Testing

To test that yamole works properly, you can run:

$ pip install -r requirements.txt
$ python tests/test.py

This will run the parser against a specific test case that makes use of all of yamole's features, and will compare the result with a fixture (tests/expected.yaml).


(c) 2018 Yago González. All rights reserved

Metadata

Release files for yamole 2.1.7

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for yamole 2.1.7
File Size Uploaded Provenance Actions
yamole-2.1.7.tar.gz 4.5 kB Without provenance Details for yamole-2.1.7.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for yamole 2.1.7
File Interpreter ABI Platform Actions
yamole-2.1.7-py3-none-any.whl Python 3 none any Details for yamole-2.1.7-py3-none-any.whl

Total release size: 9.1 kB

Release files / yamole-2.1.7.tar.gz

Download URL yamole-2.1.7.tar.gz
Size 4.5 kB
Tags Source
SHA-256 checksum
How to use checksums
cd37040d1b396d58ac5bd9864999b98700d37156b2e65d9498486874aee38fda
BLAKE2b-256 checksum
How to use checksums
ce4888002005a87b6ceeab41cab0cb3db2634acfdca81be317cac19052ee4f36
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.12.1 pkginfo/1.4.2 requests/2.21.0 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.3

Release files / yamole-2.1.7-py3-none-any.whl

Download URL yamole-2.1.7-py3-none-any.whl
Size 4.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f491345f18e9d4133eed196166136144e92bb4bad83e60d44ce5754adf130a36
BLAKE2b-256 checksum
How to use checksums
5a33f73c440c55ee3de59dd73eabcdd0b61a3a76d1d16b3e461bef4240af0188
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.12.1 pkginfo/1.4.2 requests/2.21.0 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.3

Security for yamole 2.1.7

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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page