aiogram/scripts/bump_version.py
Alex Root Junior 49d0784e33
Added full support of the Bot API 9.4 (#1761)
* Bump API schema to version 9.4, add new object types, methods, and properties.

* Add tests for `ChatOwnerChanged` and `ChatOwnerLeft` message types

* Add tests for `GetUserProfileAudios`, `RemoveMyProfilePhoto`, and `SetMyProfilePhoto` methods

* Bump version

* Update Makefile variables and refactor `test_get_user_profile_audios.py`

* Document new features and updates from Bot API 9.4 in changelog

* Add `ButtonStyle` enum to represent button styles in the Telegram API

* Fix review issues from PR #1761

- Remove stray '-' artifact from GameHighScore docstring and butcher schema
- Fix Makefile reformat target scope inconsistency (ruff check --fix)
- Fix ButtonStyle enum source URL (#chat -> #inlinekeyboardbutton)
- Add User.get_profile_audios() shortcut method (parallel to get_profile_photos)
- Test ChatOwnerLeft with new_owner=None (edge case)
- Add VideoQuality type and Video.qualities nesting tests
- Add User.get_profile_audios() test

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Revert "Fix review issues from PR #1761"

This reverts commit 2184e98988.

* Update source links for `ButtonStyle` documentation to reflect accurate API references

* Fix review issues from PR #1761 (#1762)

* Fix review issues from PR #1761

- Remove stray '-' artifact from GameHighScore docstring
- Fix Makefile reformat target scope inconsistency (ruff check --fix)
- Add User.get_profile_audios() shortcut method (parallel to get_profile_photos)
- Test ChatOwnerLeft with new_owner=None (edge case)
- Add VideoQuality type and Video.qualities nesting tests
- Add User.get_profile_audios() test

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Address review comments: use fixture and variables in tests, add changelog

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Address review follow-ups for PR #1762

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>

* Reformat code

* Shut up, ruff

---------

Co-authored-by: latand <latand666@gmail.com>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: Kostiantyn Kriuchkov <36363097+Latand@users.noreply.github.com>
2026-02-10 23:43:52 +02:00

53 lines
1.6 KiB
Python

#!/usr/bin/env python3
"""Version bumping script for aiogram (replaces hatch version)."""
import re
import sys
from pathlib import Path
def bump_version(part: str) -> str:
"""Bump version in __meta__.py."""
meta_path = Path("aiogram/__meta__.py")
content = meta_path.read_text()
# Extract current version
version_match = re.search(r'__version__ = "(\d+)\.(\d+)\.(\d+)"', content)
if not version_match:
raise ValueError("Could not find version in __meta__.py")
major, minor, patch = map(int, version_match.groups())
# Bump appropriate part
if part == "major":
major += 1
minor = 0
patch = 0
elif part == "minor":
minor += 1
patch = 0
elif part == "patch":
patch += 1
elif part.startswith("to:"):
new_version = part.replace("to:", "")
content = re.sub(
r'__version__ = "\d+\.\d+\.\d+"', f'__version__ = "{new_version}"', content
)
meta_path.write_text(content)
return new_version
else:
raise ValueError(f"Unknown part: {part}. Use major, minor, patch, or to:X.Y.Z")
new_version = f"{major}.{minor}.{patch}"
content = re.sub(r'__version__ = "\d+\.\d+\.\d+"', f'__version__ = "{new_version}"', content)
meta_path.write_text(content)
return new_version
if __name__ == "__main__":
if len(sys.argv) != 2: # noqa: PLR2004
print("Usage: python scripts/bump_version.py [major|minor|patch|to:X.Y.Z]") # noqa: T201
sys.exit(1)
new_version = bump_version(sys.argv[1])
print(f"Bumped version to {new_version}") # noqa: T201