Skip to content
Merged
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
23 changes: 23 additions & 0 deletions .github/actions/uv-build/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: uv-build
description: Build the project with uv and run smoke tests
inputs:
python-version:
description: Python version to install
required: true
runs:
using: composite
steps:
- name: Install uv
uses: astral-sh/setup-uv@v6
- name: Install Python
shell: bash
run: uv python install ${{ inputs.python-version }}
- name: Build
shell: bash
run: uv build
- name: Smoke test (wheel)
shell: bash
run: uv run --isolated --no-project --with dist/*.whl tests/smoke_test.py
- name: Smoke test (source distribution)
shell: bash
run: uv run --isolated --no-project --with dist/*.tar.gz tests/smoke_test.py
22 changes: 22 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Build

on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
run:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.9', '3.10', '3.11', '3.12', '3.13']
steps:
- name: Checkout
uses: actions/checkout@v5
- name: Build and smoke test
uses: ./.github/actions/uv-build
with:
python-version: ${{ matrix.python-version }}
39 changes: 39 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: PyPI Publish

on:
push:
tags:
# Publish on any tag starting with a `v`, e.g., v0.1.0
- v*
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.9', '3.10', '3.11', '3.12', '3.13']
steps:
- name: Checkout
uses: actions/checkout@v5
- name: Build and smoke test
uses: ./.github/actions/uv-build
with:
python-version: ${{ matrix.python-version }}

publish:
runs-on: ubuntu-latest
needs: build
environment:
name: pypi
permissions:
id-token: write
contents: read
steps:
- name: Checkout
uses: actions/checkout@v5
- name: Build and smoke test
uses: ./.github/actions/uv-build
with:
python-version: '3.12'
- name: Publish
run: uv publish
10 changes: 8 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,18 @@ dev = [
"ruff>=0.9.10",
"tqdm>=4.67.1",
"wandb>=0.19.8",
"pytest>=8.4.2",
]


[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"
requires = ["uv_build>=0.8.14,<0.9.0"]
build-backend = "uv_build"


[tool.uv.build-backend]
module-name = "dad"
module-root = ""


[tool.uv.sources]
Expand Down
6 changes: 6 additions & 0 deletions tests/smoke_test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import dad


def test_smoke():
model = dad.load_DaD()
assert model is not None
9 changes: 9 additions & 0 deletions tests/vis_test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import dad
from dad.utils import visualize_keypoints


def test_vis():
detector = dad.load_DaD()
img_path = "assets/0015_A.jpg"
vis_path = "vis/0015_A_dad.jpg"
visualize_keypoints(img_path, vis_path, detector, num_keypoints = 512)
107 changes: 107 additions & 0 deletions uv.lock

Large diffs are not rendered by default.