Skip to main content

shell2launch

Pypi Status PyPI - Python Version GitHub Actions (Tests) Coverage

Transform shell code that invokes python scripts to Visual Studio Code debug configurations.

Installation

Use the package manager pip to install shell2launch.

pip install shell2launch

Usage

shell2launch helps you to quickly convert shell code that calls a Python script with additional arguments into a vscode debug configuration that can be copied and pasted into launch.json files.

For Python projects that provide shell scripts with dozens of arguments, starting a debug run in vscode can be annoying, as the debug configuration expects arguments in a different format than shell code.

Run shell2launch with the path to your shell script to print the debug configuration to your console.

shell2launch path/to/your/shellscript.sh

Optional Arguments

--args_only

Setting this flag limits the output to the "args": [...] part of the debug configuration. This might be sufficient, if you want to set the other configuration attributes manually.

-o, --output_filepath path/to/your/output.txt

Allows you to provide a filepath to store the output. shell2launch will create the file at the specified location and writes the same output that gets printed to the console.

Example

./testing/ contains a python script example.py and a corresponding shell script example.sh that invokes the python script with arguments.

To start a debug run of example.py with the same arguments as in the shell script, follow these steps:

  1. Open the Run and Debug view (Ctrl + Shift + D), click create a launch.json file, and select the Python Debugger and the Python File configuration. This creates .vscode/launch.json. The contents should look something like this:

    {
        "version": "0.2.0",
        "configurations": [
            {
                "name": "Python Debugger: Current File",
                "type": "debugpy",
                "request": "launch",
                "program": "${file}",
                "console": "integratedTerminal"
            }
        ]
    }
    
  2. Run shell2launch on the shell script.

    shell2launch testing/example.sh
    
  3. Copy the console output and append it to the list of configurations in .vscode/launch.json. It should now look like this:

    {
        "version": "0.2.0",
        "configurations": [
            {
                "name": "Python Debugger: Current File",
                "type": "debugpy",
                "request": "launch",
                "program": "${file}",
                "console": "integratedTerminal"
            },
            {
                "name": "Python Debugger: testing/example.py with Arguments",
                "type": "debugpy",
                "request": "launch",
                "program": "testing/example.py",
                "console": "integratedTerminal",
                "args": [
                    "positional",
                    "--store_true",
                    "--no_val",
                    "--single_val", "1",
                    "--list_val", "1", "2", "3", "4",
                    "-s", "short",
                    "--path", "dir/dir/file.txt",
                ]
            }
        ]
    }
    
  4. In the RUN AND DEBUG dropdown select the new option Python Debugger: testing/example.py with Arguments and hit the play button (F5). Usually, this should print the following to your vscode terminal:

    {'list_val': ['1', '2', '3', '4'],
    'no_val': None,
    'path': 'dir/dir/file.txt',
    'positional': 'positional',
    'short': 'short',
    'single_val': '1',
    'store_true': True}
    

Development Setup

Clone this repository.

git clone https://github.com/jjaju/shell2launch.git

Navigate to the cloned repository.

cd shell2launch

Install dev dependencies.

pip install -r requirements_dev.txt

Install shell2launch in "editable" mode.

pip install -e .

Automatically run pytest, mypy, ruff, and coverage

tox -p

Metadata

Release files for shell2launch 0.0.1

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

Source distribution (sdist)

Source distribution for shell2launch 0.0.1
File Size Uploaded Provenance Actions
shell2launch-0.0.1.tar.gz 7.0 kB With provenance Details for shell2launch-0.0.1.tar.gz

Built distribution (wheel)

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

Total release size: 13.7 kB

Release files / shell2launch-0.0.1.tar.gz

Download URL shell2launch-0.0.1.tar.gz
Size 7.0 kB
Tags Source
SHA-256 checksum
How to use checksums
cbb38df542cd78dfa91e3ff88c9eab77c1359ca144349ccdb0d14bfc3a3afda5
BLAKE2b-256 checksum
How to use checksums
727289a55812a3b7a75c86481d43cc49c1dd7f9128852da4a096cedb58e01505
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.9

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Mar 13, 2025.

Transparency log

Release files / shell2launch-0.0.1-py3-none-any.whl

Download URL shell2launch-0.0.1-py3-none-any.whl
Size 6.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9d20a93e60a65b923c55fe791f203f59137878cd92c0885b13c3995815b1eb1a
BLAKE2b-256 checksum
How to use checksums
30281fc88758b78e0ded4284106474d3caf6b33f48aff02fcb99e1022db8e9d4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.9

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Mar 13, 2025.

Transparency log

Security for shell2launch 0.0.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for shell2launch-0.0.1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Mar 13, 2025.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.0.1 This release

2 release files Full provenance

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