Skip to main content

Data walker (in dot notation style) & filter (Xpath analog) for yaml look data structure

Project description

YamlWalker introduction

Provide comfortable interface for operate yaml data

Containing 2 main features:

  • YPath
  • YDict

YPath

Allow querying of Yaml file in Xpath/XQuery look alike style Comfortable when path sub elements not pre-defined

YDict

Allow operate yaml data with dot notation style with extension to Ypath list items by property value Suitable when path to desired sub element are static or well known

Installation

From PIP

[Link to PYPI] (https://pypi.org/project/yaml_walker/)

pip.exe install YamlWalker

From GitHub

[Lint to GiHub] (https://github.com/doguz2509/YamlWalker)

Usage

file.yaml
---
node:
  nd_1:
    data:
      - id: 0
        name: node1
        type: str
        value: any value
      - id: 2
        name: node2
        type: str
        value: any str
        sub_data:
          item: any
          value: four
python

import yaml
from yaml_walker import api

with open(file.yaml) as fr:
    yaml_data = yaml.load(fr)

# YDict example
yaml_dict = api.YDict(yaml_data)
yaml_result = yaml_dict.node.hd_1.data['id>0']

# YQuery example
y_query = api.YPath('yaml_data.node.hd_1.data[id>0]')
yaml_result = y_query(yaml_data)
shell script

python -m yaml_walker 'yaml_data.node.hd_1.data[id>0]' file.yaml

Result in all cases: 
    {
        id: 2
        name: node2
        type: str
        value: any str
        sub_data:
          item: any
          value: four
    }

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

yaml_walker-1.0.24-py3-none-any.whl (13.6 kB view details)

Uploaded Python 3

File details

Details for the file yaml_walker-1.0.24-py3-none-any.whl.

File metadata

  • Download URL: yaml_walker-1.0.24-py3-none-any.whl
  • Upload date:
  • Size: 13.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.4.0 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.7.2

File hashes

Hashes for yaml_walker-1.0.24-py3-none-any.whl
Algorithm Hash digest
SHA256 39e90722221c935351c6b7216c35759bdc5aee66126922c42876ed1968177037
MD5 1695a91b8a725e83f29a48b8962c7908
BLAKE2b-256 4af37f527c424803e07144215cf959a2212c67fe4ea05d98409ac7076b2ff279

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page