From: Joe Young <80432516+jpy-git@users.noreply.github.com> Date: Wed, 6 Apr 2022 18:04:12 +0000 (+0100) Subject: Output python version and implementation as part of `--version` flag (#2997) X-Git-Url: https://git.madduck.net/etc/vim.git/commitdiff_plain/f6188ce6dcde3fcad381c52ecc74374e7d0579c9 Output python version and implementation as part of `--version` flag (#2997) Example: black, 22.1.1.dev56+g421383d.d20220405 (compiled: no) Python (CPython) 3.9.12 Co-authored-by: Batuhan Taskaya --- diff --git a/CHANGES.md b/CHANGES.md index 30c0056..3bf481f 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -37,6 +37,8 @@ +- Output python version and implementation as part of `--version` flag (#2997) + ### Packaging diff --git a/src/black/__init__.py b/src/black/__init__.py index bdeb732..3a2d1cb 100644 --- a/src/black/__init__.py +++ b/src/black/__init__.py @@ -10,6 +10,7 @@ from multiprocessing import Manager, freeze_support import os from pathlib import Path from pathspec.patterns.gitwildmatch import GitWildMatchPatternError +import platform import re import signal import sys @@ -381,7 +382,10 @@ def validate_regex( ) @click.version_option( version=__version__, - message=f"%(prog)s, %(version)s (compiled: {'yes' if COMPILED else 'no'})", + message=( + f"%(prog)s, %(version)s (compiled: {'yes' if COMPILED else 'no'})\n" + f"Python ({platform.python_implementation()}) {platform.python_version()}" + ), ) @click.argument( "src",