{ "info": { "author": "Richard B. Winslow", "author_email": "richard.b.winslow@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 2 - Pre-Alpha", "Environment :: Console", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Programming Language :: Python", "Topic :: Text Processing :: Markup :: HTML" ], "description": "# hq\n**Powerful HTML slicing and dicing at the command line.**\n\n[![Build Status](https://travis-ci.org/rbwinslow/hq.svg?branch=master)](https://travis-ci.org/rbwinslow/hq) [![Coverage Status](https://coveralls.io/repos/github/rbwinslow/hq/badge.svg?branch=master)](https://coveralls.io/github/rbwinslow/hq?branch=master)\n\n`hq` is a Python-based command-line tool for querying HTML, manipulating data and producing results as HTML, JSON or any other format. It's based on a compact, flexible expression language that started out as an XPath implementation but ended up going a few different places, so I'm going ahead and calling it HQuery.\n\nHQuery is 99% compliant with the [XPath 1.0](https://www.w3.org/TR/xpath/) standard, minus some features not applicable to HTML. That's nice for querying, but you need more power to take control of the shape and format of the data you produce. To that end, HQuery also includes...\n\n* **Nuggets of XQuery** — only a few of the good parts! Just enough for iteration, branching and the like.\n* **XPath expansions for HTML** — including a `class::` axis and `class()` function, plus abbreviated axes to keep things terse.\n* **Super-charged string interpolation** — with powerful filters that you can chain together to transform data as you produce it.\n* **Computed constructors for HTML and JSON** — so you can programmatically assemble and output new HTML or JSON objects and arrays.\n* **Out-of-left-field union decomposition** — enabling amazingly terse and powerful mappings from clauses in a union to different expressions.\n\n## Installing `hq`\n\n pip install hq\n\n## Running `hq`\n\n cat /path/to/file.html | hq '`Hello, ${/html/head/title}!`'\n\n...or...\n\n hq -f /path/to/file.html '`Hello, ${/html/head/title}!`'\n \nTo print usage information:\n\n hq --help\n\n## Learning `hq`\n\nThe [wiki](https://github.com/rbwinslow/hq/wiki) discusses the [motivations](https://github.com/rbwinslow/hq/wiki/Why-HQuery%3F) guiding the HQuery language's design and provides a [language reference](https://github.com/rbwinslow/hq/wiki/Language-Reference).\n\n## Contributing to `hq`\n\n`hq` is tested against Python 2.7 and recent generations of Python 3 (3.4 and 3.5, as of this writing). The file structure and `setup.py` script for the project are based on [this blog post](https://gehrcke.de/2014/02/distributing-a-python-command-line-application/).\n\n`hq`'s dependencies are split into a \"base\" file, the subset needed to run the application, and a \"dev\" file providing the tools necessary to run tests and the like. To do development:\n\n pip install -r requirements/dev.txt\n\nThe parsing logic in `hquery_processor.py` is based on the [top-down operator precendence](https://www.crockford.com/javascript/tdop/tdop.html) approach.\n\n### Running Tests\n\n py.test\n \nThe \"dev.txt\" dependencies also include [pytest-cov](https://pypi.python.org/pypi/pytest-cov), so you can generate a nice coverage report (which you'll find in the `htmlcov` directory):\n\n py.test --cov=hq --cov-report html\n \nIf you want to turn verbosity on to figure out what's going on in a test, you need the `--gabby` flag (since `py.test` owns its own `-v` flag). You'll probably also want to run just one test at a time, because `--gabby` is way gabby:\n\n py.test --gabby -vv -k some_particular_test_function\n\n### Uploading to PyPI\n\nThis and other aspects of project setup, including running the CLI locally and using setup.py, are covered in the blog post linked above. For the sake of convenience, here's the part about uploading to PyPI:\n\n $ python setup.py sdist\n $ /bin/ls dist\n cmdline-bootstrap-0.2.0.tar.gz", "description_content_type": null, "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/rbwinslow/hq", "keywords": "html xpath query xquery hquery jq cmdline cli", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "hq", "package_url": "https://pypi.org/project/hq/", "platform": "", "project_url": "https://pypi.org/project/hq/", "project_urls": { "Homepage": "https://github.com/rbwinslow/hq" }, "release_url": "https://pypi.org/project/hq/0.0.4/", "requires_dist": null, "requires_python": "", "summary": "Command-line tool for querying, slicing & dicing HTML using the XPath/XQuery derivative HQuery.", "version": "0.0.4" }, "last_serial": 3385042, "releases": { "0.0.2": [ { "comment_text": "", "digests": { "md5": "3ebfdfd38505ff0782801dbf781262b9", "sha256": "47e1893e8e9863492faf2aa5dd069290100c3423ed29ac83c529307fdd12e6bf" }, "downloads": -1, "filename": "hq-0.0.2.tar.gz", "has_sig": false, "md5_digest": "3ebfdfd38505ff0782801dbf781262b9", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 42680, "upload_time": "2016-10-28T21:55:10", "url": "https://files.pythonhosted.org/packages/3a/7f/740344da553a0f74c76901e9cc6d6d5c5959cbd3c41c00582bd492dc4896/hq-0.0.2.tar.gz" } ], "0.0.3": [ { "comment_text": "", "digests": { "md5": "dda4e499229dd5c4033a14c337366e3f", "sha256": "fc26988cc87c01de6e9c1aa6d328df92752ec9c564178cff722afdec8cba3307" }, "downloads": -1, "filename": "hq-0.0.3.tar.gz", "has_sig": false, "md5_digest": "dda4e499229dd5c4033a14c337366e3f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 42469, "upload_time": "2016-10-31T17:03:14", "url": "https://files.pythonhosted.org/packages/e4/e2/87d97859b3e489df3dc7db118e387132fe4336f90b2a3d30db75156de2c2/hq-0.0.3.tar.gz" } ], "0.0.4": [ { "comment_text": "", "digests": { "md5": "5573177f673a5530d2a4f2fcccb3c751", "sha256": "d4500928fff26587c4570c01096a4c20a9b39ef93a75224652233b9fd332da1f" }, "downloads": -1, "filename": "hq-0.0.4.tar.gz", "has_sig": false, "md5_digest": "5573177f673a5530d2a4f2fcccb3c751", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 43796, "upload_time": "2017-12-03T17:27:33", "url": "https://files.pythonhosted.org/packages/47/54/ce3991a0537753375ab7f2d72436095f0dc8e6445380c92cdb3470d94822/hq-0.0.4.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "5573177f673a5530d2a4f2fcccb3c751", "sha256": "d4500928fff26587c4570c01096a4c20a9b39ef93a75224652233b9fd332da1f" }, "downloads": -1, "filename": "hq-0.0.4.tar.gz", "has_sig": false, "md5_digest": "5573177f673a5530d2a4f2fcccb3c751", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 43796, "upload_time": "2017-12-03T17:27:33", "url": "https://files.pythonhosted.org/packages/47/54/ce3991a0537753375ab7f2d72436095f0dc8e6445380c92cdb3470d94822/hq-0.0.4.tar.gz" } ] }