Skip to content

Commit 1a8156a

Browse files
feat: Switch package management from pipenv to uv
1 parent ab6c7bb commit 1a8156a

File tree

8 files changed

+842
-69
lines changed

8 files changed

+842
-69
lines changed

.github/workflows/functional-test.yml

Lines changed: 16 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -71,13 +71,13 @@ jobs:
7171
with:
7272
python-version: 3.12
7373

74-
- run: |
75-
# Separate 'run' creates differnet pipenv env. Does them in one run for now.
76-
pip install --upgrade pip
77-
pip install --upgrade pipenv
78-
pipenv lock --clear
79-
pipenv install -d --system
80-
pytest ${{ matrix.test_targets.target}} --doctest-modules --junitxml=junit/test-results.xml --cov=com --cov-report=xml --cov-report=html
74+
- name: Install uv
75+
run: make install-uv
76+
77+
- name: Run Tests
78+
run: |
79+
uv run pytest ${{ matrix.test_targets.target}} \
80+
--doctest-modules --junitxml=junit/test-results.xml --cov=com --cov-report=xml --cov-report=html
8181
env:
8282
LOCAL_PREBUILT_WDA: ${{ github.workspace }}/wda/WebDriverAgentRunner-Runner.app
8383

@@ -161,12 +161,9 @@ jobs:
161161
api-level: ${{ env.API_LEVEL }}
162162
arch: ${{ env.ARCH }}
163163
script: |
164-
# Separate 'run' creates differnet pipenv env. Does them in one run for now.
165-
pip install --upgrade pip
166-
pip install --upgrade pipenv
167-
pipenv lock --clear
168-
pipenv install -d --system
169-
pytest ${{ matrix.test_targets.target}} --doctest-modules --junitxml=junit/test-results.xml --cov=com --cov-report=xml --cov-report=html
164+
make install-uv
165+
uv run pytest ${{ matrix.test_targets.target}} --doctest-modules --junitxml=junit/test-results.xml \
166+
--cov=com --cov-report=xml --cov-report=html
170167
target: google_apis
171168
profile: Nexus 5X
172169
disable-spellchecker: true
@@ -251,12 +248,9 @@ jobs:
251248
with:
252249
api-level: ${{ env.API_LEVEL }}
253250
script: |
254-
pip install --upgrade pip
255-
pip install --upgrade pipenv
256-
pipenv lock --clear
257-
pipenv install -d --system
258-
export PLATFORM=android
259-
pytest test/functional/flutter_integration/*_test.py --doctest-modules --junitxml=junit/test-results.xml --cov=com --cov-report=xml --cov-report=html
251+
make install-uv
252+
uv run pytest test/functional/flutter_integration/*_test.py \
253+
--doctest-modules --junitxml=junit/test-results.xml --cov=com --cov-report=xml --cov-report=html
260254
target: default
261255
disable-spellchecker: true
262256
disable-animations: true
@@ -296,10 +290,7 @@ jobs:
296290
- name: Run IOS tests
297291
if: matrix.e2e-tests == 'flutter-ios'
298292
run: |
299-
# Separate 'run' creates differnet pipenv env. Does them in one run for now.
300-
pip install --upgrade pip
301-
pip install --upgrade pipenv
302-
pipenv lock --clear
303-
pipenv install -d --system
293+
make install-uv
304294
export PLATFORM=ios
305-
pytest test/functional/flutter_integration/*_test.py --doctest-modules --junitxml=junit/test-results.xml --cov=com --cov-report=xml --cov-report=html
295+
uv run pytest test/functional/flutter_integration/*_test.py \
296+
--doctest-modules --junitxml=junit/test-results.xml --cov=com --cov-report=xml --cov-report=html

.github/workflows/unit-test.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@ jobs:
1919
uses: actions/setup-python@v5
2020
with:
2121
python-version: ${{ matrix.python-version }}
22-
- name: Install tox
23-
run: pip install tox
22+
- name: Install uv
23+
run: make install-uv
2424
- name: Run Tox
25-
run: tox -e py
25+
run: uv run tox -e py
2626

2727
# test-win:
2828
# runs-on: windows-latest

.gitignore

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,7 @@ __pycache__
2424

2525
# Virtual Environments
2626
venv*
27+
.venv
2728
.tox
2829

29-
Pipfile.lock
30-
3130
.coverage

Makefile

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,27 +10,42 @@ check: check-lint check-format
1010

1111
.PHONY: check-lint
1212
check-lint:
13-
python -m ruff check .
13+
uv run ruff check .
1414

1515
.PHONY: check-format
1616
check-format:
17-
python -m ruff format --check .
17+
uv run ruff format --check .
1818

1919
.PHONY: fix
2020
fix: fix-lint fix-format
2121

2222
.PHONY: fix-lint
2323
fix-lint:
24-
python -m ruff check --fix .
24+
uv run ruff check --fix .
2525

2626
.PHONY: fix-format
2727
fix-format:
28-
python -m ruff format .
29-
28+
uv run ruff format .
29+
30+
.PHONY: install-uv
31+
install-uv:
32+
@command -v uv >/dev/null 2>&1 || { \
33+
echo "Installing uv"; \
34+
curl -LsSf https://astral.sh/uv/install.sh | sh; \
35+
if [ -n "$$GITHUB_PATH" ]; then \
36+
echo "PATH=$$HOME/.local/bin:$$PATH" >> $$GITHUB_PATH; \
37+
else \
38+
echo "Please restart your shell or run 'exec $$SHELL'"; \
39+
fi; \
40+
}
41+
42+
.PHONY: sync-dev
43+
sync-dev:
44+
uv sync
3045

3146
.PHONY: unittest
3247
unittest: ## Run unittest
33-
python -m pytest $(ARGS) test/unit/
48+
uv run pytest $(ARGS) test/unit/
3449

3550
.PHONY: help
3651
help: ## Display this help screen

Pipfile

Lines changed: 0 additions & 19 deletions
This file was deleted.

README.md

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,8 @@ 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 Pipenv and requirements.txt
60-
> to keep compatible version combinations.
59+
> We strongly recommend you manage dependencies with version management tools such as
60+
> [uv](https://docs.astral.sh/uv/) to keep compatible version combinations.
6161

6262

6363
### Quick migration guide from v4 to v5
@@ -448,48 +448,47 @@ You have two methods to extend the read timeout.
448448
449449
### Setup
450450
451-
- `pip install --user pipenv`
452-
- `python -m pipenv lock --clear`
453-
- If you experience `Locking Failed! unknown locale: UTF-8` error, then refer [pypa/pipenv#187](https://github.com/pypa/pipenv/issues/187) to solve it.
454-
- `python -m pipenv install --dev --system`
455-
- `pre-commit install`
451+
```bash
452+
make install-uv
453+
exec $SHELL
454+
make sync-dev
455+
```
456456
457457
### Run tests
458458
459459
You can run all of the tests running on CI via `tox` in your local.
460460
461461
```bash
462-
$ tox
462+
$ uv run tox
463463
```
464464
465465
You also can run particular tests like below.
466466
467467
#### Unit
468468
469469
```bash
470-
$ pytest test/unit
470+
$ uv run pytest test/unit
471471
```
472472
473473
Run with `pytest-xdist`
474474
475475
```bash
476-
$ pytest -n 2 test/unit
476+
$ uv run pytest -n 2 test/unit
477477
```
478478
479479
#### Functional
480480
481481
```bash
482-
$ pytest test/functional/ios/search_context/find_by_ios_class_chain_tests.py
482+
$ uv run pytest test/functional/ios/search_context/find_by_ios_class_chain_tests.py
483483
```
484484
485485
#### In parallel for iOS
486486
487487
1. Create simulators named 'iPhone X - 8100' and 'iPhone X - 8101'
488-
2. Install test libraries via pip, `pip install pytest pytest-xdist`
489-
3. Run tests
488+
1. Run tests
490489
491490
```bash
492-
$ pytest -n 2 test/functional/ios/search_context/find_by_ios_class_chain_tests.py
491+
$ uv run pytest -n 2 test/functional/ios/search_context/find_by_ios_class_chain_tests.py
493492
```
494493
495494
## Release

pyproject.toml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
[project]
2+
name = "Appium-Python-Client"
3+
dynamic = ["version"]
4+
requires-python = ">=3.9"
5+
dependencies = [
6+
"selenium==4.33.0",
7+
"typing-extensions~=4.13.2",
8+
]
9+
10+
[tool.uv]
11+
dev-dependencies = [
12+
"httpretty~=1.1",
13+
"mock~=5.2",
14+
"pre-commit~=4.2",
15+
"pytest~=8.4",
16+
"pytest-cov~=6.2",
17+
"pytest-xdist~=3.8",
18+
"python-dateutil~=2.9",
19+
"ruff~=0.12.7",
20+
"tox~=4.27",
21+
"types-python-dateutil~=2.9",
22+
]
23+
24+
[build-system]
25+
requires = ["hatchling"]
26+
build-backend = "hatchling.build"
27+
28+
[tool.hatch.version]
29+
source = "regex"
30+
path = "appium/version.py"
31+
pattern = "(?P<version>\\d+\\.\\d+\\.\\d+)"
32+
33+
[tool.hatch.build.targets.wheel]
34+
packages = ["appium"]

0 commit comments

Comments
 (0)