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.0.tar.gz (1.7 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.0-py3-none-any.whl (2.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: run_module-0.1.0.tar.gz
  • Upload date:
  • Size: 1.7 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.0.tar.gz
Algorithm Hash digest
SHA256 e3d25d8fa7c38d8fb7d026f0ab7aedab3aa18ad6f68cde51e4ce5b546d1f305b
MD5 e5aa18cf5911f875c8b2ef1e3600e7b0
BLAKE2b-256 f9692ee358f1c114026b8f171c31f98e9aea57dd3c8556d9a0c58deb0a827cc9

See more details on using hashes here.

Provenance

The following attestation bundles were made for run_module-0.1.0.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.0-py3-none-any.whl.

File metadata

  • Download URL: run_module-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 2.7 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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6b353b45203aacf874f886e23794966a090f66acbf1f830cd21f3d2839bbef3b
MD5 1706d8e35a9b17d2c4cf527e4ea82c7c
BLAKE2b-256 225143e46e3275ef911df1208db6a43658ef6fed4c740d62dd2e7fff42952504

See more details on using hashes here.

Provenance

The following attestation bundles were made for run_module-0.1.0-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