Skip to main content

pymrun

Run Python modules by basename with uv.

What it does

pymrun indexes all .py files under your project root (detected by pyproject.toml or requirements.txt) and lets you run them as fully-qualified modules by basename instead of typing the full dotted path.

Given a project like:

myproject/
├── pyproject.toml
└── src/
    └── myapp/
        ├── main.py
        └── utils/
            └── helper.py

You can run:

pymrun helper          # instead of: uv run -m src.myapp.utils.helper
pymrun main            # instead of: uv run -m src.myapp.main

Requirements

  • Python ≥ 3.10
  • uv installed and available on your $PATH

Installation

pip install pymrun

Or with uv:

uv pip install pymrun

Usage

Run a module by basename

# Run src/myapp/utils/helper.py
pymrun helper

Forward arguments to the module

Use -- to separate pymrun arguments from the module's arguments:

pymrun helper -- --flag value --verbose

Duplicate basenames

If multiple files share the same basename (e.g., two main.py files), pymrun lists them and prompts you to choose:

$ pymrun main
Multiple modules named 'main' found:
  1. src.myapp.main
  2. src.myapp.subpkg.main
Select module [1]:

No arguments

Running pymrun without arguments shows the help text:

pymrun

Shell Completion

Bash / Zsh / Fish

Install completion for your current shell:

pymrun --install-completion

If auto-detection fails, specify the shell explicitly:

pymrun --install-completion --shell=zsh

Then restart your terminal or source your rc file.

Manual setup (any shell)

You can also source the generated completion script directly:

# Bash example
eval "$(_PYMRUN_COMPLETE=bash_source pymrun)"

How it works

  1. Root detection — Walks up from the current directory looking for pyproject.toml or requirements.txt.
  2. Indexing — Recursively scans the project for *.py files, skipping common build, cache, and hidden directories (__pycache__, .venv, .git, dist, build, node_modules).
  3. Execution — Converts the chosen file to a fully-qualified module name and replaces the current process with uv run -m <module> via os.execvp, so signals (e.g., Ctrl-C) flow directly to uv.

Development

Setup

# Clone the repository
git clone https://github.com/yourusername/pymrun.git
cd pymrun

# Create virtual environment and install dependencies
uv venv
source .venv/bin/activate  # or .venv\Scripts\activate on Windows
uv pip install --group dev --group lint -e .

Running tests

pytest

Or with tox across multiple Python versions:

tox

Linting and type checking

tox -e lint

Or manually:

ruff check .
ruff format --check .
pyright

Contributing

This project uses Conventional Commits for automatic semantic versioning:

  • feat: → minor version bump
  • fix: → patch version bump
  • BREAKING CHANGE: in commit footer → major version bump

License

MIT

Metadata

Release files for pymrun 1.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 pymrun 1.0.1
File Size Uploaded Provenance
pymrun-1.0.1.tar.gz 5.2 kB With provenance Details

Built distribution (wheel)

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

Total release size: 11.9 kB

Release files / pymrun-1.0.1.tar.gz

Download URL pymrun-1.0.1.tar.gz
Size 5.2 kB
Tags Source
SHA-256 checksum
How to use checksums
4d4c758e1e96cbe2a773f27da16560b4cfa4badb805f0e8d9b42d36c250cc8c6
BLAKE2b-256 checksum
How to use checksums
8145f206b4bd97b338db7c089b78530fb25c7ca977f29450773d46d21db6e29c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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 May 20, 2026.

Transparency log

Release files / pymrun-1.0.1-py3-none-any.whl

Download URL pymrun-1.0.1-py3-none-any.whl
Size 6.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
335d05c121e20adc11e7bac727204c40a339da5d69240c30a4126387408382c1
BLAKE2b-256 checksum
How to use checksums
b4bfeca403db9b40fe40f3507fdc17e9d59e86ce608c8c42e0ebb216067d8c24
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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 May 20, 2026.

Transparency log

Security for pymrun 1.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

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for pymrun-1.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 May 20, 2026.

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.

Release history Release notifications | RSS feed

This release

1.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