Skip to content

Commit

Permalink
Convert nat-lab python usage to uv
Browse files Browse the repository at this point in the history
  • Loading branch information
tomaszklak committed Jan 28, 2025
1 parent 2b9ba36 commit f99b664
Show file tree
Hide file tree
Showing 14 changed files with 1,725 additions and 1,933 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/gitlab.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,4 @@ jobs:
with:
schedule: ${{ github.event_name == 'schedule' }}
cancel-outdated-pipelines: ${{ github.ref_name != 'main' }}
triggered-ref: v2.8.3 # REMEMBER to also update in .gitlab-ci.yml
triggered-ref: convert-to-uv # REMEMBER to also update in .gitlab-ci.yml
68 changes: 46 additions & 22 deletions .github/workflows/linters.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,23 +30,23 @@ jobs:
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
- uses: extractions/setup-just@dd310ad5a97d8e7b41793f8ef055398d51ad4de6 # v2.0.0
with:
just-version: 1.37.0
just-version: 1.38.0
- run: just clippy
clippy-win:
runs-on: windows-2022
steps:
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
- uses: extractions/setup-just@dd310ad5a97d8e7b41793f8ef055398d51ad4de6 # v2.0.0
with:
just-version: 1.37.0
just-version: 1.38.0
- run: just clippy
clippy-mac:
runs-on: macos-13
steps:
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
- uses: extractions/setup-just@dd310ad5a97d8e7b41793f8ef055398d51ad4de6 # v2.0.0
with:
just-version: 1.37.0
just-version: 1.38.0
- run: just clippy
clippy-teliod:
runs-on: ubuntu-22.04
Expand All @@ -60,15 +60,15 @@ jobs:
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
- uses: extractions/setup-just@dd310ad5a97d8e7b41793f8ef055398d51ad4de6 # v2.0.0
with:
just-version: 1.37.0
just-version: 1.38.0
- run: just deny
udeps:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
- uses: extractions/setup-just@dd310ad5a97d8e7b41793f8ef055398d51ad4de6 # v2.0.0
with:
just-version: 1.37.0
just-version: 1.38.0
- run: just udeps
rustfmt:
runs-on: ubuntu-22.04
Expand All @@ -87,24 +87,39 @@ jobs:
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
- uses: extractions/setup-just@dd310ad5a97d8e7b41793f8ef055398d51ad4de6 # v2.0.0
with:
just-version: 1.37.0
just-version: 1.38.0
- name: Install uv
uses: astral-sh/setup-uv@v4
with:
# Install a specific version of uv.
version: "0.5.11"
- run: just black
python-format-isort:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
- run: pip3 install --no-deps -r requirements.txt
- run: pipenv install --system
- run: isort --check-only --diff .
working-directory: nat-lab
- uses: extractions/setup-just@dd310ad5a97d8e7b41793f8ef055398d51ad4de6 # v2.0.0
with:
just-version: 1.38.0
- name: Install uv
uses: astral-sh/setup-uv@v4
with:
# Install a specific version of uv.
version: "0.5.11"
- run: just isort
python-format-autoflake:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
- run: pip3 install --no-deps -r requirements.txt
- run: pipenv install --system
- run: autoflake --quiet --check .
working-directory: nat-lab
- uses: extractions/setup-just@dd310ad5a97d8e7b41793f8ef055398d51ad4de6 # v2.0.0
with:
just-version: 1.38.0
- name: Install uv
uses: astral-sh/setup-uv@v4
with:
# Install a specific version of uv.
version: "0.5.11"
- run: just autoflake
python-lint:
needs: uniffi-bindings
runs-on: ubuntu-24.04
Expand All @@ -117,7 +132,12 @@ jobs:
- run: cp dist/bindings/telio_bindings.py nat-lab/tests/uniffi/telio_bindings.py
- uses: extractions/setup-just@dd310ad5a97d8e7b41793f8ef055398d51ad4de6 # v2.0.0
with:
just-version: 1.37.0
just-version: 1.38.0
- name: Install uv
uses: astral-sh/setup-uv@v4
with:
# Install a specific version of uv.
version: "0.5.11"
- run: just pylint
natlab-typecheck:
needs: uniffi-bindings
Expand All @@ -129,17 +149,21 @@ jobs:
name: telio_bindings.py
path: dist/bindings
- run: cp dist/bindings/telio_bindings.py nat-lab/tests/uniffi/telio_bindings.py
- run: pip3 install --no-deps -r requirements.txt
- run: pipenv install --system
- run: pipenv install --system
working-directory: nat-lab
- run: mypy .
working-directory: nat-lab
- run: cp dist/bindings/telio_bindings.py nat-lab/tests/uniffi/telio_bindings.py
- uses: extractions/setup-just@dd310ad5a97d8e7b41793f8ef055398d51ad4de6 # v2.0.0
with:
just-version: 1.38.0
- name: Install uv
uses: astral-sh/setup-uv@v4
with:
# Install a specific version of uv.
version: "0.5.11"
- run: just mypy
unused-features:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
- uses: extractions/setup-just@dd310ad5a97d8e7b41793f8ef055398d51ad4de6 # v2.0.0
with:
just-version: 1.37.0
just-version: 1.38.0
- run: just deny
2 changes: 1 addition & 1 deletion .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ libtelio-build-pipeline:

trigger:
project: $LIBTELIO_BUILD_PROJECT_PATH
branch: v2.8.3 # REMEMBER to also update in .github/workflows/gitlab.yml
branch: convert-to-uv # REMEMBER to also update in .github/workflows/gitlab.yml
1 change: 1 addition & 0 deletions .unreleased/LLT-5967
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
nat-lab: migrate from pipenv to uv
24 changes: 21 additions & 3 deletions Justfile
Original file line number Diff line number Diff line change
Expand Up @@ -55,23 +55,41 @@ deny: _deny-install
prepush: test clippy udeps unused deny black pylint

# Run the black python linter
[working-directory: 'nat-lab']
black fix="false":
#!/usr/bin/env bash
set -euxo pipefail
if [[ {{fix}} == "true" ]]; then
docker run --rm -t -v$(pwd):/code 'ubuntu:22.04' sh -c "apt-get update && apt-get -y install python3-pip && cd code && pip3 install --no-deps -r requirements.txt && pipenv install --system && cd nat-lab && pipenv install --system && black --color . && cd ../ci && black --color ."
uv run --isolated black --color . && uv run --isolated black --color ../ci
else
docker run --rm -t -v$(pwd):/code 'ubuntu:22.04' sh -c "apt-get update && apt-get -y install python3-pip && cd code && pip3 install --no-deps -r requirements.txt && pipenv install --system && cd nat-lab && pipenv install --system && black --check --diff --color . && cd ../ci && black --check --diff --color ."
uv run --isolated black --check --diff --color . && uv run --isolated black --check --diff --color ../ci
fi
# Run the pylint linter
[working-directory: 'nat-lab']
pylint:
docker run --rm -t -v$(pwd):/code 'ubuntu:24.04' sh -c "export DEBIAN_FRONTEND=noninteractive && apt-get update && apt-get -y install python3-pip && rm -f /usr/lib/python3.12/EXTERNALLY-MANAGED && cd code && pip3 install --no-deps -r requirements.txt && pipenv install --system && cd nat-lab && pipenv install --system && pylint -f colorized . --ignore telio_bindings.py"
uv run --isolated pylint -f colorized . --ignore telio_bindings.py

# Start a dev web cgi server, for local teliod cgi development
web:
@echo "Go to http://127.0.0.1:8080/cgi-bin/teliod.cgi"
python3 -m http.server --cgi -d $(pwd)/contrib/http_root/ -b 127.0.0.1 8080

# Run the isort linter
[working-directory: 'nat-lab']
isort:
uv run --isolated isort --check-only --diff .

# Run mypy type checker
[working-directory: 'nat-lab']
mypy:
uv run --isolated mypy .

# Run the autoflake linter
[working-directory: 'nat-lab']
autoflake:
uv run --isolated autoflake --quiet --check .

_udeps-install: _nightly-install
cargo +{{ nightly }} install cargo-udeps@0.1.47 --locked

Expand Down
20 changes: 0 additions & 20 deletions Pipfile

This file was deleted.

Loading

0 comments on commit f99b664

Please sign in to comment.