Add print version command

pull/6/head
Michael D. M. Dryden 2021-06-06 23:01:47 -04:00
rodzic dbcc41ffac
commit ab51722ebc
5 zmienionych plików z 28 dodań i 1 usunięć

Wyświetl plik

@ -9,6 +9,10 @@ and this project adheres to `Semantic Versioning <https://semver.org/spec/v2.0.0
---------------------
`Unreleased`_ - 2021-06-06
---------------------
Added
-----
- Read version from bot
Removed
-------
- Python 3.7 support removed

14
poetry.lock wygenerowano
Wyświetl plik

@ -206,6 +206,14 @@ numpy = ">=1.13.3"
pandas = ">=0.22.0"
scipy = ">=1.0.1"
[[package]]
name = "single-source"
version = "0.2.0"
description = "Access to the project version in Python code for PEP 621-style projects"
category = "main"
optional = false
python-versions = ">=3.6,<4.0"
[[package]]
name = "six"
version = "1.16.0"
@ -295,7 +303,7 @@ pytz = "*"
[metadata]
lock-version = "1.1"
python-versions = "^3.8"
content-hash = "73f34816a5987de3cea064d181b87991feb54cef2dac3fa121c63c3d4b7bb63f"
content-hash = "069c3d56fda909d2551de171c4ced953a65bc6eca755970d6cd498bfb6994da3"
[metadata.files]
appdirs = [
@ -582,6 +590,10 @@ seaborn = [
{file = "seaborn-0.10.1-py3-none-any.whl", hash = "sha256:c901ce494541fb4714cfa7db79d0232dc3f4c4dfd3f273bacf17816084df5b53"},
{file = "seaborn-0.10.1.tar.gz", hash = "sha256:2d1a0c9d6bd1bc3cadb0364b8f06540f51322a670cf8438d0fde1c1c7317adc0"},
]
single-source = [
{file = "single-source-0.2.0.tar.gz", hash = "sha256:f40f94c7f2e72c854b9c0c6f7d6b545d74ada9ebd454f9f07f8fb743b22bccf5"},
{file = "single_source-0.2.0-py3-none-any.whl", hash = "sha256:82c55b00515a30c8f7c262b986a399ca023911ebb6a86f0953d4c50448c36b16"},
]
six = [
{file = "six-1.16.0-py2.py3-none-any.whl", hash = "sha256:8abb2f1d86890a2dfb989f9a77cfcfd3e47c2a354b01111771326f8aa26e0254"},
{file = "six-1.16.0.tar.gz", hash = "sha256:1e61c37477a1626458e36f7b1d82aa5c9b094fa4802892072e49de9c60c4c926"},

Wyświetl plik

@ -18,6 +18,7 @@ seaborn = "^0.10.1"
numpy = "^1.18.4"
matplotlib = "^3.2.1"
appdirs = "^1.4.4"
single-source = "^0.2.0"
[tool.poetry.dev-dependencies]

Wyświetl plik

@ -0,0 +1,4 @@
from pathlib import Path
from single_source import get_version
__version__ = get_version(__name__, Path(__file__).parent.parent)

Wyświetl plik

@ -36,6 +36,7 @@ from matplotlib.dates import date2num
from sqlalchemy.engine import Engine
from .utils import escape_markdown
from . import __version__
sns.set_context('paper')
sns.set_style('whitegrid')
@ -59,6 +60,9 @@ class InternalParser(argparse.ArgumentParser):
def print_help(self, file=None) -> None:
raise HelpException(self.format_help())
def _print_message(self, message: str, file=None) -> None:
raise HelpException(message)
def exit(self, status=None, message=None):
pass
@ -879,6 +883,8 @@ def get_parser(runner: StatsRunner) -> InternalParser:
parser.set_defaults(func=runner.get_chat_counts)
subparsers = parser.add_subparsers(title="Statistics:")
parser.add_argument('-v', '--version', action='version', version=__version__)
for name, func in runner.allowed_methods.items():
try:
doc = inspect.getdoc(getattr(runner, func)).splitlines()