Git Product home page Git Product logo

yq's Introduction

yq

Pure Python implementation of a subset of the features of jq_ for YAML documents.

Status: No active development planned, maintenance work only. This repository is superseded by https://github.com/kislyuk/yq in PyPI, starting with version 2.0.0.

If you're looking for a way to do jq-like filtering on YAML documents, you'll probably be better off using the yq provided by y2j_ or kislyuk/yq_. They provides a wrapper around jq that transforms the input YAML into JSON, calls out to jq, then transforms the result back. This means it automatically supports the full feature set of jq.

If for some reason you need a pure python implementation, this repo is for you.

Setup

pip install 'yq < 2.0.0'

What's implemented?

Everything from the Basic Filters section of the jq manual is supported - at least yq acts the same way as jq in the examples there. Object construction also more or less works.

Known limitations

The parsing technology used in this project (parser combinators) is not powerful enough to support parsing some of the more complex features of jq.

Hacking

virtualenv virtualenv
. virtualenv/bin/activate
pip install -r requirements.txt

# Optionally install as a package:
pip install .

There are basic unit-tests for some of the operators, but the meat of the test suite are the functional tests defined in functional_tests/*.yml files and run by run_functional_tests.py.

The whole test suite of jq is in functional_tests/jq.txt, run by run_jq_tests.py. Sections starting with a line containing skip are, surprisingly, skipped - until that functionality is implemented.

They're all started by nosetests

Roadmap

Here are some steps that'd need to be taken to bring the feature set of this yq closer to that of jq.

  • Work the same way as jq for the "Types and Values" section
  • Operators, functions
  • Check if operators can be refactored
  • Package, release
  • Conditionals, comparisons
  • "Advanced features", Assignment from the jq manual

yq's People

Contributors

abesto avatar lowks avatar samuelmarks avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

yq's Issues

PyPI package name

Hello,

I would like to provide a lightweight Python package that accomplishes the role of "jq for YAML documents" in a minimalistic way by transcoding YAML to JSON and piping it through jq. For that purpose it would be useful to be able to publish to the "yq" package name on PyPI.

Since you are not intending to maintain this package further, I was wondering if you'd be interested in transferring the package name to me.

Thanks!

Python 3

Would you be interested in a patch for Python 3 support? (I prefer a pure python solution)

> python -m pip install --user -e .
Obtaining file:///home/jayvdb/projects/yaml/yq
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/home/jayvdb/projects/yaml/yq/setup.py", line 4, in <module>
        from itertools import imap, ifilter
    ImportError: cannot import name 'imap'

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /home/jayvdb/projects/yaml/yq/

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.