diff --git a/narwhals/__init__.py b/narwhals/__init__.py index 486ee3e16..74c54b0e9 100644 --- a/narwhals/__init__.py +++ b/narwhals/__init__.py @@ -3,6 +3,6 @@ from narwhals.translate import to_original_object from narwhals.translate import to_polars_api -__version__ = "0.2.6" +__version__ = "0.1.8" __all__ = ["to_polars_api", "to_original_object", "get_namespace", "containers"] diff --git a/pyproject.toml b/pyproject.toml index 7f50fb4c7..407767e1c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "hatchling.build" [project] name = "narwhals" -version = "0.1.7" +version = "0.1.8" authors = [ { name="Marco Gorelli", email="33491632+MarcoGorelli@users.noreply.github.com" }, ] diff --git a/utils/bump_version.py b/utils/bump_version.py new file mode 100644 index 000000000..587492fe2 --- /dev/null +++ b/utils/bump_version.py @@ -0,0 +1,34 @@ +# mypy: ignore +# ruff: noqa +import re +import subprocess +import sys + +how = sys.argv[1] + +with open("pyproject.toml", encoding="utf-8") as f: + content = f.read() +old_version = re.search(r'version = "(.*)"', content).group(1) +version = old_version.split(".") +if how == "patch": + version = ".".join(version[:-1] + [str(int(version[-1]) + 1)]) +elif how == "minor": + version = ".".join(version[:-2] + [str(int(version[-2]) + 1), "0"]) +elif how == "major": + version = ".".join([str(int(version[0]) + 1), "0", "0"]) +content = content.replace(f'version = "{old_version}"', f'version = "{version}"') +with open("pyproject.toml", "w", encoding="utf-8") as f: + f.write(content) + +with open("narwhals/__init__.py", encoding="utf-8") as f: + content = f.read() +content = content.replace( + f'__version__ = "{old_version}"', + f'__version__ = "{version}"', +) +with open("narwhals/__init__.py", "w", encoding="utf-8") as f: + f.write(content) + +subprocess.run(["git", "commit", "-a", "-m", f"Bump version to {version}"]) +subprocess.run(["git", "tag", "-a", version, "-m", version]) +subprocess.run(["git", "push", "--follow-tags"])