Skip to content

Commit

Permalink
move to uv (mitmproxy#746)
Browse files Browse the repository at this point in the history
  • Loading branch information
mhils authored Oct 11, 2024
1 parent 85f7f28 commit 3887af5
Show file tree
Hide file tree
Showing 7 changed files with 706 additions and 126 deletions.
2 changes: 1 addition & 1 deletion .github/python-version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.13-dev
3.13
20 changes: 8 additions & 12 deletions .github/workflows/autofix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: autofix.ci
on:
pull_request:
push:
branches: [ "main" ]
branches: [ "main", "ci" ]
permissions:
contents: read
concurrency:
Expand All @@ -13,19 +13,15 @@ jobs:
autofix:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version-file: .github/python-version.txt
- uses: mhils/workflows/checkout@v11
- uses: mhils/workflows/setup-python@v11
- uses: mhils/workflows/setup-uv@v11

- run: pip install -r requirements-dev.txt
- run: pip install --no-deps -e .
- run: uv run ruff check --fix-only .
- run: uv run ruff format .

- run: ruff check --fix-only .
- run: ruff format .
- run: uv run test/test_snapshot.py

- run: test/test_snapshot.py

- uses: mhils/add-pr-ref-in-changelog@main
- uses: mhils/add-pr-ref-in-changelog@v1

- uses: autofix-ci/action@dd55f44df8f7cdb7a6bf74c78677eb8acd40cd0a
2 changes: 1 addition & 1 deletion .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.12'
python-version: '3.13'

# ADJUST THIS: install all dependencies (including pdoc)
- run: pip install -e .
Expand Down
43 changes: 28 additions & 15 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,23 +16,34 @@ concurrency:

jobs:
lint:
uses: mhils/workflows/.github/workflows/python-tox.yml@v10
with:
cmd: tox -e lint
runs-on: ubuntu-latest
steps:
- uses: mhils/workflows/checkout@v11
- uses: mhils/workflows/setup-python@v11
- uses: mhils/workflows/setup-uv@v11
- run: uv run tox -e lint

old-dependencies:
runs-on: ubuntu-latest
steps:
- uses: mhils/workflows/checkout@v11
- uses: mhils/workflows/setup-python@v11
- uses: mhils/workflows/setup-uv@v11
- run: uv run tox -e old-dependencies

test:
strategy:
fail-fast: false
matrix:
include:
- os: windows-latest
py: 3.13-dev
py: 3.13.0
args: --cov-fail-under=100
- os: macos-latest
py: 3.13-dev
py: 3.13.0
args: --cov-fail-under=100
- os: ubuntu-latest
py: 3.13-dev
py: 3.13.0
args: --cov-fail-under=100
- os: ubuntu-latest
py: 3.12.4
Expand All @@ -44,20 +55,22 @@ jobs:
py: 3.9.18
- os: ubuntu-latest
py: 3.8.18
uses: mhils/workflows/.github/workflows/python-tox.yml@v10
with:
cmd: tox -e py -- -vvv ${{ matrix.args }}
os: ${{ matrix.os }}
python-version: ${{ matrix.py }}
runs-on: ${{ matrix.os }}
steps:
- uses: mhils/workflows/checkout@v11
- uses: mhils/workflows/setup-python@v11
with:
python-version: ${{ matrix.py }}
- uses: mhils/workflows/setup-uv@main
- run: uv run tox -e py -- -vvv ${{ matrix.args }}

build:
uses: mhils/workflows/.github/workflows/python-build.yml@v10
uses: mhils/workflows/.github/workflows/python-build.yml@v11
permissions:
contents: read
id-token: write
attestations: write


attest:
needs: build
if: github.event_name != 'pull_request'
Expand All @@ -82,13 +95,13 @@ jobs:
- test
- build
- attest
uses: mhils/workflows/.github/workflows/alls-green.yml@v10
uses: mhils/workflows/.github/workflows/alls-green.yml@v11
with:
jobs: ${{ toJSON(needs) }}
allowed-skips: '["attest"]'

deploy:
uses: mhils/workflows/.github/workflows/python-deploy.yml@v10
uses: mhils/workflows/.github/workflows/python-deploy.yml@v11
with:
artifact-name: wheels
needs: check
Expand Down
34 changes: 17 additions & 17 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ dynamic = ["version"]
dependencies = [
"Jinja2 >= 2.11.0",
"pygments >= 2.12.0",
"MarkupSafe",
"MarkupSafe >= 1.1.1",
"astunparse; python_version<'3.9'",
]

Expand Down Expand Up @@ -41,18 +41,18 @@ Issues = "https://github.com/mitmproxy/pdoc/issues"
[project.scripts]
pdoc = "pdoc.__main__:cli"

[project.optional-dependencies]
dev = [
"tox",
"ruff",
"mypy",
"types-pygments",
"pytest",
"pytest-cov",
"pytest-timeout",
"hypothesis",
"pygments >= 2.14.0",
"pdoc-pyo3-sample-library==1.0.11",
[tool.uv]
dev-dependencies = [
"tox>=4.21.2",
"tox-uv>=1.13.0",
"ruff>=0.6.9",
"mypy>=1.11.2",
"types-pygments>=2.18.0.20240506",
"pytest>=8.3.3",
"pytest-cov>=5.0.0",
"pytest-timeout>=2.3.1",
"hypothesis>=6.113.0",
"pdoc-pyo3-sample-library>=1.0.11",
]

[build-system]
Expand Down Expand Up @@ -110,17 +110,17 @@ isort = { force-single-line = true, force-sort-within-sections = true }
legacy_tox_ini = """
[tox]
envlist = lint, py
skipsdist = True
toxworkdir = {env:TOX_WORK_DIR:.tox}
runner = uv-venv-lock-runner
[testenv]
deps =
-r requirements-dev.txt
-e .
commands =
pdoc --version
pytest --cov=pdoc --cov-report term-missing {posargs:-m "not slow"}
[testenv:old-dependencies]
uv_resolution = lowest
[testenv:lint]
commands =
ruff check . {posargs}
Expand Down
80 changes: 0 additions & 80 deletions requirements-dev.txt

This file was deleted.

Loading

0 comments on commit 3887af5

Please sign in to comment.