Skip to content

Commit 4508fb9

Browse files
committed
fix: minor issues before release
1 parent 65ba195 commit 4508fb9

7 files changed

Lines changed: 57 additions & 7 deletions

File tree

CONTRIBUTING.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,9 @@ The project includes a `Makefile` with convenient commands for common developmen
186186
| `make check` | Run lint + test (full CI check) |
187187
| `make run` | Run bitssh CLI |
188188
| `make build` | Build distribution packages |
189+
| `make bumpver-patch` | Bump patch version (e.g. 3.7.0 → 3.7.1) |
190+
| `make bumpver-minor` | Bump minor version (e.g. 3.7.0 → 3.8.0) |
191+
| `make bumpver-major` | Bump major version (e.g. 3.7.0 → 4.0.0) |
189192
| `make clean` | Remove build artifacts, caches, and venv |
190193

191194
## Styleguides
@@ -222,3 +225,31 @@ Examples:
222225
- `fix(utils): handle missing SSH config gracefully`
223226
- `docs: update installation instructions`
224227
- `test(cli): add tests for argument parsing`
228+
229+
### Version Bumping
230+
231+
This project uses [bumpver](https://github.com/mbarkhau/bumpver) for version management. The version is defined in a single place — `src/bitssh/_version.py` — and everything else reads from it:
232+
233+
| File | What it does |
234+
|---|---|
235+
| `src/bitssh/_version.py` | Single source of truth: `__version__ = "3.7.0"` |
236+
| `pyproject.toml``[tool.setuptools.dynamic]` | Reads version from `_version.py` at build time |
237+
| `pyproject.toml``[tool.bumpver]` | Tracks the current version for bumpver CLI |
238+
| `src/bitssh/__init__.py` | Imports `__version__` from `_version.py`, overrides with `importlib.metadata` at runtime |
239+
240+
To bump the version, use one of these make commands:
241+
242+
```bash
243+
make bumpver-patch # 3.7.0 → 3.7.1
244+
make bumpver-minor # 3.7.0 → 3.8.0
245+
make bumpver-major # 3.7.0 → 4.0.0
246+
```
247+
248+
Each command will:
249+
250+
1. Update `__version__` in `src/bitssh/_version.py`
251+
2. Update `current_version` in `pyproject.toml` `[tool.bumpver]`
252+
3. Create a git commit with the message `"Bump version {old} -> {new}"`
253+
4. Create a git tag (e.g. `v3.7.1`)
254+
255+
> **Note:** bumpver does **not** push to remote by default (`push = false`). You need to `git push && git push --tags` manually when ready.

Makefile

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
.PHONY: setup install dev test lint format clean build run check help
1+
.PHONY: setup install dev test lint format clean build run check bumpver help
22

33
UV ?= uv
44

@@ -36,4 +36,13 @@ clean: ## Remove build artifacts, caches, and the venv
3636
run: ## Run the CLI directly
3737
$(UV) run bitssh
3838

39-
check: lint test ## Run lint + test (full CI check)
39+
check: lint test ## Run lint + test (full CI check)
40+
41+
bumpver-major: ## Bump major version (e.g. 3.7.0 -> 4.0.0)
42+
$(UV) run bumpver update --major
43+
44+
bumpver-minor: ## Bump minor version (e.g. 3.7.0 -> 3.8.0)
45+
$(UV) run bumpver update --minor
46+
47+
bumpver-patch: ## Bump patch version (e.g. 3.7.0 -> 3.7.1)
48+
$(UV) run bumpver update --patch

pyproject.toml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,15 @@
22
requires = ["setuptools>=80.9.0", "wheel"]
33
build-backend = "setuptools.build_meta"
44

5+
[tool.setuptools.dynamic]
6+
version = {attr = "bitssh._version.__version__"}
7+
8+
[tool.setuptools.packages.find]
9+
where = ["src"]
10+
511
[project]
612
name = "bitssh"
7-
version = "3.7.0"
13+
dynamic = ["version"]
814
description = "A new and modern SSH connector written in Python."
915
readme = "README.md"
1016
license = "MIT"
@@ -61,7 +67,8 @@ tag = true
6167
push = false
6268

6369
[tool.bumpver.file_patterns]
64-
"pyproject.toml" = ['current_version = "{version}"', 'version = "{version}"']
70+
"src/bitssh/_version.py" = ['__version__ = "{version}"']
71+
"pyproject.toml" = ['current_version = "{version}"']
6572

6673
[tool.pytest.ini_options]
6774
pythonpath = ["src"]

src/bitssh/__init__.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1+
from ._version import __version__
2+
13
try:
24
from importlib.metadata import version
35

46
__version__ = version("bitssh")
57
except Exception: # pragma: no cover
6-
__version__ = "0.0.0"
8+
pass

src/bitssh/_version.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
__version__ = "3.7.0"

src/bitssh/cli.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,4 +85,4 @@ def run():
8585
except KeyboardInterrupt:
8686
pass
8787
except Exception as e:
88-
print(f"Error Happed {e}")
88+
print(f"Error Happened: {e}")

src/bitssh/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ def _ensure_config_file() -> None:
2121
if not os.path.exists(CONFIG_FILE_PATH):
2222
with open(CONFIG_FILE_PATH, "w", encoding="utf-8") as f:
2323
f.write("")
24-
os.chmod(CONFIG_FILE_PATH, 0o644)
24+
os.chmod(CONFIG_FILE_PATH, 0o600)
2525

2626

2727
def get_config_content():

0 commit comments

Comments
 (0)