Skip to content

Commit 672f386

Browse files
author
Romamo
committed
chore: release v0.2.1
1 parent b82a4d9 commit 672f386

File tree

7 files changed

+123
-442
lines changed

7 files changed

+123
-442
lines changed

.github/workflows/ci.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@ jobs:
1212
strategy:
1313
matrix:
1414
python-version:
15-
- "3.9"
1615
- "3.10"
1716
- "3.11"
1817
- "3.12"
1918
- "3.13"
2019
- "3.14"
20+
- "3.15"
2121
fail-fast: false
2222
steps:
2323
- name: Checkout
@@ -35,3 +35,6 @@ jobs:
3535

3636
- name: Run tests
3737
run: uv run pytest
38+
39+
- name: Smoke test
40+
run: uv run python tests/smoke_test.py

CHANGELOG.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,18 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [0.2.1] - 2026-02-27
9+
10+
### Added
11+
- Added `--version` flag to the CLI for easier version tracking.
12+
- Implemented a comprehensive smoke test suite in `tests/smoke_test.py`.
13+
14+
### Changed
15+
- Bumped minimum Python version to 3.10 to support PEP 604 union types (`|` syntax).
16+
- Updated CI workflow to test against Python 3.10 through 3.15.
17+
- Fixed import sorting in `cli.py` to comply with Ruff rules.
18+
- Dropped support for Python 3.9.
19+
820
## [0.2.0] - 2026-02-27
921

1022
### Changed

pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
[project]
22
name = "beancount-cli"
3-
version = "0.2.0"
3+
version = "0.2.1"
44
description = "A CLI tool to manage Beancount ledgers"
55
readme = "README.md"
66
authors = [
77
{ name = "Roman Medvedev", email = "pypi@romavm.dev" }
88
]
99
license = { text = "MIT" }
10-
requires-python = ">=3.9"
10+
requires-python = ">=3.10"
1111
dependencies = [
1212
"beancount>=3.0.0",
1313
"beanquery>=0.1.0",

src/beancount_cli/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = "0.2.0"
1+
__version__ = "0.2.1"

src/beancount_cli/cli.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
from decimal import Decimal
77
from pathlib import Path
88

9+
from beancount_cli import __version__
910
from beancount_cli.config import CliConfig
1011
from beancount_cli.formatting import Console, Table, Tree, render_output
1112
from beancount_cli.models import AccountModel, TransactionModel
@@ -598,6 +599,9 @@ def main(args=None):
598599
parser.add_argument(
599600
"--file", "-f", dest="ledger_file", type=Path, help="Path to main.beancount file"
600601
)
602+
parser.add_argument(
603+
"--version", action="version", version=f"beancount-cli {__version__}", help="Show version"
604+
)
601605
parser.add_argument(
602606
"--format", choices=["table", "json", "csv"], default="table", help="Global output format"
603607
)

tests/smoke_test.py

Lines changed: 69 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,76 @@
1-
# EDIT: Import your main class or module here
2-
# from your_package import YourMainClass
1+
import subprocess
2+
import sys
3+
import tempfile
4+
from pathlib import Path
35

46

57
def test_smoke():
6-
print("Smoke test starting...")
7-
# EDIT: Add real functionality verification
8-
# e.g., result = YourMainClass.method()
9-
# assert result is not None
8+
"""
9+
Basic smoke test to ensure the CLI is functional and can be imported.
10+
"""
11+
print("Running smoke test...")
12+
13+
# 1. Check help command
14+
# Using sys.executable -m to ensure we test the current environment
15+
result = subprocess.run(
16+
[sys.executable, "-m", "beancount_cli.cli", "--help"],
17+
capture_output=True,
18+
text=True,
19+
check=False,
20+
)
21+
assert result.returncode == 0
22+
assert "Beancount CLI tool" in result.stdout
23+
24+
# 2. Check version command
25+
result = subprocess.run(
26+
[sys.executable, "-m", "beancount_cli.cli", "--version"],
27+
capture_output=True,
28+
text=True,
29+
check=False,
30+
)
31+
assert result.returncode == 0
32+
assert "beancount-cli" in result.stdout
33+
34+
# 3. Check transaction schema command
35+
result = subprocess.run(
36+
[sys.executable, "-m", "beancount_cli.cli", "transaction", "schema"],
37+
capture_output=True,
38+
text=True,
39+
check=False,
40+
)
41+
assert result.returncode == 0
42+
assert "TransactionModel" in result.stdout
43+
44+
# 4. Check with a minimal ledger file
45+
with tempfile.NamedTemporaryFile(mode="w", suffix=".beancount", delete=False) as f:
46+
f.write('2023-01-01 open Assets:Cash USD\n')
47+
temp_path = Path(f.name)
48+
49+
try:
50+
result = subprocess.run(
51+
[sys.executable, "-m", "beancount_cli.cli", "check", str(temp_path)],
52+
capture_output=True,
53+
text=True,
54+
check=False,
55+
)
56+
assert result.returncode == 0
57+
assert "No errors found" in result.stdout
58+
finally:
59+
if temp_path.exists():
60+
temp_path.unlink()
61+
1062
print("Smoke test passed.")
1163

1264

1365
if __name__ == "__main__":
14-
test_smoke()
66+
try:
67+
test_smoke()
68+
except AssertionError as e:
69+
print(f"Smoke test failed: {e}")
70+
sys.exit(1)
71+
except Exception as e:
72+
print(f"An error occurred: {e}")
73+
import traceback
74+
75+
traceback.print_exc()
76+
sys.exit(1)

0 commit comments

Comments
 (0)