diff --git a/appium/version.py b/appium/version.py index efd703e2..0616a7c5 100644 --- a/appium/version.py +++ b/appium/version.py @@ -1 +1,22 @@ -version = '5.1.3' +#!/usr/bin/env python + +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from importlib import metadata + + +def _get_version(): + return metadata.version('Appium-Python-Client') + + +version = _get_version() diff --git a/pyproject.toml b/pyproject.toml index a79e980e..4bea3e81 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,7 @@ [project] name = "Appium-Python-Client" description = "Python client for Appium" +version = "5.1.3" readme = "README.md" license = "Apache-2.0" license-files = ["LICENSE"] @@ -21,7 +22,6 @@ classifiers = [ "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", "Environment :: Console", - "License :: OSI Approved :: Apache Software License", "Topic :: Software Development :: Testing", ] requires-python = ">=3.9" @@ -29,7 +29,6 @@ dependencies = [ "selenium>=4.26,<5.0", "typing-extensions~=4.13", ] -dynamic = ["version"] [project.urls] Homepage = "http://appium.io/" diff --git a/script/release.py b/script/release.py index 8c42f5df..f3045daf 100644 --- a/script/release.py +++ b/script/release.py @@ -14,14 +14,12 @@ """Release script to publish release module to pipy.""" import glob -import io import os import shutil import subprocess import sys from typing import List -VERSION_FILE_PATH = os.path.join(os.path.dirname('__file__'), 'appium', 'version.py') CHANGELOG_PATH = os.path.join(os.path.dirname('__file__'), 'CHANGELOG.rst') APPIUM_DIR_PATH = os.path.join(os.path.dirname('__file__'), 'appium') @@ -32,10 +30,8 @@ MESSAGE_YELLOW = '\033[1;33m{}\033[0m' -def get_current_version(): - current = io.open(os.path.join(os.path.dirname('__file__'), 'appium', 'version.py'), encoding='utf-8').read().rstrip() - print('The current version is {}, type a new one'.format(MESSAGE_YELLOW.format(current))) - return current +def print_current_version(): + os.system('uv version') def get_new_version(): @@ -48,9 +44,7 @@ def get_new_version(): def update_version_file(version): - new_version = VERSION_FORMAT.format(version) - with open(VERSION_FILE_PATH, 'w') as f: - f.write(new_version) + call_bash_script(f'uv version {version}') def call_bash_script(cmd): @@ -61,7 +55,7 @@ def call_bash_script(cmd): def commit_version_code(new_version_num): - call_bash_script('git commit {} -m "Bump {}"'.format(VERSION_FILE_PATH, new_version_num)) + call_bash_script('git commit pyproject.toml uv.lock -m "Bump {}"'.format(new_version_num)) def tag_and_generate_changelog(new_version_num): @@ -141,7 +135,7 @@ def assert_files_count_in_package() -> None: def main(): - get_current_version() + print_current_version() new_version = get_new_version() update_version_file(new_version) diff --git a/setup.py b/setup.py index be2ec03f..f32eab92 100644 --- a/setup.py +++ b/setup.py @@ -28,11 +28,9 @@ from setuptools import find_packages, setup -from appium.common.helper import library_version - setup( name=project['name'], - version=library_version(), + version=project['version'], description=project['description'], keywords=project['keywords'], author=project['authors'][0]['name'], @@ -41,7 +39,7 @@ url=project['urls']['Homepage'], package_data={'appium': ['py.typed']}, packages=find_packages(include=['appium*']), - license=project['license']['text'], + license=project['license'], classifiers=project['classifiers'], install_requires=project['dependencies'], ) diff --git a/uv.lock b/uv.lock index a58624af..5ab9c5c2 100644 --- a/uv.lock +++ b/uv.lock @@ -4,6 +4,7 @@ requires-python = ">=3.9" [[package]] name = "appium-python-client" +version = "5.1.3" source = { editable = "." } dependencies = [ { name = "selenium" },