Fuzzy Python module runner for uv
Project description
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
- Root detection — Walks up from the current directory looking for
pyproject.tomlorrequirements.txt. - Indexing — Recursively scans the project for
*.pyfiles, skipping common build, cache, and hidden directories (__pycache__,.venv,.git,dist,build,node_modules). - Execution — Converts the chosen file to a fully-qualified module name and replaces the current process with
uv run -m <module>viaos.execvp, so signals (e.g., Ctrl-C) flow directly touv.
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 bumpfix:→ patch version bumpBREAKING CHANGE:in commit footer → major version bump
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pymrun-1.0.1.tar.gz.
File metadata
- Download URL: pymrun-1.0.1.tar.gz
- Upload date:
- Size: 5.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4d4c758e1e96cbe2a773f27da16560b4cfa4badb805f0e8d9b42d36c250cc8c6
|
|
| MD5 |
88f17236e9ab4d67c07cfc3950b33804
|
|
| BLAKE2b-256 |
8145f206b4bd97b338db7c089b78530fb25c7ca977f29450773d46d21db6e29c
|
Provenance
The following attestation bundles were made for pymrun-1.0.1.tar.gz:
Publisher:
ci.yml on Lamanaable/pymrun
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pymrun-1.0.1.tar.gz -
Subject digest:
4d4c758e1e96cbe2a773f27da16560b4cfa4badb805f0e8d9b42d36c250cc8c6 - Sigstore transparency entry: 1579223194
- Sigstore integration time:
-
Permalink:
Lamanaable/pymrun@00c43e6269f95a90f79383c418a1b19a05f1a7b0 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/Lamanaable
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
ci.yml@00c43e6269f95a90f79383c418a1b19a05f1a7b0 -
Trigger Event:
push
-
Statement type:
File details
Details for the file pymrun-1.0.1-py3-none-any.whl.
File metadata
- Download URL: pymrun-1.0.1-py3-none-any.whl
- Upload date:
- Size: 6.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
335d05c121e20adc11e7bac727204c40a339da5d69240c30a4126387408382c1
|
|
| MD5 |
337ce3f2dba4eea85533c80cf9e02503
|
|
| BLAKE2b-256 |
b4bfeca403db9b40fe40f3507fdc17e9d59e86ce608c8c42e0ebb216067d8c24
|
Provenance
The following attestation bundles were made for pymrun-1.0.1-py3-none-any.whl:
Publisher:
ci.yml on Lamanaable/pymrun
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pymrun-1.0.1-py3-none-any.whl -
Subject digest:
335d05c121e20adc11e7bac727204c40a339da5d69240c30a4126387408382c1 - Sigstore transparency entry: 1579223376
- Sigstore integration time:
-
Permalink:
Lamanaable/pymrun@00c43e6269f95a90f79383c418a1b19a05f1a7b0 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/Lamanaable
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
ci.yml@00c43e6269f95a90f79383c418a1b19a05f1a7b0 -
Trigger Event:
push
-
Statement type: