Skip to content

Commit 8a1aef0

Browse files
authored
Migrate to uv (#755)
1 parent 5789139 commit 8a1aef0

File tree

197 files changed

+4200
-6427
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

197 files changed

+4200
-6427
lines changed

.flake8

-6
This file was deleted.

.github/workflows/build-wheels.yml

+7-10
Original file line numberDiff line numberDiff line change
@@ -54,17 +54,14 @@ jobs:
5454
uses: actions/checkout@v4
5555
if: ${{ !inputs.branch }}
5656

57-
- name: Install Poetry
58-
run: pipx install poetry
57+
- name: Install uv
58+
uses: astral-sh/setup-uv@v3
5959

6060
- name: Setup Python
61-
uses: actions/setup-python@v5
62-
with:
63-
python-version: "3.12"
64-
cache: poetry
61+
run: uv python install 3.12
6562

6663
- name: Install package
67-
run: poetry install --all-extras
64+
run: uv sync
6865

6966
- name: Download binary
7067
run: curl -sL -o src/viam/rpc/libviam_rust_utils.${{ matrix.ext }} https://github.com/viamrobotics/rust-utils/releases/latest/download/libviam_rust_utils-${{ matrix.arch }}.${{ matrix.ext }}
@@ -74,12 +71,12 @@ jobs:
7471
run: echo "This file enables arm7l support. PyPI doesn't allow for packages with the same hash, so this file must be added to differentiate this arm7l package from the arm6l package." > src/viam/arm7l.txt
7572

7673
- name: Build
77-
run: poetry build -f wheel
74+
run: uv build --wheel
7875

7976
- name: Rename
8077
run: |
81-
echo "WHL_NAME=viam_sdk-$(poetry run python -c 'import viam; print(viam.__version__)')-py3-none-${{ matrix.whl }}.whl" >> $GITHUB_ENV
82-
mv dist/viam_sdk-$(poetry run python -c "import viam; print(viam.__version__)")-py3-none-any.whl dist/viam_sdk-$(poetry run python -c 'import viam; print(viam.__version__)')-py3-none-${{ matrix.whl }}.whl
78+
echo "WHL_NAME=viam_sdk-$(uv run python3 -c 'import viam; print(viam.__version__)')-py3-none-${{ matrix.whl }}.whl" >> $GITHUB_ENV
79+
mv dist/viam_sdk-$(uv run python3 -c "import viam; print(viam.__version__)")-py3-none-any.whl dist/viam_sdk-$(uv run python3 -c 'import viam; print(viam.__version__)')-py3-none-${{ matrix.whl }}.whl
8380
8481
- name: Upload artifacts
8582
uses: actions/upload-artifact@v4

.github/workflows/docs.yml

+7-9
Original file line numberDiff line numberDiff line change
@@ -16,23 +16,21 @@ jobs:
1616
steps:
1717
- uses: actions/checkout@v4
1818

19-
- name: Setup Python
20-
uses: actions/setup-python@v5
21-
with:
22-
python-version: "3.12"
19+
- name: Install uv
20+
uses: astral-sh/setup-uv@v3
2321

24-
- name: Install Poetry
25-
uses: snok/install-poetry@v1
22+
- name: Setup Python
23+
run: uv python install 3.12
2624

2725
- name: Install package
2826
run: make install
2927

3028
- name: Generate docs
3129
run: |
32-
poetry run python3 -m docs.examples._server &
33-
poetry run python3 -m examples.server.v1.server 0.0.0.0 9091 &
30+
uv run python3 -m docs.examples._server &
31+
uv run python3 -m examples.server.v1.server 0.0.0.0 9091 &
3432
sleep 2
35-
make documentation
33+
uv run make documentation
3634
3735
- name: Upload artifacts
3836
uses: actions/upload-artifact@v3

.github/workflows/license_finder.yml

+4-9
Original file line numberDiff line numberDiff line change
@@ -16,26 +16,21 @@ jobs:
1616
steps:
1717
- uses: actions/checkout@v4
1818

19-
- name: Install Poetry
20-
run: pipx install poetry
19+
- name: Install uv
20+
uses: astral-sh/setup-uv@v3
2121

2222
- name: Setup Python
23-
uses: actions/setup-python@v5
24-
with:
25-
python-version: "3.11.5"
23+
run: uv python install
2624

2725
- uses: ruby/setup-ruby@v1
2826
with:
2927
ruby-version: "3.3"
3028

3129
- run: gem install license_finder
3230

33-
- name: Install package
34-
run: poetry install --all-extras
35-
3631
- name: Generate requirements.txt (exclude dev dependencies)
3732
run: |
38-
poetry export -f requirements.txt --without-hashes > requirements.txt
33+
uv pip compile pyproject.toml -o requirements.txt
3934
pip install -r requirements.txt
4035
4136
- name: Run license finder

.github/workflows/linkcheck.yml

+7-8
Original file line numberDiff line numberDiff line change
@@ -8,28 +8,27 @@ name: run-htmltest-external
88
on:
99
schedule:
1010
# 10am UTC on weekdays
11-
- cron: '0 10 * * 1,2,3,4,5'
11+
- cron: "0 10 * * 1,2,3,4,5"
1212
jobs:
1313
htmltest:
1414
runs-on: ubuntu-latest
1515
steps:
1616
- name: Checkout Code
1717
uses: actions/checkout@v4
1818

19-
- name: Setup Python
20-
uses: actions/setup-python@v5
19+
- name: Install uv
20+
uses: astral-sh/setup-uv@v3
2121
with:
22-
python-version: "3.12"
22+
enable-cache: true
2323

24-
- name: Install Poetry
25-
uses: snok/install-poetry@v1
24+
- name: Setup Python
25+
run: uv python install 3.12
2626

2727
- name: Install package
2828
run: make install
2929

3030
- name: Generate docs
31-
run: |
32-
make documentation
31+
run: uv run make documentation
3332

3433
- name: Test HTML
3534
# https://github.com/wjdp/htmltest-action/

.github/workflows/release.yml

+28-18
Original file line numberDiff line numberDiff line change
@@ -4,53 +4,63 @@ on:
44
workflow_dispatch:
55
inputs:
66
version:
7-
description: "The type of version bump. Use `-s` for no change. See docs for details: https://python-poetry.org/docs/cli/#version"
7+
description: "The type of version bump. Use `-s` for no change. See docs for details: https://hatch.pypa.io/latest/version/#supported-segments"
88
type: choice
99
required: true
1010
default: "-s"
1111
options:
1212
- major
1313
- minor
1414
- patch
15-
- premajor
16-
- preminor
17-
- prepatch
18-
- prerelease
19-
- prerelease --next-phase
2015
- "-s"
16+
prerelease:
17+
description: "If this is a prerelease and which type. See docs for details: https://hatch.pypa.io/latest/version/#supported-segments"
18+
type: choice
19+
required: false
20+
options:
21+
- "alpha"
22+
- "beta"
23+
- "rc"
2124

2225
jobs:
2326
prepare:
2427
if: github.repository_owner == 'viamrobotics'
2528
runs-on: ubuntu-latest
2629
outputs:
27-
version: ${{ steps.bump_version.outputs.version }}
30+
version: ${{ steps.set_version.outputs.version }}
2831
steps:
2932
- name: Checkout Code
3033
uses: actions/checkout@v4
3134

32-
- name: Install Poetry
33-
run: pipx install poetry
35+
- name: Install uv
36+
uses: astral-sh/setup-uv@v3
3437

3538
- name: Setup Python
36-
uses: actions/setup-python@v5
37-
with:
38-
python-version: "3.12"
39-
cache: poetry
39+
run: uv python install 3.12
4040

4141
- name: Install Package
42-
run: poetry install --all-extras
42+
run: uv sync --all-extras
4343

4444
- name: Clean Format Test
45-
run: make clean format typecheck test
45+
run: uv run make clean format typecheck test
46+
47+
- name: Bump Version
48+
id: bump_version
49+
shell: bash
50+
if: inputs.version != '-s' && inputs.prerelease
51+
run: echo "ABC" && uvx hatch version ${{ inputs.version }},${{ inputs.prerelease }}
4652

4753
- name: Bump Version
4854
id: bump_version
4955
shell: bash
56+
if: inputs.version != '-s' && !inputs.prerelease
57+
run: echo "DEF" && uvx hatch version ${{ inputs.version }}
58+
59+
- name: Set Version
60+
id: set_version
5061
run: |
51-
poetry version ${{ inputs.version }}
52-
echo "SDK_VERSION=$(poetry version -s)" >> $GITHUB_ENV
53-
echo "version=$(poetry version -s)" >> $GITHUB_OUTPUT
62+
echo "SDK_VERSION=$(uvx hatch version)" >> $GITHUB_ENV
63+
echo "version=$(uvx hatch version)" >> $GITHUB_OUTPUT
5464
5565
- name: Check if release exists
5666
uses: cardinalby/[email protected]

.github/workflows/test.yml

+12-15
Original file line numberDiff line numberDiff line change
@@ -22,38 +22,35 @@ jobs:
2222
steps:
2323
- name: Checkout Push/Workflow Dispatch
2424
if: github.event_name == 'workflow_dispatch' || github.event_name == 'push'
25-
uses: actions/checkout@v3
25+
uses: actions/checkout@v4
2626
- name: Checkout PR
2727
if: github.event_name == 'pull_request_target'
28-
uses: actions/checkout@v3
28+
uses: actions/checkout@v4
2929
with:
3030
ref: ${{ github.event.pull_request.head.sha }}
31-
- name: Install Poetry
32-
run: pipx install poetry
33-
- name: Setup python
34-
uses: actions/setup-python@v5
31+
- name: Install uv
32+
uses: astral-sh/setup-uv@v3
3533
with:
36-
python-version: ${{ matrix.python-version }}
37-
cache: poetry
34+
enable-cache: true
3835

39-
- name: Fix Poetry
40-
run: poetry config installer.modern-installation false
36+
- name: Setup Python
37+
run: uv python install ${{ matrix.python-version }}
4138

4239
- name: Install package
4340
run: make install
4441

4542
- name: Install minimum package versions
46-
run: poetry run pip install -r requirements-test.txt
43+
run: uv pip install -r requirements-test.txt
4744
if: ${{ matrix.requirements-version == 'min' }}
4845

4946
- name: Type Check
50-
run: make typecheck
47+
run: uv run make typecheck
5148

5249
- name: Lint
53-
run: make lint
50+
run: uv run make lint
5451

5552
- name: Test
56-
run: make test
53+
run: uv run make test
5754

5855
- name: Test Documentation
59-
run: make test_docs
56+
run: uv run make test_docs

.github/workflows/update_protos.yml

+9-8
Original file line numberDiff line numberDiff line change
@@ -20,25 +20,26 @@ jobs:
2020
repo-token: ${{ secrets.GITHUB_TOKEN }}
2121
version: "28.2"
2222

23-
- name: Install Poetry
24-
uses: snok/install-poetry@v1
23+
- name: Install uv
24+
uses: astral-sh/setup-uv@v3
25+
with:
26+
enable-cache: true
2527

26-
- name: Install package
27-
run: |
28-
poetry install --all-extras
28+
- name: Setup Python
29+
run: uv python install
2930

3031
- name: Store API version
3132
run: |
32-
python3 etc/_update_version_metadata.py src/viam/version_metadata.py ${{ github.event.client_payload.tag }}
33+
uv run python3 etc/_update_version_metadata.py src/viam/version_metadata.py ${{ github.event.client_payload.tag }}
3334
echo "Updated API version to ${{ github.event.client_payload.tag }} in src/viam/version_metadata.py"
3435
3536
- name: Generate buf
36-
run: make buf
37+
run: uv run make buf
3738
env:
3839
BUF_TOKEN: ${{ secrets.BUF_TOKEN }}
3940

4041
- name: Format
41-
run: make format
42+
run: uv run make format
4243

4344
- name: Add + Commit + Open PR
4445
shell: bash

.vscode/settings.json

+14-18
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,19 @@
11
{
22
"[python]": {
3-
"editor.defaultFormatter": "ms-python.black-formatter",
4-
"editor.formatOnSave": true
3+
"diffEditor.ignoreTrimWhitespace": false,
4+
"editor.formatOnSave": true,
5+
"editor.formatOnType": true,
6+
"editor.defaultFormatter": "charliermarsh.ruff",
7+
"editor.wordBasedSuggestions": "off",
8+
"editor.rulers": [
9+
{
10+
"color": "#777777",
11+
"column": 140
12+
}
13+
]
514
},
6-
"editor.formatOnSave": true,
7-
"python.linting.ignorePatterns": [
8-
"**/site-packages/**/*.py",
9-
".vscode/*.py",
10-
"gen/**/*",
11-
"viam/proto/**/*"
12-
],
1315
"files.trimTrailingWhitespace": true,
1416
"files.insertFinalNewline": true,
15-
"editor.rulers": [
16-
{
17-
"column": 140,
18-
"color": "#777777"
19-
}
20-
],
2117
"cSpell.words": [
2218
"frombytes",
2319
"grpclib",
@@ -27,7 +23,7 @@
2723
"segmenters",
2824
"TFLITE",
2925
"tobytes",
30-
"viam"
31-
],
32-
"isort.args": ["-l 140 --profile black"]
26+
"viam",
27+
"viamrobotics"
28+
]
3329
}

CHANGELOG.md

-7
This file was deleted.

0 commit comments

Comments
 (0)