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
2 changes: 1 addition & 1 deletion dev/breeze/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,6 @@ PLEASE DO NOT MODIFY THE HASH BELOW! IT IS AUTOMATICALLY UPDATED BY PRE-COMMIT.

---------------------------------------------------------------------------------------------------------

Package config hash: afd9da2026a8ef459e604a86236da3295475a883c9479a87746635b9790aa2eaa2e678aa06ea3522d9e3f93c88b172ba4914d707800c060c6d003eb68ea1e415
Package config hash: 9d5c8788a7125a0db14fdfbe8a6a1873c4590a2b2d60ac362a6597e64b845cb033ea398cb55548d47605d4730f66aac8fba0c501c8eacf84a3cb6027a121acca

---------------------------------------------------------------------------------------------------------
1 change: 0 additions & 1 deletion dev/breeze/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ dependencies = [
"restructuredtext-lint>=1.4.0",
"rich-click>=1.7.1",
"rich>=13.6.0",
"semver>=3.0.2",
"tabulate>=0.9.0",
"tomli>=2.0.1; python_version < '3.11'",
"twine>=4.0.2",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
from time import time
from typing import Any, NamedTuple

from packaging.version import Version, parse
from rich.syntax import Syntax

from airflow_breeze.utils.black_utils import black_format
Expand Down Expand Up @@ -482,6 +483,24 @@ def _mark_latest_changes_as_documentation_only(
raise PrepareReleaseDocsChangesOnlyException()


VERSION_MAJOR_INDEX = 0
VERSION_MINOR_INDEX = 1
VERSION_PATCHLEVEL_INDEX = 2


def bump_version(v: Version, index: int) -> Version:
versions = list(v.release)
versions[index] += 1
# Packaging version returns None for pre and dev if they are not set
# In PEP-440 it is perfectly fine to have 1.2.3b1.dev0 or 1.2.3.dev0
# Unlike dev, pre-release does not have "." to separate it from the version
pre = f"{v.pre[0]}{v.pre[1]}" if v.pre else ""
dev = f".dev{v.dev}" if v.dev is not None else ""
return parse(
f"{versions[VERSION_MAJOR_INDEX]}.{versions[VERSION_MINOR_INDEX]}.{versions[VERSION_PATCHLEVEL_INDEX]}{pre}{dev}"
)


def _update_version_in_provider_yaml(
provider_id: str,
type_of_change: TypeOfChange,
Expand All @@ -494,23 +513,22 @@ def _update_version_in_provider_yaml(
"""
provider_details = get_provider_details(provider_id)
version = provider_details.versions[0]
import semver

v = semver.VersionInfo.parse(version)
v = parse(version)
with_breaking_changes = False
maybe_with_new_features = False
if type_of_change == TypeOfChange.BREAKING_CHANGE:
v = v.bump_major()
v = bump_version(v, VERSION_MAJOR_INDEX)
with_breaking_changes = True
# we do not know, but breaking changes may also contain new features
maybe_with_new_features = True
elif type_of_change == TypeOfChange.FEATURE:
v = v.bump_minor()
v = bump_version(v, VERSION_MINOR_INDEX)
maybe_with_new_features = True
elif type_of_change == TypeOfChange.BUGFIX:
v = v.bump_patch()
v = bump_version(v, VERSION_PATCHLEVEL_INDEX)
elif type_of_change == TypeOfChange.MISC:
v = v.bump_patch()
v = bump_version(v, VERSION_PATCHLEVEL_INDEX)
provider_yaml_path = get_provider_yaml(provider_id)
original_provider_yaml_content = provider_yaml_path.read_text()
updated_provider_yaml_content = re.sub(
Expand Down