File tree Expand file tree Collapse file tree 5 files changed +28
-5
lines changed Expand file tree Collapse file tree 5 files changed +28
-5
lines changed Original file line number Diff line number Diff line change 11[run]
2- omit = pip_tree/cli.py
2+ omit =
3+ pip_tree/cli.py
4+ pip_tree/_version.py
Original file line number Diff line number Diff line change 11# CHANGELOG
22
3+ ## v3.1.0 (2023-08-24)
4+
5+ - Adds ` --version ` flag
6+
37## v3.0.0 (2023-07-01)
48
59- Drop support for Python 3.7
Original file line number Diff line number Diff line change 1+ __version__ = '3.1.0'
Original file line number Diff line number Diff line change 22import json
33
44import pip_tree
5+ from pip_tree ._version import __version__
56
67
78class PipTreeCli :
@@ -20,6 +21,11 @@ def __init__(self):
2021 ' the virtual environment Pip Tree is run from will be used.'
2122 ),
2223 )
24+ parser .add_argument (
25+ '--version' ,
26+ action = 'version' ,
27+ version = f'%(prog)s { __version__ } ' ,
28+ )
2329 parser .parse_args (namespace = self )
2430
2531 def generate_console_output (self ):
Original file line number Diff line number Diff line change 1+ import re
2+
13import setuptools
24
35
4- with open ('README.md' , 'r' ) as fh :
5- long_description = fh .read ()
6+ with open ('README.md' , 'r' ) as readme_file :
7+ long_description = readme_file .read ()
8+
9+ # Inspiration: https://stackoverflow.com/a/7071358/6064135
10+ with open ('pip_tree/_version.py' , 'r' ) as version_file :
11+ version_groups = re .search (r"^__version__ = ['\"]([^'\"]*)['\"]" , version_file .read (), re .M )
12+ if version_groups :
13+ version = version_groups .group (1 )
14+ else :
15+ raise RuntimeError ('Unable to find version string!' )
616
717DEV_REQUIREMENTS = [
818 'bandit == 1.7.*' ,
919 'black == 23.*' ,
1020 'build == 0.10.*' ,
1121 'flake8 == 6.*' ,
1222 'isort == 5.*' ,
13- 'mypy == 1.3 .*' ,
23+ 'mypy == 1.5 .*' ,
1424 'pytest == 7.*' ,
1525 'pytest-cov == 4.*' ,
1626 'twine == 4.*' ,
1929
2030setuptools .setup (
2131 name = 'pip-tree' ,
22- version = '3.0.0' ,
32+ version = version ,
2333 description = 'Get the dependency tree of your Python virtual environment via Pip.' ,
2434 long_description = long_description ,
2535 long_description_content_type = "text/markdown" ,
You can’t perform that action at this time.
0 commit comments