Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

experiment: migrate to uv as package manager #12817

Draft
wants to merge 9 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
*.pdf binary
*.png binary
*.zip binary
uv.lock binary

# Unix-style line endings
[attr]unix text eol=lf
Expand Down
11 changes: 3 additions & 8 deletions .github/workflows/builddoc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ concurrency:

env:
FORCE_COLOR: "1"
UV_SYSTEM_PYTHON: "1" # make uv do global installs
UV_VERSION: 0.5.14 # Pin the version of UV

jobs:
verbose:
Expand All @@ -24,21 +24,16 @@ jobs:
- uses: actions/checkout@v4
with:
persist-credentials: false
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3"
- name: Install graphviz
run: sudo apt-get install --no-install-recommends --yes graphviz
- name: Install uv
uses: astral-sh/setup-uv@v5
with:
version: latest
version: ${{ env.UV_VERSION }}
enable-cache: false
- name: Install dependencies
run: uv pip install .[docs]
- name: Render the documentation
run: >
uv run
sphinx-build
-M html ./doc ./build/sphinx
--verbose
Expand Down
161 changes: 74 additions & 87 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ concurrency:

env:
FORCE_COLOR: "1"
UV_SYSTEM_PYTHON: "1" # make uv do global installs
UV_VERSION: 0.5.14 # Pin the version of UV

jobs:
# If you update any of these commands, don't forget to update the equivalent
Expand All @@ -26,22 +26,15 @@ jobs:
- uses: actions/checkout@v4
with:
persist-credentials: false
- name: Get Ruff version from pyproject.toml
run: |
RUFF_VERSION=$(awk -F'[="]' '/\[project\.optional-dependencies\]/ {p=1} /ruff/ {if (p) print $4}' pyproject.toml)
echo "RUFF_VERSION=$RUFF_VERSION" >> $GITHUB_ENV

- name: Install Ruff ${{ env.RUFF_VERSION }}
uses: astral-sh/ruff-action@v3
- name: Install uv
uses: astral-sh/setup-uv@v5
with:
args: --version
version: ${{ env.RUFF_VERSION }}

version: ${{ env.UV_VERSION }}
enable-cache: false
- name: Lint with Ruff
run: ruff check --output-format=github

run: uv run ruff check --output-format=github
- name: Format with Ruff
run: ruff format --diff
run: uv run ruff format --diff

mypy:
runs-on: ubuntu-latest
Expand All @@ -50,81 +43,75 @@ jobs:
- uses: actions/checkout@v4
with:
persist-credentials: false
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3"
- name: Install uv
uses: astral-sh/setup-uv@v5
with:
version: latest
version: ${{ env.UV_VERSION }}
enable-cache: false
- name: Install dependencies
run: uv pip install ".[lint,test]"
- name: Type check with mypy
run: mypy

pyright:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3"
- name: Install uv
uses: astral-sh/setup-uv@v5
with:
version: latest
enable-cache: false
- name: Install dependencies
run: uv pip install ".[lint,test]"
- name: Type check with pyright
run: pyright

docs-lint:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3"
- name: Install uv
uses: astral-sh/setup-uv@v5
with:
version: latest
enable-cache: false
- name: Install dependencies
run: uv pip install --upgrade sphinx-lint
- name: Lint documentation with sphinx-lint
run: make doclinter

twine:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3"
- name: Install uv
uses: astral-sh/setup-uv@v5
with:
version: latest
enable-cache: false
- name: Install dependencies
run: uv pip install --upgrade twine build
- name: Lint with twine
run: |
python -m build .
twine check dist/*
run: uv run mypy

# pyright:
# runs-on: ubuntu-latest

# steps:
# - uses: actions/checkout@v4
# with:
# persist-credentials: false
# - name: Set up Python
# uses: actions/setup-python@v5
# with:
# python-version: "3"
# - name: Install uv
# uses: astral-sh/setup-uv@v5
# with:
# version: ${{ env.UV_VERSION }}
# enable-cache: false
# - name: Install dependencies
# run: uv pip install ".[lint,test]"
# - name: Type check with pyright
# run: pyright

# docs-lint:
# runs-on: ubuntu-latest

# steps:
# - uses: actions/checkout@v4
# with:
# persist-credentials: false
# - name: Set up Python
# uses: actions/setup-python@v5
# with:
# python-version: "3"
# - name: Install uv
# uses: astral-sh/setup-uv@v5
# with:
# version: latest
# enable-cache: false
# - name: Install dependencies
# run: uv pip install --upgrade sphinx-lint
# - name: Lint documentation with sphinx-lint
# run: make doclinter

# twine:
# runs-on: ubuntu-latest

# steps:
# - uses: actions/checkout@v4
# with:
# persist-credentials: false
# - name: Set up Python
# uses: actions/setup-python@v5
# with:
# python-version: "3"
# - name: Install uv
# uses: astral-sh/setup-uv@v5
# with:
# version: latest
# enable-cache: false
# - name: Install dependencies
# run: uv pip install --upgrade twine build
# - name: Lint with twine
# run: |
# python -m build .
# twine check dist/*
Loading
Loading