Skip to main content

Build command lines and shell snippets using template strings

Project description

PyPI version Documentation status

quotish is a combinator library for building command lines and shell snippets using PEP 750 template strings. Grab it from PyPI or read the documentation on ReadTheDocs.

>>> import quotish as qsh
>>> # Safely interpolate values into argument lists or shell-safe strings.
>>> msg = 'hello, world'
>>> qsh.cmd(t'echo {msg}!').argv()
['echo', 'hello, world!']
>>> qsh.cmd(t'echo {msg}!').render()
"echo 'hello, world!'"
>>> # Interpolate into shell lines instead to preserve shell syntax constructs.
>>> qsh.shell(t'echo {msg}; echo 123').render()
"echo 'hello, world'; echo 123"
>>> # Unpack sequences, build cartesian products, and compose the resulting
>>> # command lines together.
>>> host = 'host'
>>> pkgs = ['ripgrep', 'just']
>>> dnf = qsh.cmd(t'dnf install -y {pkgs:*}')
>>> inner = qsh.shell(rt"echo '- '{pkgs:^}$'\n' ; {dnf:*}")
>>> qsh.cmd(t'ssh {host} {inner}').argv()
['ssh', 'host', "echo '- 'ripgrep$'\\n' '- 'just$'\\n' ; dnf install -y ripgrep just"]

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

quotish-0.1.0.tar.gz (19.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

quotish-0.1.0-py3-none-any.whl (16.9 kB view details)

Uploaded Python 3

File details

Details for the file quotish-0.1.0.tar.gz.

File metadata

  • Download URL: quotish-0.1.0.tar.gz
  • Upload date:
  • Size: 19.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.19 {"installer":{"name":"uv","version":"0.11.19","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Fedora Linux Asahi Remix","version":"43","id":"","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for quotish-0.1.0.tar.gz
Algorithm Hash digest
SHA256 e1c00d007d957771e8479f8b86f32071dc973d5fe537f86c0456005771eb4751
MD5 b34a9967f5193354c88b79b15339bbc7
BLAKE2b-256 eed1dfe2a5e1c6cc00ab929d4cbda4424f1cb97bc80001d72b61aca6d23f1ed1

See more details on using hashes here.

File details

Details for the file quotish-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: quotish-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 16.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.19 {"installer":{"name":"uv","version":"0.11.19","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Fedora Linux Asahi Remix","version":"43","id":"","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for quotish-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f6e1e2daa0145ccae5ef135bc3aefd4b6e8a30ec1b1292c7b62b5ee735879fb8
MD5 4ab779aaa03895e657d4badcb34d40b6
BLAKE2b-256 220c3fcc6e46e58440ae16810f51bb2d66ed8863e08e67dd583443f0b0483cf5

See more details on using hashes here.

Supported by

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