Skip to main content

A simple framework to help you build scripts faster!

Project description

Scripto

Build Project linting: pylint Python Version from PEP 621 TOML PyPI - Version PyPI - Downloads PyPI Total Downloads

Are you sick of writing long and annoying argparse initialization code? Worry no more - the future is here!

Scripto is a Python package designed to transform your scripts into a powerful CLI tool using decorators. As in the example below, you can use the @script.register() decorator on your main business logic functions to effortlessly generate a feature-rich command-line interface.

Features

  • Seamless integration with argparse.
  • Simple and intuitive syntax inspired by Flask.
  • Automatically generates CLI commands from decorated functions.
  • Ideal for turning scripts into organized and user-friendly command-line tools.

Usage

  1. Install Scripto. You can install Scripto using pip:

    pip install scripto
    
  2. Decorate your main business logic functions with @script.register().

  3. Run your script to enjoy the generated CLI:

    from scripto.app import Scripto
    
    script = Scripto('script')
    
    @script.register()
    def my_command(arg1, arg2):
        """
        Description of your command.
        :param arg1: The first parameter
        :param arg2: The second parameter
        """
        # Your business logic here
    
    if __name__ == "__main__":
        script.run()
    

Complex Examples

See the example scripts provided.

Module Wrapping

You can now use the built in scripto.wrap module to wrap any module you want to be exposed to the command line! For example:

python3 -m scripto.wrap os.path

Will generate a python script exposing the entirety of the os.path module, to a script called auto_os.path.py. Of course you may rename this to whatever you want for your convenience.

About the rationale

We all like the simple automations, and nifty little scripts play a vital role in the life of every developer.

Many times, what was a simple 3 line script turned into a slightly larger one, and then all of your friends want to use it too.

Which is when you find out, your user interface sucks.

This framework aims to simplify the creation of the command line interface of such scripts.

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

scripto-2.0.7.tar.gz (45.1 kB view details)

Uploaded Source

Built Distribution

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

Scripto-2.0.7-py3-none-any.whl (33.6 kB view details)

Uploaded Python 3

File details

Details for the file scripto-2.0.7.tar.gz.

File metadata

  • Download URL: scripto-2.0.7.tar.gz
  • Upload date:
  • Size: 45.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.9.21

File hashes

Hashes for scripto-2.0.7.tar.gz
Algorithm Hash digest
SHA256 6ef163222c001d008c445073f2e373b2a2aaf0810dab28e22079c90cea7c4c98
MD5 18ce5aa7855b23e5e3e26b3c0eacd048
BLAKE2b-256 d1d428f04e738d6a25a12e60a7e78d4fa39ac7353ca84e14200a1d33ffbb43e9

See more details on using hashes here.

File details

Details for the file Scripto-2.0.7-py3-none-any.whl.

File metadata

  • Download URL: Scripto-2.0.7-py3-none-any.whl
  • Upload date:
  • Size: 33.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.9.21

File hashes

Hashes for Scripto-2.0.7-py3-none-any.whl
Algorithm Hash digest
SHA256 0e8e10f7df628472303c4c7d4c6d38f52daf0ceaf934247859d97d09292f1a50
MD5 2242bd467cef87f4578338b08dcae579
BLAKE2b-256 3649b8bd2249ee17a02c2f89c8d65444dc536245b48532f1d532f40a611ec5e0

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