From 6ea332599e6568ce18f4f39cbc8db434d6626d4a Mon Sep 17 00:00:00 2001 From: Marouane Skandaji Date: Fri, 20 Jan 2023 02:36:21 +0100 Subject: [PATCH] [fix;chore]: add a version flag for the cli --- README.md | 1 + imdb_rating_classifier/__init__.py | 5 +++++ imdb_rating_classifier/generate.py | 2 ++ setup.cfg | 2 +- 4 files changed, 9 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 0525665..a094cd6 100644 --- a/README.md +++ b/README.md @@ -205,6 +205,7 @@ tested using tox as an environment orchestrator and GitHub Actions. - [ ] Add more features - [X] Publish the package on PyPI - [ ] Add oscar awards or nominations for the movies +- [X] Add a version switch for the cli ## License diff --git a/imdb_rating_classifier/__init__.py b/imdb_rating_classifier/__init__.py index e69de29..03fc6bc 100644 --- a/imdb_rating_classifier/__init__.py +++ b/imdb_rating_classifier/__init__.py @@ -0,0 +1,5 @@ +""" +imdb_rating_classifier +~~~~~~~~~~~~~~~~~~~~~~ +""" +__version__ = '0.1.4' diff --git a/imdb_rating_classifier/generate.py b/imdb_rating_classifier/generate.py index 5445178..4fa7321 100644 --- a/imdb_rating_classifier/generate.py +++ b/imdb_rating_classifier/generate.py @@ -10,6 +10,7 @@ import pandas as pd sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) +from imdb_rating_classifier import __version__ # noqa: E402 from imdb_rating_classifier.penalizer import penalize_reviews # noqa: E402 from imdb_rating_classifier.schema import MovieChart, validate # noqa: E402 from imdb_rating_classifier.scraper import Scraper, logger # noqa: E402 @@ -25,6 +26,7 @@ context_settings=CONTEXT_SETTINGS, help='Application entry point for IMDB rating classifier.', ) +@click.version_option(version=__version__, prog_name='IMDB Rating Classifier') @click.pass_context def main(ctx: click.Context) -> None: """ diff --git a/setup.cfg b/setup.cfg index 4641f32..68f49d0 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,6 @@ [metadata] name = imdb_rating_classifier -version = 0.1.3 +version = attr: imdb_rating_classifier.__version__ description = An application that scrapes data from IMDB and adjusts rating based on some rulesets. long_description = file: README.md long_description_content_type = text/markdown