Skip to main content

No project description provided

Project description

PyPI Package Documentation Status Git tag Test status Code coverage

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.

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.

# run a templatized/dynamic query to csv output
fyoo \
  --fyoo-set table=user \
  --fyoo-set db=example.db \
  -- \
sqlite3 \
  '{{ db }}' \
  'select * from {{ table }} where date(created) = "{{ date() }}"' \
  -csv -header
# username,created
# cooluser,2020-06-21

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.

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.
fyoo \
  --fyoo-set table=user \
  --fyoo-set db=example.db \
  --fyoo-set condition=1=1
  -- \
sqlite3 \
  '{{ db }}' \
  "$(cat count.tpl.sql)"
# 1 (assuming same example from before

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

fyoo-0.1.1.tar.gz (6.4 kB view hashes)

Uploaded Source

Built Distribution

fyoo-0.1.1-py3-none-any.whl (11.4 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page