Fyoo is a simple argument templatizer that wraps around a command. CLIs exist for pretty much everything, isn’t it about time we started using them in our pipelines as they are? The best data flow code is code you don’t have to write.
Installation
pip install fyoo
Basic Usage
Fyoo can provide context to a subcommand’s arguments after --. All arguments to that subcommand become pre-rendered jinja2 templates.
Fyoo allows you to inject context into shell arguments in a few ways, --fyoo-set being the simplest and easiest to get started with.
fyoo \
--set table=Employee \
-- \
sqlite3 \
'examples/Chinook_Sqlite.sqlite' \
'select * from {{ table }} where date(HireDate) < "{{ date() }}"' \
-csv -header
# ... csv results
This goes further than simple bash replacement, because you have the full template power of jinja2 between when arguments are processed and before the process is started.
Let’s use this sql template file now.
{%- if not table %}
{{ throw("'table' required") }}
{%- endif %}
select count(*)
from {{ table }}
{%- if condition %}
where ({{ condition }})
{%- endif %}
The template file contents are passed as a bash argument, but then fyoo renders the template before passing it to sqllite3 subcommand.
The -v/--verbose flag will show the executable before running it.
fyoo \
--verbose \
--jinja-template-folder ./tests/sql \
--set table=Employee \
--set condition='lower(Title) like "%sales%"' \
-- \
sqlite3 \
'examples/Chinook_Sqlite.sqlite' \
'{% include "count.sql.jinja" %}' \
-csv
# ["sqlite3", "examples/Chinook_Sqlite.sqlite", "\nselect count(*) as c\nfrom Employee\nwhere (lower(Title) like \"%sales%\")", "-csv"]
# 4
Metadata
Release files for fyoo 1.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| fyoo-1.1.0.tar.gz | 10.7 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| fyoo-1.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 20.8 kB
Release files / fyoo-1.1.0.tar.gz
| Download URL | fyoo-1.1.0.tar.gz |
|---|---|
| Size | 10.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
52d60f3df4e8a3040562657357cc7896198a0c0d5097048e6127af8a78efb44f
|
|
BLAKE2b-256 checksum How to use checksums |
b00b881e491b47fb271512a4520cf52461ca6af617229b3307dce22ce302a460
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.0.0 CPython/3.10.1
|
Release files / fyoo-1.1.0-py3-none-any.whl
| Download URL | fyoo-1.1.0-py3-none-any.whl |
|---|---|
| Size | 10.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
fa97e6f8d00f06641971d79a3bb59cd331e00fec8fee09054db777c5ab8d22e4
|
|
BLAKE2b-256 checksum How to use checksums |
56a0249c8e075172118f9ccc565e7c53c1301225e112ed3ff4fa22d601d35d60
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.0.0 CPython/3.10.1
|
Security for fyoo 1.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.