Make Jeff feel better about Python packaging
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"""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] | |
run("build") | |
case "install": | |
run("pip") | |
case "develop": | |
sys.argv[1] = "install" | |
sys.argv.insert(2, "-e") | |
run("pip)") | |
case "upload": | |
run("twine") | |
case "check": | |
run("twine") | |
case _: | |
raise ValueError(f"{command!r} is not a recognized command") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
build | |
twine | |
pip |
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?)
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
Feature request: Please add
test
=>pytest
andtox
ornox
please. Gotta be feature/requirements-level complete. 😄