Requirement manager for processes of PyPPL
Project description
pyppl_require
Requirement manager for processes of PyPPL.
Installation
pip install pyppl_require
Using API
from pyppl import registerPlugins, Proc
# have to register before process definition
registerPlugins('pyppl_require')
proc = Proc(desc = 'A short description', long = '''
@requires:
q:
desc: A command line tool that allows direct execution of SQL-like queries on CSVs/TSVs
url: http://harelba.github.io/q/index.html
version: 1.7.1
validate: "{{args.harelba_q}} -v"
install: |
wget https://cdn.rawgit.com/harelba/q/1.7.1/bin/q -O /tmp/q;
chmod +x /tmp/q;
sed -i 's@#!/usr/bin/env python@#!/usr/bin/env python2@' /tmp/q;
install /tmp/q "{{args.harelba_q | ?.__contains__: '/' | =:_ | !:'$bindir$/'}}"
''')
proc.args.hrelba_q = '/bin/q'
proc.require_validate()
[proc] Validating q ... Failed.
[proc] Validation command: bash -c 'q -v'
[proc] bash: q: command not found
# ...
proc.require_install(bindir = '/home/usr/bin/')
[proc] Validating q ... Failed.
[proc] Validation command: bash -c 'q -v'
[proc] bash: q: command not found
[proc] Installing q ...
[proc] --2019-12-11 18:11:20-- https://cdn.rawgit.com/harelba/q/1.7.1/bin/q
[proc] Resolving cdn.rawgit.com... 151.139.237.11
[proc] Connecting to cdn.rawgit.com|151.139.237.11|:443... connected.
[proc] HTTP request sent, awaiting response... 301 Moved Permanently
[proc] Location: https://raw.githubusercontent.com/harelba/q/1.7.1/bin/q [following]
[proc] --2019-12-11 18:11:20-- https://raw.githubusercontent.com/harelba/q/1.7.1/bin/q
[proc] Resolving raw.githubusercontent.com... 199.232.28.133
[proc] Connecting to raw.githubusercontent.com|199.232.28.133|:443... connected.
[proc] HTTP request sent, awaiting response... 200 OK
[proc] Length: 80435 (79K) [text/plain]
[proc] Saving to: `/tmp/q'
[proc]
[proc] 0K .......... .......... .......... .......... .......... 63% 565K 0s
[proc] 50K .......... .......... ........ 100% 642K=0.1s
[proc]
[proc] 2019-12-11 18:11:20 (591 KB/s) - `/tmp/q' saved [80435/80435]
[proc]
[proc] Succeeded!
[proc] Validating q ... Installed.
Using command-line tool
my-pipeline.py
from pyppl import Proc, PyPPL
# no need to register before process definition
proc = Proc(desc = 'A short description', long = '''
@requires:
q:
desc: A command line tool that allows direct execution of SQL-like queries on CSVs/TSVs
url: http://harelba.github.io/q/index.html
version: 1.7.1
validate: "{{args.harelba_q}} -v"
install: |
wget https://cdn.rawgit.com/harelba/q/1.7.1/bin/q -O /tmp/q;
chmod +x /tmp/q;
sed -i 's@#!/usr/bin/env python@#!/usr/bin/env python2@' /tmp/q;
install /tmp/q "{{args.harelba_q | ?.__contains__: '/' | =:_ | !:'$bindir$/'}}"
''')
proc.args.hrelba_q = '/bin/q'
# but have to specify in PyPPL
PyPPL({
'default': {'_plugins': ['pyppl_require']}
}).start(proc).require().run()
> pyppl-require --help
Description:
Requirement manager for processes of PyPPL
Usage:
pyppl-require <command> [OPTIONS]
Available commands:
validate - Validate if the requirements have been installed.
install - Install the requirements.
help [COMMAND] - Print help message for the command and exit.
> pyppl-require my-pipeline.py validate
[tsv.pTsvSql] Validating q ... Failed.
[tsv.pTsvSql] Validation command: bash -c 'q -v'
[tsv.pTsvSql] bash: q: command not found
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
pyppl_require-0.0.1.tar.gz
(4.8 kB
view details)
Built Distribution
File details
Details for the file pyppl_require-0.0.1.tar.gz
.
File metadata
- Download URL: pyppl_require-0.0.1.tar.gz
- Upload date:
- Size: 4.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/0.12.17 CPython/3.7.3 Linux/2.6.32-754.15.3.el6.x86_64
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9f96198cde743ea248bf06776d21efd28d57dc0d260af604eb9ccabc772c8a97 |
|
MD5 | 0a941d8314f2c321c975efdbf8daaf22 |
|
BLAKE2b-256 | 7a7a82089e3ffcfe8d0744c93759f4b6392a1f6c8fe94f4fb27fbc3bf5843d15 |
File details
Details for the file pyppl_require-0.0.1-py3-none-any.whl
.
File metadata
- Download URL: pyppl_require-0.0.1-py3-none-any.whl
- Upload date:
- Size: 4.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/0.12.17 CPython/3.7.3 Linux/2.6.32-754.15.3.el6.x86_64
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a0c56e33c345934d07487289b45ec558e3ef9b360f905a2c9f03ffec17804817 |
|
MD5 | bcdb45b7eb7960289b1b93abcf1e6bcc |
|
BLAKE2b-256 | ed0f89007ee641989fd7a6ba4c54d2a4b4ca4e23511d0d93f0a74b35a6d8ea9e |