Yamlen - a Thin PyYAML Wrapper
Features
- Contextual tag construction.
Examples
Create a Loader
>>> from yamlen import Loader
>>> loader = Loader()
Load YAML documents in Streams
>>> from io import StringIO
>>> stream = StringIO("foo")
>>> loader.load(stream)
'foo'
>>> stream = StringIO("foo\n---\nbar")
>>> list(loader.load_all(stream))
['foo', 'bar']
Load YAML Documents in Files.
>>> import os
>>> from tempfile import TemporaryDirectory
>>> with TemporaryDirectory() as dir_path:
... path = os.path.join(dir_path, "example.yml")
... with open(path, "w") as f:
... _ = f.write("foo")
... loader.load_from_path(path)
'foo'
>>> with TemporaryDirectory() as dir_path:
... path = os.path.join(dir_path, "example.yml")
... with open(path, "w") as f:
... _ = f.write("foo\n---\nbar")
... list(loader.load_all_from_path(path))
['foo', 'bar']
Contextual tag construction: include another YAML file.
>>> from yamlen.tag.impl.inclusion import InclusionTag
>>> loader.add_tag("!include", InclusionTag())
>>> with TemporaryDirectory() as dir_path:
... foo_path = os.path.join(dir_path, "foo.yml")
... bar_path = os.path.join(dir_path, "bar.yml")
... with open(foo_path, "w") as f:
... _ = f.write(f"!include ./bar.yml")
... with open(bar_path, "w") as f:
... _ = f.write("bar")
... loader.load_from_path(foo_path)
'bar'
License
Copyright (c) 2021 Yu Mochizuki
Metadata
Release files for yamlen 0.2.0
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 |
|---|---|---|---|---|
| yamlen-0.2.0.tar.gz | 4.8 kB | Without provenance | Details for yamlen-0.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| yamlen-0.2.0-py3-none-any.whl | Python 3 | none | any | Details for yamlen-0.2.0-py3-none-any.whl |
Total release size: 10.2 kB
Release files / yamlen-0.2.0.tar.gz
| Download URL | yamlen-0.2.0.tar.gz |
|---|---|
| Size | 4.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
39ffed8d817adb6a80d5e4ad3e87b2e4bb4952011ec67331594b5c2be21a3355
|
|
BLAKE2b-256 checksum How to use checksums |
83f7d7278470d518366207c7c8cb934e45ae6e37840e8f33b55cbe422985b6e4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.1.11 CPython/3.7.12 Linux/4.15.0-1110-aws
|
Release files / yamlen-0.2.0-py3-none-any.whl
| Download URL | yamlen-0.2.0-py3-none-any.whl |
|---|---|
| Size | 5.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
001f59e11b5bfeb6b816d89b92f7748d7407b015f2a0d53bb0148e27926f5fdd
|
|
BLAKE2b-256 checksum How to use checksums |
edb8366931dbce869ff5ad52285dfc3a7fbad1a6ef512ce16a89dd687d2539bc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.1.11 CPython/3.7.12 Linux/4.15.0-1110-aws
|
Security for yamlen 0.2.0
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.