Skip to content

Commit ee8af97

Browse files
authored
chore: use uv for version (#1160)
* chore: use version via uv * chore: update uv version * ruff * remove unused line * fix ruff * fix ruff * fix naming * rename
1 parent c095f79 commit ee8af97

File tree

5 files changed

+31
-18
lines changed

5 files changed

+31
-18
lines changed

appium/version.py

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,22 @@
1-
version = '5.1.3'
1+
#!/usr/bin/env python
2+
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
from importlib import metadata
16+
17+
18+
def _get_version():
19+
return metadata.version('Appium-Python-Client')
20+
21+
22+
version = _get_version()

pyproject.toml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
[project]
22
name = "Appium-Python-Client"
33
description = "Python client for Appium"
4+
version = "5.1.3"
45
readme = "README.md"
56
license = "Apache-2.0"
67
license-files = ["LICENSE"]
@@ -21,15 +22,13 @@ classifiers = [
2122
"Programming Language :: Python :: 3.12",
2223
"Programming Language :: Python :: 3.13",
2324
"Environment :: Console",
24-
"License :: OSI Approved :: Apache Software License",
2525
"Topic :: Software Development :: Testing",
2626
]
2727
requires-python = ">=3.9"
2828
dependencies = [
2929
"selenium>=4.26,<5.0",
3030
"typing-extensions~=4.13",
3131
]
32-
dynamic = ["version"]
3332

3433
[project.urls]
3534
Homepage = "http://appium.io/"

script/release.py

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,12 @@
1414
"""Release script to publish release module to pipy."""
1515

1616
import glob
17-
import io
1817
import os
1918
import shutil
2019
import subprocess
2120
import sys
2221
from typing import List
2322

24-
VERSION_FILE_PATH = os.path.join(os.path.dirname('__file__'), 'appium', 'version.py')
2523
CHANGELOG_PATH = os.path.join(os.path.dirname('__file__'), 'CHANGELOG.rst')
2624

2725
APPIUM_DIR_PATH = os.path.join(os.path.dirname('__file__'), 'appium')
@@ -32,10 +30,8 @@
3230
MESSAGE_YELLOW = '\033[1;33m{}\033[0m'
3331

3432

35-
def get_current_version():
36-
current = io.open(os.path.join(os.path.dirname('__file__'), 'appium', 'version.py'), encoding='utf-8').read().rstrip()
37-
print('The current version is {}, type a new one'.format(MESSAGE_YELLOW.format(current)))
38-
return current
33+
def print_current_version():
34+
os.system('uv version')
3935

4036

4137
def get_new_version():
@@ -48,9 +44,7 @@ def get_new_version():
4844

4945

5046
def update_version_file(version):
51-
new_version = VERSION_FORMAT.format(version)
52-
with open(VERSION_FILE_PATH, 'w') as f:
53-
f.write(new_version)
47+
call_bash_script(f'uv version {version}')
5448

5549

5650
def call_bash_script(cmd):
@@ -61,7 +55,7 @@ def call_bash_script(cmd):
6155

6256

6357
def commit_version_code(new_version_num):
64-
call_bash_script('git commit {} -m "Bump {}"'.format(VERSION_FILE_PATH, new_version_num))
58+
call_bash_script('git commit pyproject.toml uv.lock -m "Bump {}"'.format(new_version_num))
6559

6660

6761
def tag_and_generate_changelog(new_version_num):
@@ -141,7 +135,7 @@ def assert_files_count_in_package() -> None:
141135

142136

143137
def main():
144-
get_current_version()
138+
print_current_version()
145139
new_version = get_new_version()
146140

147141
update_version_file(new_version)

setup.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,9 @@
2828

2929
from setuptools import find_packages, setup
3030

31-
from appium.common.helper import library_version
32-
3331
setup(
3432
name=project['name'],
35-
version=library_version(),
33+
version=project['version'],
3634
description=project['description'],
3735
keywords=project['keywords'],
3836
author=project['authors'][0]['name'],
@@ -41,7 +39,7 @@
4139
url=project['urls']['Homepage'],
4240
package_data={'appium': ['py.typed']},
4341
packages=find_packages(include=['appium*']),
44-
license=project['license']['text'],
42+
license=project['license'],
4543
classifiers=project['classifiers'],
4644
install_requires=project['dependencies'],
4745
)

uv.lock

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)