Skip to content

Commit

Permalink
- added --version and coverup.__version__;
Browse files Browse the repository at this point in the history
  • Loading branch information
jaltmayerpizzorno committed May 20, 2024
1 parent c06d376 commit 7ed7ade
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 3 deletions.
3 changes: 1 addition & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
[project]
name = "CoverUp"
description = "LLM-powered test coverage improver"
dynamic = ["readme"]
version = "0.2.0"
dynamic = ["readme", "version"]
authors = [
{ name="Juan Altmayer Pizzorno", email="[email protected]" },
{ name="Emery Berger", email="[email protected]" }
Expand Down
5 changes: 4 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@
import tomli as tomllib

def get_version():
return tomllib.loads(Path("pyproject.toml").read_text())['project']['version']
import re
v = re.findall(r"^__version__ *= *\"([^\"]+)\"", Path("src/coverup/version.py").read_text())[0]
return v

def get_url():
return tomllib.loads(Path("pyproject.toml").read_text())['project']['urls']['Repository']
Expand All @@ -26,6 +28,7 @@ def long_description():

if __name__ == "__main__":
setuptools.setup(
version=get_version(),
long_description=long_description(),
long_description_content_type="text/markdown",
)
1 change: 1 addition & 0 deletions src/coverup/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
from .version import __version__
from .coverup import main
4 changes: 4 additions & 0 deletions src/coverup/coverup.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
from .llm import *
from .segment import *
from .testrunner import *
from .version import __version__
from . import prompt


Expand Down Expand Up @@ -144,6 +145,9 @@ def positive_int(value):
ap.add_argument('--max-concurrency', type=positive_int, default=50,
help='maximum number of parallel requests; 0 means unlimited')

ap.add_argument('--version', action='version',
version=f"%(prog)s v{__version__} (Python {'.'.join(map(str, sys.version_info[:3]))})")

args = ap.parse_args(args)

for i in range(len(args.source_files)):
Expand Down

0 comments on commit 7ed7ade

Please sign in to comment.