Skip to main content

A thin wrapper around runpy.run_module for use with uvx, pipx, etc.

Project description

run-module

An intentionally simple command-line wrapper around Python's built-in runpy.run_module.

Motivation

Tools like:

  • pipx
  • uv tool install
  • uvx (convenience bin for uv tool run)

are convenient. A single simple command can:

  • Download a PyPI package (with additional deps specified if desired)
  • Create a temporary out-of-sight venv dedicated to that package
  • Have that package's bins placed on your PATH
    • or just run the command directly without having the bins on your PATH

However, they have a limitation: they can't run a module ala python -m. So if you find a package that'd you'd like to use these conveniences with, but its entrypoint must be run with python -m, too bad.

A small and simple bin, like run-module, could help fill the gap. Here is an example usage using pyftpdlib, a popular FTP server package:

uvx --with pyftpdlib run-module pyftpdlib [args_for_pyftpdlib...]
pipx --pip-args pyftpdlib run-module pyftpdlib [args_for_pyftpdlib...]

What about pip-run?

It's true that pip-run lets you run a module:

pip-run pyftpdlib -- -m pyftpdlib [args_for_pyftpdlib...]

But compared to run-module, pip-run is:

  • Heavy: it reimplements or delegates downloading, caching, and venv logic
    • Tools like uv and pipx already do this well.
  • Has an unintuitive CLI surface often requiring invocations containing '--' or '!'

That said, if pip-run is working for you, great! No need to switch.

Comparatively run-module:

  • Is incredibly lightweight: a single small wrapper around runpy.run_module.
  • Will not (and cannot) download anything on its own.
  • Has a simple and intuitive command line surface.
  • Does one thing and does it well -- with no dependencies.
  • Should work with virtually any launcher or tool that supports Python packages / modules.
  • Allows you to reuse your uv or pipx cache, saving space and download time.

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

run_module-0.1.1.tar.gz (1.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

run_module-0.1.1-py3-none-any.whl (2.9 kB view details)

Uploaded Python 3

File details

Details for the file run_module-0.1.1.tar.gz.

File metadata

  • Download URL: run_module-0.1.1.tar.gz
  • Upload date:
  • Size: 1.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for run_module-0.1.1.tar.gz
Algorithm Hash digest
SHA256 9311fa8c78c156893ac074243bb60dd5e9eefb084a13955a38c3847d90a1f29b
MD5 8c32e11b2a606df4f63634aac1c3275b
BLAKE2b-256 ae34c88964ac0fe9e2cf20d01bd116d7cb06fa6a567f4644a71bcb19945a02f6

See more details on using hashes here.

Provenance

The following attestation bundles were made for run_module-0.1.1.tar.gz:

Publisher: publish.yml on mevanlc/run-module

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file run_module-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: run_module-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 2.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for run_module-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 2dfc7ec4cba072a1fa962d88cccc818ff3ceabdaae1655a999b7673d8a525155
MD5 4688bd39485fad1594bcda4e46af395f
BLAKE2b-256 759eb8728f96da4d817f2e58ae2381500bfb8eb243fe54517082a7fdea7a88a0

See more details on using hashes here.

Provenance

The following attestation bundles were made for run_module-0.1.1-py3-none-any.whl:

Publisher: publish.yml on mevanlc/run-module

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page