Use uv instead of plain pip (#2693)
This commit is contained in:
parent
ea9e01e3b0
commit
bf337d62d5
29
.github/workflows/main.yml
vendored
29
.github/workflows/main.yml
vendored
@ -12,31 +12,40 @@ jobs:
|
||||
name: "Python ${{ matrix.python-version }} ${{ matrix.os }}"
|
||||
runs-on: "${{ matrix.os }}"
|
||||
timeout-minutes: 10
|
||||
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
|
||||
os: [windows-latest, ubuntu-latest, macos-latest]
|
||||
|
||||
steps:
|
||||
- uses: "actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8" # v5.0.0
|
||||
- uses: "actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c" # v6.0.0
|
||||
|
||||
- name: Install uv
|
||||
uses: astral-sh/setup-uv@557e51de59eb14aaaba2ed9621916900a91d50c6 # v6.6.1
|
||||
with:
|
||||
python-version: "${{ matrix.python-version }}"
|
||||
- name: "Install dependencies"
|
||||
run: "scripts/install"
|
||||
shell: bash
|
||||
- name: "Run linting checks"
|
||||
run: "scripts/check"
|
||||
python-version: ${{ matrix.python-version }}
|
||||
enable-cache: ${{ matrix.os != 'windows-latest' }}
|
||||
|
||||
- name: Install dependencies
|
||||
run: scripts/install
|
||||
shell: bash
|
||||
|
||||
- name: Run linting checks
|
||||
run: scripts/check
|
||||
if: "${{ matrix.os == 'ubuntu-latest'}}"
|
||||
|
||||
- name: "Build package & docs"
|
||||
run: "scripts/build"
|
||||
run: scripts/build
|
||||
shell: bash
|
||||
|
||||
- name: "Run tests"
|
||||
run: "scripts/test"
|
||||
run: scripts/test
|
||||
shell: bash
|
||||
|
||||
- name: "Enforce coverage"
|
||||
run: "scripts/coverage"
|
||||
run: scripts/coverage
|
||||
shell: bash
|
||||
|
||||
# https://github.com/marketplace/actions/alls-green#why
|
||||
|
||||
7
.github/workflows/publish.yml
vendored
7
.github/workflows/publish.yml
vendored
@ -11,9 +11,12 @@ jobs:
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
|
||||
- uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v6.0.0
|
||||
|
||||
- name: Install uv
|
||||
uses: astral-sh/setup-uv@557e51de59eb14aaaba2ed9621916900a91d50c6 # v6.6.1
|
||||
with:
|
||||
python-version: "3.12"
|
||||
python-version: "3.11"
|
||||
enable-cache: true
|
||||
|
||||
- name: Install dependencies
|
||||
run: scripts/install
|
||||
|
||||
@ -46,6 +46,41 @@ standard = [
|
||||
"websockets>=10.4",
|
||||
]
|
||||
|
||||
[dependency-groups]
|
||||
dev = [
|
||||
# We add uvicorn[standard] so `uv sync` considers the extras.
|
||||
"uvicorn[standard]",
|
||||
"ruff==0.11.9",
|
||||
"pytest==8.3.5",
|
||||
"pytest-mock==3.14.0",
|
||||
"pytest-xdist[psutil]==3.6.1",
|
||||
"mypy==1.15.0",
|
||||
"types-click==7.1.8",
|
||||
"types-pyyaml==6.0.12.20250402",
|
||||
"trustme==1.2.1",
|
||||
"cryptography==44.0.3",
|
||||
"coverage==7.8.0",
|
||||
"coverage-conditional-plugin==0.9.0",
|
||||
"coverage-enable-subprocess==1.0",
|
||||
"httpx==0.28.1",
|
||||
# check dist
|
||||
"twine==6.1.0",
|
||||
# Explicit optionals,
|
||||
"a2wsgi==1.10.8",
|
||||
"wsproto==1.2.0",
|
||||
"websockets==13.1",
|
||||
]
|
||||
docs = [
|
||||
"mkdocs==1.6.1",
|
||||
"mkdocs-material==9.6.13",
|
||||
"mkdocstrings-python==1.16.12",
|
||||
"mkdocs-llmstxt==0.2.0",
|
||||
]
|
||||
|
||||
[tool.uv]
|
||||
default-groups = ["dev", "docs"]
|
||||
required-version = ">=0.8.6"
|
||||
|
||||
[project.scripts]
|
||||
uvicorn = "uvicorn.main:main"
|
||||
|
||||
|
||||
@ -1,34 +0,0 @@
|
||||
-e .[standard]
|
||||
|
||||
# Core dependencies
|
||||
h11==0.16.0
|
||||
|
||||
# Explicit optionals
|
||||
a2wsgi==1.10.8
|
||||
wsproto==1.2.0
|
||||
websockets==13.1
|
||||
|
||||
# Packaging
|
||||
build==1.2.2.post1
|
||||
twine==6.1.0
|
||||
|
||||
# Testing
|
||||
ruff==0.11.9
|
||||
pytest==8.3.5
|
||||
pytest-mock==3.14.0
|
||||
pytest-xdist[psutil]==3.6.1
|
||||
mypy==1.15.0
|
||||
types-click==7.1.8
|
||||
types-pyyaml==6.0.12.20250402
|
||||
trustme==1.2.1
|
||||
cryptography==44.0.3
|
||||
coverage==7.8.0
|
||||
coverage-conditional-plugin==0.9.0
|
||||
coverage-enable-subprocess==1.0
|
||||
httpx==0.28.1
|
||||
|
||||
# Documentation
|
||||
mkdocs==1.6.1
|
||||
mkdocs-material==9.6.13
|
||||
mkdocstrings-python==1.16.12
|
||||
mkdocs-llmstxt==0.2.0
|
||||
@ -1,13 +1,7 @@
|
||||
#!/bin/sh -e
|
||||
|
||||
if [ -d 'venv' ] ; then
|
||||
PREFIX="venv/bin/"
|
||||
else
|
||||
PREFIX=""
|
||||
fi
|
||||
|
||||
set -x
|
||||
|
||||
${PREFIX}python -m build
|
||||
${PREFIX}twine check dist/*
|
||||
${PREFIX}mkdocs build
|
||||
uv build
|
||||
uv run twine check dist/*
|
||||
uv run mkdocs build
|
||||
|
||||
@ -1,15 +1,10 @@
|
||||
#!/bin/sh -e
|
||||
|
||||
export PREFIX=""
|
||||
if [ -d 'venv' ] ; then
|
||||
export PREFIX="venv/bin/"
|
||||
export PATH=${PREFIX}:${PATH}
|
||||
fi
|
||||
export SOURCE_FILES="uvicorn tests"
|
||||
|
||||
set -x
|
||||
|
||||
./scripts/sync-version
|
||||
${PREFIX}ruff format --check --diff $SOURCE_FILES
|
||||
${PREFIX}mypy $SOURCE_FILES
|
||||
${PREFIX}ruff check $SOURCE_FILES
|
||||
uv run ruff format --check --diff $SOURCE_FILES
|
||||
uv run mypy $SOURCE_FILES
|
||||
uv run ruff check $SOURCE_FILES
|
||||
|
||||
@ -1,12 +1,8 @@
|
||||
#!/bin/sh -e
|
||||
|
||||
export PREFIX=""
|
||||
if [ -d 'venv' ]; then
|
||||
export PREFIX="venv/bin/"
|
||||
fi
|
||||
export SOURCE_FILES="uvicorn tests"
|
||||
|
||||
set -x
|
||||
|
||||
${PREFIX}coverage combine
|
||||
${PREFIX}coverage report
|
||||
uv run coverage combine
|
||||
uv run coverage report
|
||||
|
||||
@ -1,10 +1,5 @@
|
||||
#!/bin/sh -e
|
||||
|
||||
PREFIX=""
|
||||
if [ -d "venv" ] ; then
|
||||
PREFIX="venv/bin/"
|
||||
fi
|
||||
|
||||
set -x
|
||||
|
||||
${PREFIX}mkdocs "$@"
|
||||
uv run mkdocs "$@"
|
||||
|
||||
@ -1,19 +1,5 @@
|
||||
#!/bin/sh -e
|
||||
|
||||
# Use the Python executable provided from the `-p` option, or a default.
|
||||
[ "$1" = "-p" ] && PYTHON=$2 || PYTHON="python3"
|
||||
|
||||
REQUIREMENTS="requirements.txt"
|
||||
VENV="venv"
|
||||
|
||||
set -x
|
||||
|
||||
if [ -z "$GITHUB_ACTIONS" ]; then
|
||||
"$PYTHON" -m venv "$VENV"
|
||||
PIP="$VENV/bin/pip"
|
||||
else
|
||||
PIP="$PYTHON -m pip"
|
||||
fi
|
||||
|
||||
${PIP} install -U pip
|
||||
${PIP} install -r "$REQUIREMENTS"
|
||||
uv sync --frozen
|
||||
|
||||
@ -1,13 +1,8 @@
|
||||
#!/bin/sh -e
|
||||
|
||||
export PREFIX=""
|
||||
if [ -d 'venv' ] ; then
|
||||
export PREFIX="venv/bin/"
|
||||
export PATH=${PREFIX}:${PATH}
|
||||
fi
|
||||
export SOURCE_FILES="uvicorn tests"
|
||||
|
||||
set -x
|
||||
|
||||
${PREFIX}ruff format $SOURCE_FILES
|
||||
${PREFIX}ruff check --fix $SOURCE_FILES
|
||||
uv run ruff format $SOURCE_FILES
|
||||
uv run ruff check --fix $SOURCE_FILES
|
||||
|
||||
@ -2,12 +2,6 @@
|
||||
|
||||
VERSION_FILE="uvicorn/__init__.py"
|
||||
|
||||
if [ -d 'venv' ] ; then
|
||||
PREFIX="venv/bin/"
|
||||
else
|
||||
PREFIX=""
|
||||
fi
|
||||
|
||||
if [ ! -z "$GITHUB_ACTIONS" ]; then
|
||||
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
|
||||
git config --local user.name "GitHub Action"
|
||||
@ -22,5 +16,5 @@ fi
|
||||
|
||||
set -x
|
||||
|
||||
${PREFIX}twine upload dist/*
|
||||
${PREFIX}mkdocs gh-deploy --force
|
||||
uv run twine upload dist/*
|
||||
uv run mkdocs gh-deploy --force
|
||||
|
||||
@ -1,10 +1,5 @@
|
||||
#!/bin/sh
|
||||
|
||||
export PREFIX=""
|
||||
if [ -d 'venv' ]; then
|
||||
export PREFIX="venv/bin/"
|
||||
fi
|
||||
|
||||
set -ex
|
||||
|
||||
if [ -z $GITHUB_ACTIONS ]; then
|
||||
@ -13,7 +8,7 @@ fi
|
||||
|
||||
export COVERAGE_PROCESS_START=$(pwd)/pyproject.toml
|
||||
|
||||
${PREFIX}coverage run --debug config -m pytest "$@"
|
||||
uv run coverage run --debug config -m pytest "$@"
|
||||
|
||||
if [ -z $GITHUB_ACTIONS ]; then
|
||||
scripts/coverage
|
||||
|
||||
Loading…
Reference in New Issue
Block a user