verkit 0.1.4__tar.gz → 0.1.5__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.4
1
+ Metadata-Version: 2.5
2
2
  Name: verkit
3
- Version: 0.1.4
3
+ Version: 0.1.5
4
4
  Summary: Polyglot project version inspector, promoter, tagger, and release workflow engine
5
5
  Author: Mark Stouffer
6
6
  License: MIT
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "verkit"
7
- version = "0.1.4"
7
+ version = "0.1.5"
8
8
  description = "Polyglot project version inspector, promoter, tagger, and release workflow engine"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.9"
@@ -0,0 +1,25 @@
1
+ """Polyglot project version inspector, promoter, tagger, and release engine."""
2
+
3
+ from verkit.inspector import (
4
+ VersionInfo,
5
+ display_version_info,
6
+ get_installed_version,
7
+ get_latest_pypi_version,
8
+ inspect_committed,
9
+ inspect_project,
10
+ )
11
+ from verkit.promoter import promote_version
12
+ from verkit.tagger import release_version, tag_version
13
+
14
+ __version__ = "0.1.1"
15
+ __all__ = [
16
+ "VersionInfo",
17
+ "inspect_project",
18
+ "inspect_committed",
19
+ "get_installed_version",
20
+ "get_latest_pypi_version",
21
+ "display_version_info",
22
+ "promote_version",
23
+ "tag_version",
24
+ "release_version",
25
+ ]
@@ -3,7 +3,7 @@ import sys
3
3
 
4
4
  from rich.console import Console
5
5
 
6
- from verkit.inspector import inspect_committed, inspect_project
6
+ from verkit.inspector import display_version_info
7
7
  from verkit.promoter import promote_version
8
8
  from verkit.tagger import release_version, tag_version
9
9
 
@@ -51,10 +51,7 @@ def main():
51
51
  console = Console()
52
52
 
53
53
  if not args.command or args.command == "inspect":
54
- info = inspect_project()
55
- committed = inspect_committed()
56
- console.print(f"[bold blue]Working version:[/bold blue] {info.version} (from {info.source or 'unknown'})")
57
- console.print(f"[dim]Committed version (HEAD):[/dim] {committed.version}")
54
+ display_version_info(console, "verkit")
58
55
  return
59
56
 
60
57
  try:
@@ -1,11 +1,63 @@
1
+ import importlib.metadata
1
2
  import json
2
3
  import os
3
4
  import re
4
5
  import subprocess
6
+ import urllib.request
5
7
  from dataclasses import dataclass
6
8
  from pathlib import Path
7
9
  from typing import Optional
8
10
 
11
+ from rich.console import Console
12
+
13
+
14
+ def get_installed_version(package_name: str) -> str:
15
+ """Read the installed package version via importlib.metadata."""
16
+ try:
17
+ return importlib.metadata.version(package_name)
18
+ except Exception:
19
+ return "unknown"
20
+
21
+
22
+ def get_latest_pypi_version(package_name: str, timeout: int = 4) -> Optional[str]:
23
+ """Fetch the latest version of a package from PyPI."""
24
+ url = f"https://pypi.org/pypi/{package_name}/json"
25
+ try:
26
+ with urllib.request.urlopen(url, timeout=timeout) as response:
27
+ data = json.load(response)
28
+ return data["info"]["version"]
29
+ except Exception:
30
+ return None
31
+
32
+
33
+ def display_version_info(
34
+ console: Console,
35
+ package_name: str,
36
+ root: Optional[Path] = None,
37
+ upgrade_cmd: Optional[str] = None,
38
+ ):
39
+ """Display running, PyPI, and local project version information."""
40
+ tool_v = get_installed_version(package_name)
41
+ console.print(f"[bold blue]Running version:[/bold blue] {tool_v}")
42
+
43
+ latest_v = get_latest_pypi_version(package_name)
44
+ if latest_v:
45
+ if latest_v != tool_v:
46
+ console.print(f"[bold yellow]Latest PyPI version:[/bold yellow] {latest_v}")
47
+ if upgrade_cmd:
48
+ console.print(f"[dim]Run [bold]{upgrade_cmd}[/bold] to upgrade.[/dim]")
49
+ else:
50
+ console.print(f"[dim]Latest PyPI version:[/dim] {latest_v} (up to date)")
51
+
52
+ try:
53
+ info = get_project_version(root)
54
+ if info.version != "unknown":
55
+ console.print(
56
+ f"[dim]Local project version:[/dim] {info.version} (from {info.source})"
57
+ )
58
+ except Exception:
59
+ pass
60
+
9
61
 
10
62
  @dataclass
11
63
  class VersionInfo:
@@ -235,7 +235,9 @@ def _commit_version_bump(
235
235
  if msg_res.returncode == 0
236
236
  else "chore: bump version"
237
237
  )
238
- commit_res = _git("commit", "--amend", "-m", existing_msg, cwd=git_root)
238
+ commit_res = _git(
239
+ "commit", "--no-verify", "--amend", "-m", existing_msg, cwd=git_root
240
+ )
239
241
  if commit_res.returncode != 0:
240
242
  err = (commit_res.stderr or commit_res.stdout or "").strip()
241
243
  raise RuntimeError(f"Failed to amend version bump: {err}")
@@ -246,7 +248,7 @@ def _commit_version_bump(
246
248
 
247
249
  if not amend:
248
250
  msg = f"chore(release): v{new_v}"
249
- commit_res = _git("commit", "-m", msg, cwd=git_root)
251
+ commit_res = _git("commit", "--no-verify", "-m", msg, cwd=git_root)
250
252
  if commit_res.returncode != 0:
251
253
  err = (commit_res.stderr or commit_res.stdout or "").strip()
252
254
  if "nothing to commit" in err.lower():
File without changes
@@ -1,14 +0,0 @@
1
- """Polyglot project version inspector, promoter, tagger, and release engine."""
2
-
3
- from verkit.inspector import VersionInfo, inspect_project, inspect_committed
4
- from verkit.promoter import promote_version
5
- from verkit.tagger import tag_version
6
-
7
- __version__ = "0.1.0"
8
- __all__ = [
9
- "VersionInfo",
10
- "inspect_project",
11
- "inspect_committed",
12
- "promote_version",
13
- "tag_version",
14
- ]
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes