Skip to content

Commit

Permalink
Use uv to manage the project environment
Browse files Browse the repository at this point in the history
Signed-off-by: Emanuele Giaquinta <[email protected]>
  • Loading branch information
exg committed Jan 6, 2025
1 parent f4aea17 commit 5781925
Show file tree
Hide file tree
Showing 8 changed files with 807 additions and 39 deletions.
8 changes: 6 additions & 2 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ concurrency:

env:
RUST_TOOLCHAIN: nightly-2024-10-18
UV_PYTHON: 3.11
UV_VERSION: 0.5.14

jobs:
lint:
Expand All @@ -24,6 +26,8 @@ jobs:
- run: rustup component add clippy rustfmt
- uses: actions/setup-python@v5
with:
python-version: '3.11'
- run: pip install -r requirements.txt
python-version: ${{ env.UV_PYTHON }}
- uses: astral-sh/setup-uv@v5
with:
version: ${{ env.UV_VERSION }}
- run: scripts/lint.sh
49 changes: 31 additions & 18 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ concurrency:

env:
RUST_TOOLCHAIN: nightly-2024-10-18
UV_VERSION: 0.5.14

jobs:
build-linux-x86_64:
Expand All @@ -25,6 +26,8 @@ jobs:
strategy:
matrix:
python-version: ['3.9', '3.10', '3.11', '3.12', '3.13']
env:
UV_PYTHON: ${{ matrix.python-version }}

steps:
- uses: actions/checkout@v4
Expand All @@ -38,11 +41,12 @@ jobs:
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- run: python3 -m venv .venv
- run: .venv/bin/pip install -U pip wheel
- run: .venv/bin/pip install -r requirements.txt
- run: .venv/bin/pip install ormsgpack --no-index -f target/wheels
- run: .venv/bin/pytest
- uses: astral-sh/setup-uv@v5
with:
version: ${{ env.UV_VERSION }}
- run: uv sync --frozen --no-install-project
- run: uv pip install ormsgpack --no-index -f target/wheels
- run: uv run --no-sync pytest
- uses: actions/upload-artifact@v4
with:
name: ormsgpack-x86_64-unknown-linux-gnu-${{ matrix.python-version }}
Expand Down Expand Up @@ -80,16 +84,17 @@ jobs:
- run: |
docker run \
--rm \
-e UV_CACHE_DIR=/work/.uv_cache \
-v "$GITHUB_WORKSPACE":/work \
-w /work \
--platform ${{ matrix.target.platform }} \
python:${{ matrix.python-version }}-bookworm \
bash -e -c '
python3 -m venv .venv
.venv/bin/pip install -U pip wheel
.venv/bin/pip install -r tests/requirements.txt
.venv/bin/pip install ormsgpack --no-index -f target/wheels
.venv/bin/pytest
curl --proto =https --tlsv1.2 -LsSf https://astral.sh/uv/${{ env.UV_VERSION }}/install.sh | sh
export PATH=$PATH:$HOME/.local/bin
uv sync --frozen --no-install-project
uv pip install ormsgpack --no-index -f target/wheels
uv run --no-sync pytest
'
- uses: actions/upload-artifact@v4
with:
Expand All @@ -103,6 +108,8 @@ jobs:
strategy:
matrix:
python-version: ['3.9', '3.10', '3.11', '3.12', '3.13']
env:
UV_PYTHON: ${{ matrix.python-version }}
steps:
- uses: actions/checkout@v4
- name: Set up Python
Expand All @@ -114,10 +121,12 @@ jobs:
target: x86_64-pc-windows-msvc
rust-toolchain: ${{ env.RUST_TOOLCHAIN }}
args: --release -i ${{ env.pythonLocation }}\python.exe
- run: python -m pip install --user -U pip wheel
- run: pip install -r requirements.txt
- run: pip install ormsgpack --no-index -f target/wheels
- run: pytest
- uses: astral-sh/setup-uv@v5
with:
version: ${{ env.UV_VERSION }}
- run: uv sync --frozen --no-install-project
- run: uv pip install ormsgpack --no-index -f target/wheels
- run: uv run --no-sync pytest
- uses: actions/upload-artifact@v4
with:
name: ormsgpack-x86_64-pc-windows-msvc-${{ matrix.python-version }}
Expand All @@ -129,6 +138,8 @@ jobs:
strategy:
matrix:
python-version: ['3.9', '3.10', '3.11', '3.12', '3.13']
env:
UV_PYTHON: ${{ matrix.python-version }}
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
Expand All @@ -141,10 +152,12 @@ jobs:
target: universal2-apple-darwin
rust-toolchain: ${{ env.RUST_TOOLCHAIN }}
args: --release -i python${{ matrix.python-version }}
- run: python -m pip install -U pip wheel
- run: pip install -r requirements.txt
- run: pip install ormsgpack --no-index -f target/wheels
- run: pytest
- uses: astral-sh/setup-uv@v5
with:
version: ${{ env.UV_VERSION }}
- run: uv sync --frozen --no-install-project
- run: uv pip install ormsgpack --no-index -f target/wheels
- run: uv run --no-sync pytest
- uses: actions/upload-artifact@v4
with:
name: ormsgpack-universal-apple-darwin-${{ matrix.python-version }}
Expand Down
2 changes: 0 additions & 2 deletions benchmarks/requirements.txt

This file was deleted.

17 changes: 17 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,23 @@ classifiers = [
]
dynamic = ["version"]

[dependency-groups]
dev = [
"msgpack",
"mypy",
"numpy; platform_machine != 'armv7l'",
"pendulum; platform_machine != 'armv7l' and python_version < '3.13'",
"pydantic",
"pytest",
"pytest-benchmark",
"python-dateutil",
"pytz",
"ruff",
"types-python-dateutil",
"types-pytz",
"tzdata",
]

[build-system]
build-backend = "maturin"
requires = ["maturin>=1.0,<2.0"]
Expand Down
5 changes: 0 additions & 5 deletions requirements.txt

This file was deleted.

7 changes: 4 additions & 3 deletions scripts/lint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@

set -eou pipefail

ruff format --check .
ruff check .
mypy .
uv sync --frozen
uv run --no-sync ruff format --check .
uv run --no-sync ruff check .
uv run --no-sync mypy .
cargo fmt --check
cargo clippy -- -D warnings
9 changes: 0 additions & 9 deletions tests/requirements.txt

This file was deleted.

Loading

0 comments on commit 5781925

Please sign in to comment.