-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #25 from ADBond/release/0.2.4
Release - 0.2.4
- Loading branch information
Showing
8 changed files
with
121 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"] |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.