Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
## v0.5.39.1

### Features

### Changes

- **Dependency Update**: Upgraded certifi to 2026.10.19 to fix [GHSA-6q48-6c7w-9gw2](https://github.com/advisories/GHSA-6q48-6c7w-9gw2)

### Fixes

- **Dump**: `sinistral dump` now loads the Terraform provider before it runs, so it no longer fails with `AttributeError: 'NoneType' object has no attribute 'initialize'`

### Other

---

## v0.5.39

### Features
Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "stacklet.client.sinistral"
version = "0.5.39"
version = "0.5.39.1"
Comment thread
jtroup marked this conversation as resolved.
description = "Sinistral CLI"
maintainers = [ { name = "Stacklet Engineering", email = "foss+sinistral-cli@stacklet.io" } ]
authors = [ { name = "Stacklet Engineering", email = "foss+sinistral-cli@stacklet.io" } ]
Expand Down Expand Up @@ -32,12 +32,12 @@ dev = [
"ipdb>=0.13.13,<0.14",
"jsonref>=1.1.0,<2",
"moto[cognitoidp]>=5,<6",
"packaging>=26,<27",
"pre-commit>=4.3.0,<5",
"pytest-cov>=7,<8",
"pytest>=8,<9",
"python-jose>=3.3.0,<4",
"ruff>=0.13.0",
"semver>=3.0.4,<4",
"tomlkit>=0.13.2,<0.14",
]

Expand Down
13 changes: 8 additions & 5 deletions scripts/upgrade.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import sys

import click
import semver
import tomlkit

from packaging.version import Version


@click.group()
def cli():
Expand All @@ -18,28 +19,30 @@ def cli():
@click.option("--bump-major", is_flag=True, default=False)
def upgrade(bump_patch, bump_minor, bump_major):
if sum([bump_patch, bump_minor, bump_major]) != 1:
click.echo("Only one of --bump-patch/mintor/major may be selected")
click.echo("Only one of --bump-patch/minor/major may be selected")
sys.exit(1)

with open("pyproject.toml") as f:
pyproject = tomlkit.load(f)

current = pyproject["project"]["version"]
current_parsed = semver.VersionInfo.parse(current)
current_parsed = Version(str(current))

major = current_parsed.major
minor = current_parsed.minor
patch = current_parsed.patch
patch = current_parsed.micro

if bump_patch:
patch += 1
elif bump_minor:
minor += 1
patch = 0
elif bump_major:
major += 1
minor = patch = 0

upgraded = ".".join([str(x) for x in (major, minor, patch)])
click.echo(f"sinistral-cli: {current_parsed} -> {upgraded}")
click.echo(f"sinistral-cli: {current} -> {upgraded}")
pyproject["project"]["version"] = upgraded

with open("pyproject.toml", "w+") as f:
Expand Down
64 changes: 64 additions & 0 deletions tests/test_upgrade_script.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# Copyright Stacklet, Inc.
# SPDX-License-Identifier: Apache-2.0
import importlib.util

from pathlib import Path

import pytest
import tomlkit

from click.testing import CliRunner


SCRIPT = Path(__file__).parent.parent / "scripts" / "upgrade.py"


@pytest.fixture
def upgrade_cli():
spec = importlib.util.spec_from_file_location("upgrade", SCRIPT)
assert spec and spec.loader
module = importlib.util.module_from_spec(spec)
spec.loader.exec_module(module)
return module.cli


def write_pyproject(path, version):
(path / "pyproject.toml").write_text(f'[project]\nversion = "{version}"\n')


def read_version(path):
return tomlkit.loads((path / "pyproject.toml").read_text())["project"]["version"]


@pytest.mark.parametrize(
"current,flag,expected",
[
("0.5.39", "--bump-patch", "0.5.40"),
("0.5.39", "--bump-minor", "0.6.0"),
("0.5.39", "--bump-major", "1.0.0"),
("0.5.39.1", "--bump-patch", "0.5.40"),
("0.5.39.1", "--bump-minor", "0.6.0"),
("0.5.39.1", "--bump-major", "1.0.0"),
],
)
def test_upgrade_bumps_version(upgrade_cli, tmp_path, monkeypatch, current, flag, expected):
write_pyproject(tmp_path, current)
monkeypatch.chdir(tmp_path)

result = CliRunner().invoke(upgrade_cli, ["upgrade", flag])

assert result.exit_code == 0, result.output
assert f"{current} -> {expected}" in result.output
assert read_version(tmp_path) == expected


@pytest.mark.parametrize("flags", [[], ["--bump-patch", "--bump-minor"]])
def test_upgrade_requires_exactly_one_flag(upgrade_cli, tmp_path, monkeypatch, flags):
write_pyproject(tmp_path, "0.5.39")
monkeypatch.chdir(tmp_path)

result = CliRunner().invoke(upgrade_cli, ["upgrade", *flags])

assert result.exit_code == 1
assert "Only one of --bump-patch/minor/major may be selected" in result.output
assert read_version(tmp_path) == "0.5.39"
15 changes: 3 additions & 12 deletions uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading