From d21bc6ff35fe0683e32c5f3e2c06d2ceb17a9577 Mon Sep 17 00:00:00 2001 From: NISH1001 Date: Sun, 3 May 2020 13:34:32 +0545 Subject: [PATCH] Seggregate versionning to a separate variable Add `__version__` string to `version.py`. Now, running `playx --version` gives a version. --- playx/__init__.py | 2 ++ playx/main.py | 2 ++ playx/version.py | 1 + setup.py | 4 +++- 4 files changed, 8 insertions(+), 1 deletion(-) create mode 100644 playx/version.py diff --git a/playx/__init__.py b/playx/__init__.py index 6f36482..b8acae1 100644 --- a/playx/__init__.py +++ b/playx/__init__.py @@ -1,3 +1,5 @@ +from .version import __version__ + name = "playx" __all__ = [ diff --git a/playx/main.py b/playx/main.py index 857a2ef..e89888d 100644 --- a/playx/main.py +++ b/playx/main.py @@ -6,6 +6,7 @@ import argparse +from .version import __version__ from playx.logger import Logger from playx.cache import Cache, clean_url_cache @@ -31,6 +32,7 @@ def parse(): the github\ (https://github.com/NISH1001/playx) page" ) + parser.add_argument("--version", action="version", version=__version__) parser.add_argument( "song", help="Name or youtube link of song to download", diff --git a/playx/version.py b/playx/version.py new file mode 100644 index 0000000..5197c5f --- /dev/null +++ b/playx/version.py @@ -0,0 +1 @@ +__version__ = "1.5.2" diff --git a/setup.py b/setup.py index 79a731f..a1f8760 100644 --- a/setup.py +++ b/setup.py @@ -1,5 +1,7 @@ from setuptools import setup +exec(open("playx/version.py").read()) + setup( name="playx", packages=["playx", "playx.playlist"], @@ -9,7 +11,7 @@ long_description="Search and play any song from terminal seamlessly.", url="http://github.com/NISH1001/playx", entry_points={"console_scripts": ["playx = playx.main:main"]}, - version="1.5.2", + version=__version__, license="MIT", install_requires=["youtube_dl", "requests", "beautifulsoup4", "selenium", "lxml",], )