Skip to content

Commit c095f79

Browse files
authored
chore: use uv build to build the package (#1159)
* use uv build * add comment * add comment * remove a new line * reformat * update review, metadatas * fix format
1 parent 1a1cf34 commit c095f79

File tree

4 files changed

+67
-45
lines changed

4 files changed

+67
-45
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ the Selenium Python binding update might affect the Appium Python Client behavio
5656
For example, some changes in the Selenium binding could break the Appium client.
5757

5858
> **Note**
59-
> We strongly recommend you manage dependencies with version management tools such as
59+
> We strongly recommend you manage dependencies with version management tools such as
6060
> [uv](https://docs.astral.sh/uv/) to keep compatible version combinations.
6161

6262

@@ -450,7 +450,7 @@ You have two methods to extend the read timeout.
450450
451451
```bash
452452
make install-uv
453-
exec $SHELL
453+
exec $SHELL
454454
make sync-dev
455455
```
456456
@@ -533,7 +533,7 @@ Follow the below steps.
533533
```bash
534534
uv pip install setuptools
535535
uv pip install twine
536-
uv pip install git+https://github.com/vaab/gitchangelog.git # Getting via GitHub repository is necessary for Python 3.7
536+
uv pip install gitchangelog
537537
# Type the new version number and 'yes' if you can publish it
538538
# You can test the command with DRY_RUN
539539
DRY_RUN=1 ./release.sh

pyproject.toml

Lines changed: 37 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,41 @@
11
[project]
22
name = "Appium-Python-Client"
3-
dynamic = [
4-
"version",
5-
"description",
6-
"readme",
7-
"license",
8-
"authors",
9-
"maintainers",
10-
"keywords",
11-
"classifiers"
3+
description = "Python client for Appium"
4+
readme = "README.md"
5+
license = "Apache-2.0"
6+
license-files = ["LICENSE"]
7+
authors = [
8+
{name = "Isaac Murchie", email = "[email protected]"},
9+
]
10+
maintainers = [
11+
{name = "Kazuaki Matsuo"},
12+
{name = "Mykola Mokhnach"},
13+
{name = "Mori Atsushi"},
14+
]
15+
keywords = ["appium", "selenium", "python client", "mobile automation"]
16+
classifiers = [
17+
"Development Status :: 5 - Production/Stable",
18+
"Programming Language :: Python :: 3.9",
19+
"Programming Language :: Python :: 3.10",
20+
"Programming Language :: Python :: 3.11",
21+
"Programming Language :: Python :: 3.12",
22+
"Programming Language :: Python :: 3.13",
23+
"Environment :: Console",
24+
"License :: OSI Approved :: Apache Software License",
25+
"Topic :: Software Development :: Testing",
1226
]
1327
requires-python = ">=3.9"
1428
dependencies = [
1529
"selenium>=4.26,<5.0",
1630
"typing-extensions~=4.13",
1731
]
32+
dynamic = ["version"]
33+
34+
[project.urls]
35+
Homepage = "http://appium.io/"
36+
Repository = "https://github.com/appium/python-client"
37+
Issues = "https://github.com/appium/python-client/issues"
38+
Changelog = "https://github.com/appium/python-client/blob/master/CHANGELOG.rst"
1839

1940
[tool.uv]
2041
dev-dependencies = [
@@ -39,5 +60,12 @@ source = "regex"
3960
path = "appium/version.py"
4061
pattern = "(?P<version>\\d+\\.\\d+\\.\\d+)"
4162

63+
[tool.hatch.build]
64+
exclude = [
65+
"test/",
66+
"script/",
67+
"release.sh"
68+
]
69+
4270
[tool.hatch.build.targets.wheel]
4371
packages = ["appium"]

script/release.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,10 @@ def tag_and_generate_changelog(new_version_num):
7171

7272

7373
def upload_sdist(new_version_num):
74+
wheel_file = 'dist/appium_python_client-{}-py3-none-any.whl'.format(new_version_num)
7475
push_file = 'dist/appium_python_client-{}.tar.gz'.format(new_version_num)
7576
try:
76-
call_bash_script('uv run twine upload "{}"'.format(push_file))
77+
call_bash_script(f"uv run twine upload '{wheel_file}' '{push_file}'")
7778
except Exception as e:
7879
print(
7980
'Failed to upload {} to pypi. Please fix the original error and push it again later. Original error: {}'.format(
@@ -99,7 +100,7 @@ def ensure_publication(new_version_num):
99100

100101

101102
def build_sdist():
102-
call_bash_script('uv run python setup.py sdist')
103+
call_bash_script('uv build')
103104

104105

105106
def build() -> None:

setup.py

Lines changed: 24 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -11,44 +11,37 @@
1111
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
14-
import io
15-
import os
14+
15+
# FIXME: Remove this setup.py completely.
16+
# Then, we should bump the major version since the package will not include setup.py.
17+
18+
try:
19+
# Python 3.11+
20+
import tomllib
21+
except Exception:
22+
# for older versions
23+
import tomli as tomllib
24+
25+
with open('pyproject.toml', 'rb') as f:
26+
pyproject = tomllib.load(f)
27+
project = pyproject['project']
1628

1729
from setuptools import find_packages, setup
1830

1931
from appium.common.helper import library_version
2032

2133
setup(
22-
name='Appium-Python-Client',
34+
name=project['name'],
2335
version=library_version(),
24-
description='Python client for Appium',
25-
long_description=io.open(os.path.join(os.path.dirname('__file__'), 'README.md'), encoding='utf-8').read(),
26-
long_description_content_type='text/markdown',
27-
keywords=['appium', 'selenium', 'selenium 4', 'python client', 'mobile automation'],
28-
author='Isaac Murchie',
29-
author_email='[email protected]',
30-
maintainer='Kazuaki Matsuo, Mykola Mokhnach, Mori Atsushi',
31-
url='http://appium.io/',
36+
description=project['description'],
37+
keywords=project['keywords'],
38+
author=project['authors'][0]['name'],
39+
author_email=project['authors'][0]['email'],
40+
maintainer=', '.join([maintainer['name'] for maintainer in project['maintainers']]),
41+
url=project['urls']['Homepage'],
3242
package_data={'appium': ['py.typed']},
3343
packages=find_packages(include=['appium*']),
34-
license='Apache 2.0',
35-
classifiers=[
36-
'Development Status :: 5 - Production/Stable',
37-
'Programming Language :: Python',
38-
'Programming Language :: Python :: 3.9',
39-
'Programming Language :: Python :: 3.10',
40-
'Programming Language :: Python :: 3.11',
41-
'Programming Language :: Python :: 3.12',
42-
'Programming Language :: Python :: 3.13',
43-
'Environment :: Console',
44-
'Environment :: MacOS X',
45-
'Environment :: Win32 (MS Windows)',
46-
'Intended Audience :: Developers',
47-
'Intended Audience :: Other Audience',
48-
'License :: OSI Approved :: Apache Software License',
49-
'Operating System :: OS Independent',
50-
'Topic :: Software Development :: Quality Assurance',
51-
'Topic :: Software Development :: Testing',
52-
],
53-
install_requires=['selenium ~= 4.26, < 5.0'],
44+
license=project['license']['text'],
45+
classifiers=project['classifiers'],
46+
install_requires=project['dependencies'],
5447
)

0 commit comments

Comments
 (0)