Consolidate to pyproject

Consolidates configs to pyproject.toml and updates workflows accordingly as well as sets sane minimums for dev requirements.

adds version check to main script.
This commit is contained in:
OMEGARAZER
2022-12-16 23:45:36 -05:00
parent d0da9be376
commit 8c01a9e7a0
15 changed files with 114 additions and 68 deletions

View File

@@ -0,0 +1 @@
__version__ = "2.6.2"

View File

@@ -4,7 +4,9 @@ import logging
import sys
import click
import requests
from bdfr import __version__
from bdfr.archiver import Archiver
from bdfr.cloner import RedditCloner
from bdfr.completion import Completion
@@ -74,8 +76,25 @@ def _add_options(opts: list):
return wrap
def _check_version(context, param, value):
if not value or context.resilient_parsing:
return
current = __version__
latest = requests.get("https://pypi.org/pypi/bdfr/json").json()["info"]["version"]
print(f"You are currently using v{current} the latest is v{latest}")
context.exit()
@click.group()
@click.help_option("-h", "--help")
@click.option(
"--version",
is_flag=True,
is_eager=True,
expose_value=False,
callback=_check_version,
help="Check version and exit.",
)
def cli():
"""BDFR is used to download and archive content from Reddit."""
pass

View File

@@ -12,7 +12,7 @@ class Completion:
self.shell = shell
self.env = os.environ.copy()
self.share_dir = appdirs.user_data_dir()
self.entry_points = ["bdfr"]
self.entry_points = ["bdfr", "bdfr-archive", "bdfr-clone", "bdfr-download"]
def install(self):
if self.shell in ("all", "bash"):