Skip to main content

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.

Metadata

Release files for Scripto 2.0.14

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for Scripto 2.0.14
File Size Uploaded
scripto-2.0.14.tar.gz 45.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for Scripto 2.0.14
File Interpreter ABI Platform
Scripto-2.0.14-py3-none-any.whl Python 3 none any Details

Total release size: 79.2 kB

Release files / scripto-2.0.14.tar.gz

Download URL scripto-2.0.14.tar.gz
Size 45.4 kB
Tags Source
SHA-256 checksum
How to use checksums
47ce25913ea7d8fddeb052d56fa8054a5be90f2127367d9a4151ad327e0f5fcc
BLAKE2b-256 checksum
How to use checksums
e8dd6edacc397b2a5c795366f6c774e811dd4c117e316f24841cbace69873b4a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.0.1 CPython/3.9.21

Release files / Scripto-2.0.14-py3-none-any.whl

Download URL Scripto-2.0.14-py3-none-any.whl
Size 33.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
58ffb5fd332da1ef86e038fc303d0a136d5402144db7585ce5f12b1d1757685f
BLAKE2b-256 checksum
How to use checksums
7667c0265610936d57398a360494ed3d44a4c6a98d44b58bdf23266f8673a788
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.0.1 CPython/3.9.21

Release history Release notifications | RSS feed

This release

2.0.14 This release

2 release files

2.0.12

2 release files

2.0.11

2 release files

2.0.9

2 release files

2.0.7

2 release files

2.0.6

2 release files

2.0.0

2 release files

1.1.0

2 release files

1.0.1

2 release files

1.0.0

2 release files

0.0.14

2 release files

0.0.13

2 release files

0.0.9

2 release files

0.0.8

2 release files

0.0.7

2 release files

0.0.6

2 release files

0.0.5

2 release files

0.0.4

2 release files

0.0.3

2 release files

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page