Skip to content

Commit

Permalink
Merge pull request #25 from ADBond/release/0.2.4
Browse files Browse the repository at this point in the history
Release - 0.2.4
  • Loading branch information
ADBond authored Sep 19, 2024
2 parents bdb144b + d5ab486 commit 5f0ab9b
Show file tree
Hide file tree
Showing 8 changed files with 121 additions and 6 deletions.
5 changes: 4 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## Unreleased

## [0.2.4] - 2024-09-19

## Added

- Extended `ClickhouseAPI` pandas table registration to support float columns [#24](https://github.com/ADBond/splinkclickhouse/pull/24)
Expand Down Expand Up @@ -58,7 +60,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

- Basic working version of package with api for `chdb`

[unreleased]: https://github.com/ADBond/splinkclickhouse/compare/v0.2.3...HEAD
[unreleased]: https://github.com/ADBond/splinkclickhouse/compare/v0.2.4...HEAD
[0.2.4]: https://github.com/ADBond/splinkclickhouse/compare/v0.2.3...v0.2.4
[0.2.3]: https://github.com/ADBond/splinkclickhouse/compare/v0.2.2...v0.2.3
[0.2.2]: https://github.com/ADBond/splinkclickhouse/compare/v0.2.1...v0.2.2
[0.2.1]: https://github.com/ADBond/splinkclickhouse/compare/v0.2.0...v0.2.1
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ pip install splinkclickhouse
Alternatively you can install the package from github:

```sh
# for v0.2.3 - replace with any version you want, or specify a branch after '@'
pip install git+https://github.com/ADBond/[email protected]
pip install git+https://github.com/ADBond/splinkclickhouse.git@v0.2.4
# Replace with any version you want, or specify a branch after '@'
```

## Use
Expand Down
8 changes: 8 additions & 0 deletions dev.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,14 @@ uv run python scripts/getting_started_chdb.py
uv run python scripts/getting_started_clickhouse.py
```

## Bump package version

From root of repo:

```sh
./scripts/bump_version.sh X.X.X
```

## Build

Build package to `dist/`
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "splinkclickhouse"
version = "0.2.3"
version = "0.2.4"
description = "Clickhouse backend support for Splink"
authors = [{name = "Andrew Bond"}]
license = {text = "MIT License"}
Expand Down
10 changes: 10 additions & 0 deletions scripts/bump_version.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash

set -euo pipefail

echo Updating files for version: $1

uv run scripts/update_version.py $1
uv sync

echo Done!
94 changes: 94 additions & 0 deletions scripts/update_version.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
# script to update package version in relevant files
# this is not fancy, so you should probably check results
# run from repo root.

import argparse
import re
from datetime import datetime
from pathlib import Path

parser = argparse.ArgumentParser(
prog="VersionUpdater", description="Update files for new package version"
)
parser.add_argument("new_version", help="New version number in X.X.X format")
args = parser.parse_args()
new_version = args.new_version

version_format = r"[0-9]+\.[0-9]+\.[0-9]+"
if not re.search(version_format, new_version):
raise ValueError(f"Bad version supplied: {new_version}. Should be 'X.X.X' format")

package_file = Path("splinkclickhouse") / "__init__.py"
pyproject_file = Path(".") / "pyproject.toml"
readme_file = Path(".") / "README.md"
changelog_file = Path(".") / "CHANGELOG.md"

with open(package_file, "r") as f:
init_text = f.read()

with open(pyproject_file, "r") as f:
pyproject_text = f.read()

with open(readme_file, "r") as f:
readme_text = f.read()

init_version_template = '__version__ = "{version_literal}"'
pyproject_version_template = 'version = "{version_literal}"'
readme_version_template = "splinkclickhouse.git@v{version_literal}"

version_regex_group = f"({version_format})"

init_version_regex = init_version_template.format(version_literal=version_regex_group)

m = re.search(init_version_regex, init_text)
prev_version = m.group(1)

if new_version == prev_version:
raise ValueError(
f"You haven't incremented version! Received current version {prev_version}"
)

updated_init_text = re.sub(
init_version_regex,
init_version_template.format(version_literal=new_version),
init_text,
)
updated_pyproject_text = re.sub(
pyproject_version_template.format(version_literal=version_regex_group),
pyproject_version_template.format(version_literal=new_version),
pyproject_text,
)
updated_readme_text = re.sub(
readme_version_template.format(version_literal=version_regex_group),
readme_version_template.format(version_literal=new_version),
readme_text,
)

with open(package_file, "w+") as f:
f.write(updated_init_text)

with open(pyproject_file, "w+") as f:
f.write(updated_pyproject_text)

with open(readme_file, "w+") as f:
f.write(updated_readme_text)

# update changelog - takes a different format from the others
release_date = datetime.today().strftime("%Y-%m-%d")

with open(changelog_file, "r") as f:
changelog_text = f.read()

updated_changelog_text = changelog_text.replace(
"## Unreleased", f"## Unreleased\n\n## [{new_version}] - {release_date}"
)
unreleased_link_template = "[unreleased]: https://github.com/ADBond/splinkclickhouse/compare/v{version_literal}...HEAD"
new_link = f"[{new_version}]: https://github.com/ADBond/splinkclickhouse/compare/v{prev_version}...v{new_version}"

updated_changelog_text = updated_changelog_text.replace(
unreleased_link_template.format(version_literal=prev_version),
unreleased_link_template.format(version_literal=new_version) + "\n" + new_link,
)

with open(changelog_file, "w+") as f:
f.write(updated_changelog_text)
2 changes: 1 addition & 1 deletion splinkclickhouse/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from .chdb.database_api import ChDBAPI
from .clickhouse.database_api import ClickhouseAPI

__version__ = "0.2.3"
__version__ = "0.2.4"

__all__ = ["ChDBAPI", "ClickhouseAPI"]
2 changes: 1 addition & 1 deletion uv.lock

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

0 comments on commit 5f0ab9b

Please sign in to comment.