Skip to content

Instantly share code, notes, and snippets.

Created November 26, 2021 22:31
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
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

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

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