https://github.com/marthjod/hipy
Convert Ruby output of older Hiera versions to equivalent Python or JSON data structures
https://github.com/marthjod/hipy
hiera json pex pypi python python3 ruby
Last synced: 2 months ago
JSON representation
Convert Ruby output of older Hiera versions to equivalent Python or JSON data structures
- Host: GitHub
- URL: https://github.com/marthjod/hipy
- Owner: marthjod
- Created: 2016-02-05T09:36:08.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2019-10-08T15:00:15.000Z (over 6 years ago)
- Last Synced: 2025-08-24T20:51:04.549Z (11 months ago)
- Topics: hiera, json, pex, pypi, python, python3, ruby
- Language: Python
- Homepage:
- Size: 29.3 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# hipy
[](https://travis-ci.org/marthjod/hipy)
[](https://coveralls.io/github/marthjod/hipy?branch=master)
Convert Ruby output of older Hiera versions to equivalent Python or JSON data structures.
## Usage
```bash
Usage: hipy [OPTIONS]
Convert Hiera output to JSON/Python
Options:
--version Show the version and exit.
--json / --python Format output as JSON/Python (default: JSON)
--help Show this message and exit.
```
## Examples
### Standalone CLI script
```bash
$ echo nil | hipy
null
$ echo nil | hipy --json
null
$ echo nil | hipy --python
None
```
For more examples (and possible limitations), cf. the test examples.
### Library
```python
>>> from hipy.parser import HieraOutputParser
>>> parser = HieraOutputParser(text='nil')
>>> parser.get_json()
'null'
>>> parser.get_python() is None
True
>>> parser = HieraOutputParser(text='nil', debug=True)
```
## Tests
### tox
```
pip install tox
tox
```
### manually
```
pip install -r test-requirements.txt
nosetests -c nose.cfg
```
## Installation
### PyPI
`pip install hipy`
### Locally
Run `python setup.py install`.
### [PEX](https://pex.readthedocs.io/)
```bash
virtualenv venv
source venv/bin/activate
pip install hipy pex
pex -r <(pip freeze) -c hipy -o hipy.pex
deactivate
mv hipy.pex /tmp
cd /tmp
echo '{"a"=>6}' | ./hipy.pex --python
{u'a': 6}
```