From 0cdbe5d8da89211642dddee9610514c43c5166e1 Mon Sep 17 00:00:00 2001 From: Tyler Burch Date: Sat, 25 Feb 2023 14:47:46 -0500 Subject: [PATCH] Add version method (#320) --- pybaseball/__init__.py | 1 + pybaseball/version.py | 1 + setup.py | 7 ++++++- 3 files changed, 8 insertions(+), 1 deletion(-) create mode 100644 pybaseball/version.py diff --git a/pybaseball/__init__.py b/pybaseball/__init__.py index db80a67c..45d2dd1d 100644 --- a/pybaseball/__init__.py +++ b/pybaseball/__init__.py @@ -97,3 +97,4 @@ from .datasources.fangraphs import (fg_batting_data, fg_pitching_data, fg_team_batting_data, fg_team_fielding_data, fg_team_pitching_data) from .split_stats import get_splits +from .version import __version__ diff --git a/pybaseball/version.py b/pybaseball/version.py new file mode 100644 index 00000000..012423e2 --- /dev/null +++ b/pybaseball/version.py @@ -0,0 +1 @@ +__version__ = "2.2.5" \ No newline at end of file diff --git a/setup.py b/setup.py index 5022ca39..96c5148a 100644 --- a/setup.py +++ b/setup.py @@ -11,6 +11,11 @@ with open(path.join(here, 'README.md'), encoding='utf-8') as f: long_description = f.read() +# Get Version +version_file = path.join(here, "pybaseball", "version.py") +with open(version_file, encoding="utf-8") as f: + version = f.read().split(" = ")[-1].strip('"') + setup( name='pybaseball', @@ -19,7 +24,7 @@ # Versions should comply with PEP440. For a discussion on single-sourcing # the version across setup.py and the project code, see # https://packaging.python.org/en/latest/single_source_version.html - version='2.2.4', + version=version, description='Retrieve baseball data in Python', long_description=long_description,