Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Make Jeff feel better about Python packaging
"""Back in my day, we only needed **one** command. 🧓"""
import runpy
import sys
def run(command):
sys.argv[0] = command
runpy.run_module(command, run_name="__main__")
command = sys.argv[1]
args = sys.argv[2:]
match command:
case "sdist" | "bdist_wheel":
del sys.argv[1]
case "install":
case "develop":
sys.argv[1] = "install"
sys.argv.insert(2, "-e")
case "upload":
case "check":
case _:
raise ValueError(f"{command!r} is not a recognized command")
Copy link

jefftriplett commented Nov 26, 2021

Feature request: Please add test => pytest and tox or nox please. Gotta be feature/requirements-level complete. 😄

Copy link

merwok commented Jan 15, 2022

Python packaging now focuses on building, distributing, downloading and installing code.
Running commands for other parts of development workflow like test, lint, etc is not in scope.

(And really, what is the need to add a passthrough test command when tox/nox are the mostly universal test runners nowadays?)

Copy link

jefftriplett commented Jan 16, 2022

The comment was an inside joke like the point of the gist.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment