From fdffbe6b6724eceba20b18d5b0d90f91d9410177 Mon Sep 17 00:00:00 2001 From: Christopher Dignam Date: Mon, 16 Oct 2023 22:39:53 -0400 Subject: [PATCH] fix --- poetry.lock | 15 +++++++++++++-- pyproject.toml | 1 + s/update-version | 13 ++++--------- 3 files changed, 18 insertions(+), 11 deletions(-) diff --git a/poetry.lock b/poetry.lock index 7e951200a..e04b26209 100644 --- a/poetry.lock +++ b/poetry.lock @@ -1,4 +1,4 @@ -# This file is automatically @generated by Poetry 1.6.1 and should not be changed by hand. +# This file is automatically @generated by Poetry 1.5.1 and should not be changed by hand. [[package]] name = "asgiref" @@ -533,6 +533,17 @@ files = [ {file = "tomli-2.0.1.tar.gz", hash = "sha256:de526c12914f0c550d15924c62d72abc48d6fe7364aa87328337a31007fe8a4f"}, ] +[[package]] +name = "tomlkit" +version = "0.12.1" +description = "Style preserving TOML library" +optional = false +python-versions = ">=3.7" +files = [ + {file = "tomlkit-0.12.1-py3-none-any.whl", hash = "sha256:712cbd236609acc6a3e2e97253dfc52d4c2082982a88f61b640ecf0817eab899"}, + {file = "tomlkit-0.12.1.tar.gz", hash = "sha256:38e1ff8edb991273ec9f6181244a6a391ac30e9f5098e7535640ea6be97a7c86"}, +] + [[package]] name = "typed-ast" version = "1.5.4" @@ -642,4 +653,4 @@ testing = ["big-O", "flake8 (<5)", "jaraco.functools", "jaraco.itertools", "more [metadata] lock-version = "2.0" python-versions = "^3.7" -content-hash = "71293af57fb7853bb135fb07b16a2d1c509fa23de7fd19bc5e7d862e1bf5dc64" +content-hash = "9d3c207ff83a060bdf98a25f2eba5dc1b36113fce165b3c05c4b72e5ebd3accd" diff --git a/pyproject.toml b/pyproject.toml index bbd0dbb24..7ba916ba1 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -27,6 +27,7 @@ types-PyYAML = "^6.0.1" types-pytz = "^2021.3.0" psycopg2-binary = "^2.9.3" ruff = "^0.0.286" +tomlkit = "^0.12.1" [tool.black] line-length = 88 diff --git a/s/update-version b/s/update-version index fdf59cc6d..1b4a9e788 100755 --- a/s/update-version +++ b/s/update-version @@ -5,14 +5,7 @@ from pathlib import Path import re import argparse -import tomllib - - -def find_version() -> str: - pyproject = Path(".").parent.parent / "pyproject.toml" - pyproject_toml = tomllib.loads(pyproject) - return pyproject_toml["tool"]["poetry"]["version"] - +import tomlkit def main(): parser = argparse.ArgumentParser() @@ -22,9 +15,11 @@ def main(): pyproject_path = Path(".").parent.parent / "pyproject.toml" pyproject = pyproject_path.read_text() - current_version = tomllib.loads(pyproject)["tool"]["poetry"]["version"] + current_version = tomlkit.loads(pyproject)["tool"]["poetry"]["version"] major, minor, patch = [int(x) for x in current_version.split(".")] + + match args.version_increment: case "major": major += 1