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.2.tar.gz (2.2 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.2-py3-none-any.whl (3.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: run_module-0.1.2.tar.gz
  • Upload date:
  • Size: 2.2 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.2.tar.gz
Algorithm Hash digest
SHA256 a9adef6eb0aa35c2a976c359a7f2d2305ff709e77b7aab62f42322329a360aa6
MD5 98f6516d79412655e567a29c2b63a772
BLAKE2b-256 4c5dddfbc920ba7e3e7f71286d039c06ba366455e59af685dd24ae45df8ee5e2

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: run_module-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 3.2 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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 dbf73684cc437c65946767ed4937f6171f79e11a6ec2038f86f56cde4382d8c7
MD5 122143ac5640a4f71729bc54d61a49cc
BLAKE2b-256 4cf590aaec08ad1b65fd4d80418716d41ffab9e01a2233203f4ef1a7f4b5f0e6

See more details on using hashes here.

Provenance

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