gitlater 0.2.0__tar.gz → 0.2.1__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.
@@ -5,7 +5,7 @@ repos:
5
5
  - id: pathcrumb-fix
6
6
 
7
7
  - repo: https://github.com/astral-sh/ruff-pre-commit
8
- rev: v0.15.7
8
+ rev: v0.15.9
9
9
  hooks:
10
10
  - id: ruff-check
11
11
  args: [--fix]
@@ -28,8 +28,8 @@ repos:
28
28
  language: system
29
29
  pass_filenames: false
30
30
 
31
- # - repo: https://github.com/cwahyu/gitlater
32
- # rev: v0.1.3
33
- # hooks:
34
- # - id: gitlater-check
35
- # pass_filenames: false
31
+ - repo: https://github.com/cwahyu/gitlater
32
+ rev: v0.2.0
33
+ hooks:
34
+ - id: gitlater-check
35
+ pass_filenames: false
@@ -1,5 +1,9 @@
1
1
  # CHANGELOG
2
2
 
3
+ ## v0.2.1
4
+
5
+ - add `gitlater --version` to display installed version
6
+
3
7
  ## v0.2.0
4
8
 
5
9
  - add embed mode API:
@@ -1,7 +1,7 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: gitlater
3
- Version: 0.2.0
4
- Summary: Respect your time boundaries
3
+ Version: 0.2.1
4
+ Summary: Not now. Later.
5
5
  Project-URL: Homepage, https://github.com/cwahyu/gitlater
6
6
  Project-URL: Repository, https://github.com/cwahyu/gitlater
7
7
  Project-URL: Issues, https://github.com/cwahyu/gitlater/issues
@@ -26,14 +26,14 @@ Description-Content-Type: text/markdown
26
26
 
27
27
  # gitlater
28
28
 
29
- Respect your time boundaries.
29
+ Not now. Later.
30
30
 
31
31
  ## What is this?
32
32
 
33
33
  `gitlater` is a small tool that helps you **do things at the right time**.
34
34
 
35
- Originally built for git commits, it now works anywhere —
36
- CLI, pre-commit, or inside your Python scripts.
35
+ It started with git commits.
36
+ Now it works anywhere — CLI, pre-commit, or inside your Python scripts.
37
37
 
38
38
  It doesn’t optimize productivity.
39
39
  It protects your boundaries.
@@ -50,7 +50,7 @@ But **when** you do it.
50
50
 
51
51
  `gitlater` helps you say:
52
52
 
53
- > Not now. This can wait.”
53
+ > Not now. Later.”
54
54
 
55
55
  ## Features
56
56
 
@@ -64,12 +64,6 @@ But **when** you do it.
64
64
 
65
65
  ## Installation
66
66
 
67
- ### Using pipx (recommended for CLI)
68
-
69
- ```bash
70
- pipx install gitlater
71
- ```
72
-
73
67
  ### Using uv (CLI tool)
74
68
 
75
69
  ```bash
@@ -1,13 +1,13 @@
1
1
  # gitlater
2
2
 
3
- Respect your time boundaries.
3
+ Not now. Later.
4
4
 
5
5
  ## What is this?
6
6
 
7
7
  `gitlater` is a small tool that helps you **do things at the right time**.
8
8
 
9
- Originally built for git commits, it now works anywhere —
10
- CLI, pre-commit, or inside your Python scripts.
9
+ It started with git commits.
10
+ Now it works anywhere — CLI, pre-commit, or inside your Python scripts.
11
11
 
12
12
  It doesn’t optimize productivity.
13
13
  It protects your boundaries.
@@ -24,7 +24,7 @@ But **when** you do it.
24
24
 
25
25
  `gitlater` helps you say:
26
26
 
27
- > Not now. This can wait.”
27
+ > Not now. Later.”
28
28
 
29
29
  ## Features
30
30
 
@@ -38,12 +38,6 @@ But **when** you do it.
38
38
 
39
39
  ## Installation
40
40
 
41
- ### Using pipx (recommended for CLI)
42
-
43
- ```bash
44
- pipx install gitlater
45
- ```
46
-
47
41
  ### Using uv (CLI tool)
48
42
 
49
43
  ```bash
@@ -1,7 +1,7 @@
1
1
  [project]
2
2
  name = "gitlater"
3
- version = "0.2.0"
4
- description = "Respect your time boundaries"
3
+ version = "0.2.1"
4
+ description = "Not now. Later."
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.10"
7
7
  authors = [{ name = "Catur Wahyu" }]
@@ -4,11 +4,16 @@ import sys
4
4
 
5
5
  from gitlater.core import check_allowed, get_status
6
6
  from gitlater.init import run_init
7
+ from gitlater.version import get_version
7
8
 
8
9
 
9
10
  def main() -> None:
10
11
  args = sys.argv[1:]
11
12
 
13
+ if "--version" in args:
14
+ print(f"gitlater {get_version()}")
15
+ return
16
+
12
17
  if not args:
13
18
  print("gitlater: missing command")
14
19
  print("Usage: gitlater [check|status]")
@@ -0,0 +1,18 @@
1
+ # src/gitlater/version.py
2
+
3
+ import importlib.metadata
4
+ from pathlib import Path
5
+
6
+ import tomllib
7
+
8
+
9
+ def get_version() -> str:
10
+ try:
11
+ return importlib.metadata.version("gitlater")
12
+ except importlib.metadata.PackageNotFoundError:
13
+ pyproject = Path.cwd() / "pyproject.toml"
14
+ if pyproject.exists():
15
+ data = tomllib.loads(pyproject.read_text())
16
+ return data["project"]["version"]
17
+
18
+ return "0.0.0"
@@ -0,0 +1,59 @@
1
+ # tests/test_api.py
2
+
3
+
4
+ from gitlater import allow, guard, status
5
+
6
+
7
+ def test_allow_true(monkeypatch):
8
+ monkeypatch.setattr(
9
+ "gitlater.check_allowed",
10
+ lambda: (True, ""),
11
+ )
12
+
13
+ assert allow() is True
14
+
15
+
16
+ def test_allow_false(monkeypatch):
17
+ monkeypatch.setattr(
18
+ "gitlater.check_allowed",
19
+ lambda: (False, "blocked"),
20
+ )
21
+
22
+ assert allow() is False
23
+
24
+
25
+ def test_status(monkeypatch):
26
+ monkeypatch.setattr(
27
+ "gitlater.check_allowed",
28
+ lambda: (False, "message"),
29
+ )
30
+
31
+ allowed, message = status()
32
+
33
+ assert allowed is False
34
+ assert message == "message"
35
+
36
+
37
+ def test_guard_allowed(monkeypatch):
38
+ monkeypatch.setattr(
39
+ "gitlater.check_allowed",
40
+ lambda: (True, ""),
41
+ )
42
+
43
+ # should NOT exit
44
+ guard()
45
+
46
+
47
+ def test_guard_blocked(monkeypatch, capsys):
48
+ monkeypatch.setattr(
49
+ "gitlater.check_allowed",
50
+ lambda: (False, "blocked message"),
51
+ )
52
+
53
+ try:
54
+ guard()
55
+ except SystemExit as e:
56
+ assert e.code == 1
57
+
58
+ captured = capsys.readouterr()
59
+ assert "blocked message" in captured.out
@@ -0,0 +1,52 @@
1
+ # tests/test_version.py
2
+
3
+
4
+ import importlib.metadata
5
+
6
+ from gitlater.version import get_version
7
+
8
+
9
+ def test_get_version_from_installed_package(monkeypatch):
10
+ # simulate installed package
11
+ monkeypatch.setattr(
12
+ importlib.metadata,
13
+ "version",
14
+ lambda name: "1.2.3",
15
+ )
16
+
17
+ assert get_version() == "1.2.3"
18
+
19
+
20
+ def test_get_version_from_pyproject(tmp_path, monkeypatch):
21
+ # simulate package not installed
22
+ def raise_not_found(name):
23
+ raise importlib.metadata.PackageNotFoundError
24
+
25
+ monkeypatch.setattr(importlib.metadata, "version", raise_not_found)
26
+
27
+ # create fake pyproject.toml
28
+ pyproject = tmp_path / "pyproject.toml"
29
+ pyproject.write_text(
30
+ """
31
+ [project]
32
+ version = "0.9.0"
33
+ """
34
+ )
35
+
36
+ # change working directory
37
+ monkeypatch.chdir(tmp_path)
38
+
39
+ assert get_version() == "0.9.0"
40
+
41
+
42
+ def test_get_version_default(monkeypatch, tmp_path):
43
+ # simulate package not installed
44
+ def raise_not_found(name):
45
+ raise importlib.metadata.PackageNotFoundError
46
+
47
+ monkeypatch.setattr(importlib.metadata, "version", raise_not_found)
48
+
49
+ # empty directory (no pyproject.toml)
50
+ monkeypatch.chdir(tmp_path)
51
+
52
+ assert get_version() == "0.0.0"
@@ -170,7 +170,7 @@ wheels = [
170
170
 
171
171
  [[package]]
172
172
  name = "gitlater"
173
- version = "0.2.0"
173
+ version = "0.2.1"
174
174
  source = { editable = "." }
175
175
 
176
176
  [package.dev-dependencies]
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes