Skip to content

Commit a3ba6eb

Browse files
authored
add version cmd and version in title & bump version (#27)
* add version cmd and version in title * drop support for python 3.8
1 parent 11849cc commit a3ba6eb

File tree

5 files changed

+21
-10
lines changed

5 files changed

+21
-10
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ jobs:
99
runs-on: ubuntu-latest
1010
strategy:
1111
matrix:
12-
python-version: ["3.8", "3.9", "3.10"]
12+
python-version: ["3.9", "3.10"]
1313
steps:
1414
- uses: actions/checkout@v4
1515

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ jobs:
7777
if: steps.check_tag.outputs.exists != 'true'
7878
uses: actions/setup-python@v4
7979
with:
80-
python-version: '3.8'
80+
python-version: '3.9'
8181

8282
# Install build tools
8383
- name: Install build tools

pyproject.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
[project]
22
name = "prime-cli"
3-
version = "0.2.6"
3+
version = "0.2.7"
44
description = "Prime Intellect CLI"
55
readme = "README.md"
6-
requires-python = ">=3.8"
6+
requires-python = ">=3.9"
77
license = "MIT"
88
authors = [
99
{ name = "Prime Intellect", email = "contact@primeintellect.ai" }
@@ -64,7 +64,7 @@ extend-select = [
6464
]
6565

6666
[tool.mypy]
67-
python_version = "3.8"
67+
python_version = "3.9"
6868
disallow_untyped_defs = true
6969
check_untyped_defs = true
7070
warn_redundant_casts = true

src/prime_cli/config.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,8 @@ def _ensure_config_dir(self) -> None:
4040
def _load_config(self) -> None:
4141
"""Load configuration from file"""
4242
if self.config_file.exists():
43-
self.config = ConfigModel(
44-
**json.loads(self.config_file.read_text())
45-
).model_dump()
43+
config_data = json.loads(self.config_file.read_text())
44+
self.config = ConfigModel(**config_data).model_dump()
4645
else:
4746
self.config = {}
4847

src/prime_cli/main.py

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,31 @@
1+
from importlib.metadata import version
2+
13
import typer
24

35
from .commands.availability import app as availability_app
46
from .commands.config import app as config_app
57
from .commands.pods import app as pods_app
68

7-
app = typer.Typer(name="prime", help="Prime Intellect CLI")
9+
__version__ = version("prime-cli")
10+
11+
app = typer.Typer(name="prime", help=f"Prime Intellect CLI (v{__version__})")
812

913
app.add_typer(availability_app, name="availability")
1014
app.add_typer(config_app, name="config")
1115
app.add_typer(pods_app, name="pods")
1216

1317

1418
@app.callback(invoke_without_command=True)
15-
def callback(ctx: typer.Context) -> None:
19+
def callback(
20+
ctx: typer.Context,
21+
version_flag: bool = typer.Option(
22+
False, "--version", "-v", help="Show version and exit"
23+
),
24+
) -> None:
1625
"""Prime Intellect CLI"""
26+
if version_flag:
27+
typer.echo(f"Prime CLI version: {__version__}")
28+
raise typer.Exit()
1729
if ctx.invoked_subcommand is None:
1830
ctx.get_help()
1931

0 commit comments

Comments
 (0)