ruamel_yaml_line_info
Line information for ruamel.yaml.
Quick Start
Using an Alternative Constructor
Instead of:
with open(yaml_path, encoding="utf-8") as fh:
yaml = ruamel.yaml.YAML(typ="rt").load("".join(fh))
change the import:
with open(yaml_path, encoding="utf-8") as fh:
yaml = ruamel_yaml_line_info.YAML(typ="rt").load("".join(fh))
and voila!
Example
Consider the following YAML:
foo: bar
block: >
this is not
a multiline
block
single_quote: 'single'
double_quote: "double"
then we can get line and column information with
>>> with open(yaml_path, encoding="utf-8") as fh:
yaml = ruamel_yaml_line_info.YAML(typ="rt").load("".join(fh))
>>> print(yaml["foo"].lc)
LineCol(0, 5)
>>> print(yaml["block"].lc)
LineCol(1, 7)
>>> print(yaml["single_quote"].lc)
LineCol(5, 14)
>>> print(yaml["double_quote"].lc)
LineCol(6, 14)
where the first value in LineCol is the 0-based line, and the second value in LineCol is the 0-based column.
See the test for more exapmles.
Patching an existing YAML object
If you already have a ruamel.yaml.YAML instance, you can add line
numbers with:
with open(yaml_path, encoding="utf-8") as fh:
yaml = ruamel.yaml.YAML(typ="rt").load("".join(fh))
yaml = ruamel_yaml_line_info.YAML.with_line_numbers(yaml=yaml)
Recommended Installation
Install the Python package and dependency management tool poetry using official documentation.
You must have Python 3.11 or greater available on your system path, which could be managed by mamba, pyenv, or another package manager.
Finally, install the dependencies of the project with:
poetry install
To check successful installation, run:
python -c "import ruamel_yaml_line_info"
Installing with Conda
Install the environment manager mamba using official documentation.
Create and activate a conda environment with Python 3.11 or greater:
mamba create -c conda-forge -n ruamel_yaml_line_info ruamel-yaml-line-info python=3.11
mamba activate ruamel_yaml_line_info
Alternatively, install into an existing conda environment:
mamba install -n <ENVIRONMENT> -c conda-forge ruamel-yaml-line-info
To check successful installation, run:
python -c "import ruamel_yaml_line_info"
Development and Testing
See the contributing guide for more information.
Metadata
Release files for ruamel-yaml-line-info 0.1.4
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 |
|---|---|---|---|---|
| ruamel_yaml_line_info-0.1.4.tar.gz | 10.1 kB | With provenance | Details for ruamel_yaml_line_info-0.1.4.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| ruamel_yaml_line_info-0.1.4-py3-none-any.whl | Python 3 | none | any | Details for ruamel_yaml_line_info-0.1.4-py3-none-any.whl |
Total release size: 17.3 kB
Release files / ruamel_yaml_line_info-0.1.4.tar.gz
| Download URL | ruamel_yaml_line_info-0.1.4.tar.gz |
|---|---|
| Size | 10.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8cb81a11671a341693af713c70d0b58e0cee2b39ece4ffb413a333c91edd21f8
|
|
BLAKE2b-256 checksum How to use checksums |
85276c0b8435ae920f4c7baeb5d34ff9a64d9306e0baaadf263656fe98876a94
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on May 5, 2025.
Transparency logRelease files / ruamel_yaml_line_info-0.1.4-py3-none-any.whl
| Download URL | ruamel_yaml_line_info-0.1.4-py3-none-any.whl |
|---|---|
| Size | 7.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
5f168a894f8608edcb2da21feb9cbf207160ea9dbcb40c0e47f5a144faa469f9
|
|
BLAKE2b-256 checksum How to use checksums |
5dfcc42dc4d5f01d66ec70126f9d1c61920adf1466c59855b8dd8fcd813a6f4a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on May 5, 2025.
Transparency logSecurity for ruamel-yaml-line-info 0.1.4
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.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for ruamel_yaml_line_info-0.1.4.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on May 5, 2025.
Transparency logA 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.