Skip to main content

No project description provided

Project description

Clipstick

A cli-tool based on Pydantic models.

There are many other tools out there, that do kind of the same, but they all didn't do quite exactly what I wanted.

Installation

pip install clipstick

Example

# examples/simple.py

from pydantic import BaseModel
from clipstick import parse


class SimpleModel(BaseModel):
    """A simple model demonstrating clipstick."""

    name: str
    """Your name"""

    repeat_count: int = 10
    """How many times to repeat your name."""

    def main(self):
        for _ in range(self.repeat_count):
            print(f"hello: {self.name}")


if __name__ == "__main__":
    model = parse(SimpleModel)
    model.main()

running the above python examples/simple.py -h gives you:

A simple model demonstrating clipstick.

positional args:
name :   Your name
optional keyword arguments:
--repeat-count :  How many times to repeat your name.

running the above python examples/simple.py alex --repeat-count 3 gives you:

hello: alex
hello: alex
hello: alex

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

clipstick-0.1.0.tar.gz (5.0 kB view hashes)

Uploaded Source

Built Distribution

clipstick-0.1.0-py3-none-any.whl (6.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