Skip to main content

Pylon CLI

Pylon is a command-line tool that allows you to run Python scripts from either your current project directory or your user's .pylon directory. It supports both simple Python scripts and project-based scripts with pyproject.toml dependencies.

Installation

To install Pylon CLI, you can use pip:

pip install pylon-cli

Usage

pylon <script-name> [args...]

Pylon searches for scripts in the following order:

  1. Current project directory (the directory you're in)
  2. User scripts directory (~/.pylon)

How It Works

Script Types

Pylon supports two types of scripts:

Simple Scripts: Standalone Python files without dependencies. They run using the current Python interpreter.

Project Scripts: Scripts that are part of a Python project with a pyproject.toml file. They run in isolated virtual environments with project dependencies installed.

Note

Pylon invokes the builtin venv module to create virtual environments for project scripts. Currently we don't support managing Python installations. If your script requires a specific Python version that's different from the one powering Pylon, the venv-creation will fail and Pylon will exit with an error message.

Directory Structure Examples

Simple Script (current directory):

.
├── hello.py          # Script name: "hello"
└── other.py          # Script name: "other"

Project Script (current directory with pyproject.toml):

.
├── pyproject.toml    # Project configuration
├── main.py           # Script name: "main" (runs in project virtual environment)
└── utils.py          # Script name: "utils" (runs in same project virtual environment)

User Simple Script:

~/.pylon/
├── greet.py          # Script name: "greet"
└── backup.py         # Script name: "backup"

User Project Scripts (two example projects):

~/.pylon/
├── greet.py          # Simple script: "greet"
├── backup.py         # Simple script: "backup"
├── project1/         # Project directory
│   ├── pyproject.toml    # Project configuration
│   ├── task1.py          # Script name: "task1" (shares virtual environment with task2)
│   └── task2.py          # Script name: "task2" (shares virtual environment with task1)
└── project2/         # Another project directory
    ├── pyproject.toml    # Project configuration
    ├── analyze.py        # Script name: "analyze" (shares virtual environment with report.py)
    └── report.py         # Script name: "report" (shares virtual environment with analyze.py)

Script Discovery

Pylon discovers scripts in two locations: the current project directory and the user scripts directory (~/.pylon).

In the current project directory, Pylon looks for .py files. If a pyproject.toml file exists in the current directory, all .py files are treated as project scripts and share a common virtual environment managed by the project dependencies.

In the user scripts directory, Pylon looks for both simple scripts (.py files directly in ~/.pylon) and project scripts (directories containing pyproject.toml and .py files). For project scripts in the user directory, all .py files in the same project directory share a common virtual environment.

Virtual Environment Management

For project-based scripts (those with pyproject.toml), Pylon:

  1. Creates virtual environments in ~/.pylon/.venvs/ (hashed by project path)
  2. Installs dependencies from pyproject.toml using pip install -e .
  3. Reuses existing virtual environments when available

Script Shadowing

If a script with the same name exists in both the current directory and user directory, the current directory script takes precedence (script shadowing).

Duplicate Detection

Duplicate script names within the same search location (user or project) will cause an error.

Examples

Basic Usage

If you have a script named hello.py in your current directory:

pylon hello

This will execute hello.py using the current Python interpreter.

With Arguments

You can pass arguments to your script:

pylon hello --name="World" --verbose

User Scripts

You can store scripts in your user's .pylon directory (~/.pylon) to make them globally accessible:

  1. Create a script file in ~/.pylon/myscript.py
  2. Run it from anywhere:
pylon myscript arg1 arg2

Project-Based Scripts

For scripts with dependencies:

  1. Create a directory in ~/.pylon/myproject/
  2. Add pyproject.toml with dependencies
  3. Add your script myscript.py in the same directory
  4. Run it:
pylon myscript

Pylon will automatically create a virtual environment and install dependencies.

Example Script

Create a file called greet.py in your current directory:

import sys

def main():
    name = sys.argv[1] if len(sys.argv) > 1 else "World"
    print(f"Hello, {name}!")
    
if __name__ == "__main__":
    main()

Then run it with:

pylon greet Alice
# Output: Hello, Alice!

Available Scripts

When you run pylon without any arguments, it will show you all available scripts in both the current directory and the user's .pylon directory, along with their type and location.

Requirements

  • Python 3.13 or higher

License

This project is licensed under the Apache-2.0 license.

Metadata

Release files for pylon-cli 0.4.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 pylon-cli 0.4.1
File Size Uploaded
pylon_cli-0.4.1.tar.gz 18.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pylon-cli 0.4.1
File Interpreter ABI Platform
pylon_cli-0.4.1-py3-none-any.whl Python 3 none any Details

Total release size: 28.7 kB

Release files / pylon_cli-0.4.1.tar.gz

Download URL pylon_cli-0.4.1.tar.gz
Size 18.1 kB
Tags Source
SHA-256 checksum
How to use checksums
23ca666a4de237f33380ac5aeeed80669bd9c44d9a3203f11c17367073aa7b47
BLAKE2b-256 checksum
How to use checksums
eafb518a1ad10d8304cd1fd454227a8210442b101d9a9cc3292af54089581b44
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.9.16 {"installer":{"name":"uv","version":"0.9.16","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / pylon_cli-0.4.1-py3-none-any.whl

Download URL pylon_cli-0.4.1-py3-none-any.whl
Size 10.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e87a7f8e9c6dbaf107dbcebf105203bace186df2fc1a830c7db9aeae51af67d8
BLAKE2b-256 checksum
How to use checksums
397a9801deffde688b89aced1bbdaeadf38ae514ecf65df123f846136649dc41
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.9.16 {"installer":{"name":"uv","version":"0.9.16","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release history Release notifications | RSS feed

This release

0.4.1 This release

2 release files

0.4.0

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.0

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