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

poetry -> uv #194

Merged
merged 6 commits into from
Nov 26, 2024
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
2 changes: 1 addition & 1 deletion .github/workflows/conda-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ jobs:
if: steps.cache.outputs.cache-hit != 'true'

- name: Install happypose
run: pip install -e .[multiview]
run: pip install -r requirements/base.txt

- name: Download pre-trained models required for tests
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pip-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
run: pip install -U pip

- name: Install happypose
run: pip install ".[multiview,pypi]"
run: pip install -r requirements/cpu.txt -r requirements/pypi.txt

- name: Download pre-trained models required for tests
run: |
Expand Down
29 changes: 10 additions & 19 deletions .github/workflows/poetry-test.yml → .github/workflows/uv-test.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Tests with poetry + Coverage
name: Tests with uv

on: [ push, pull_request ]

Expand All @@ -16,27 +16,25 @@ jobs:
- name: Install EGL mesa - required for Panda3D renderer
run: sudo apt-get update && sudo apt-get install -qqy libegl1-mesa libegl1-mesa-dev

- name: Setup poetry
run: pipx install poetry

- name: Caching of the happypose installation and data
uses: actions/cache@v4
with:
path: local_data
key: data

- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: poetry
- name: Install uv
uses: astral-sh/setup-uv@v3

- name: Set up Python ${{ matrix.python-version }}
run: uv python install ${{ matrix.python-version }}

- name: Install happypose
run: poetry install --with dev -E pypi -E multiview
run: uv sync --extra cpu --extra pypi

- name: Download pre-trained models required for tests
run: |
mkdir -p local_data
poetry run python -m happypose.toolbox.utils.download \
uv run python -m happypose.toolbox.utils.download \
--megapose_models \
--examples \
barbecue-sauce \
Expand All @@ -47,12 +45,5 @@ jobs:

- name: Run tests
run: |
poetry run coverage run --source=happypose -m unittest
poetry run coverage run --source=happypose -m pytest tests -v

- name: Process coverage
run: poetry run coverage xml

#- uses: codecov/codecov-action@v4
#env:
#CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
uv run python -m unittest
uv run pytest tests -v
21 changes: 15 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

[![Conda](https://github.com/agimus-project/happypose/actions/workflows/conda-test.yml/badge.svg)](https://github.com/agimus-project/happypose/actions/workflows/conda-test.yml)
[![Pip](https://github.com/agimus-project/happypose/actions/workflows/pip-test.yml/badge.svg)](https://github.com/agimus-project/happypose/actions/workflows/pip-test.yml)
[![Poetry](https://github.com/agimus-project/happypose/actions/workflows/poetry-test.yml/badge.svg)](https://github.com/agimus-project/happypose/actions/workflows/poetry-test.yml)
[![uv](https://github.com/agimus-project/happypose/actions/workflows/uv-test.yml/badge.svg)](https://github.com/agimus-project/happypose/actions/workflows/uv-test.yml)
[![Book](https://github.com/agimus-project/happypose/actions/workflows/book.yml/badge.svg)](https://github.com/agimus-project/happypose/actions/workflows/book.yml)

[![pre-commit.ci status](https://results.pre-commit.ci/badge/github/agimus-project/happypose/main.svg)](https://results.pre-commit.ci/latest/github/agimus-project/happypose/main)
Expand All @@ -16,7 +16,7 @@ Toolbox and trackers for object pose-estimation. Based on the work [CosyPose](ht

## Installation

To install happypose, you can use pip or poetry.
To install happypose, you can use pip or uv.

We strongly suggest to install it in either a
[venv](https://docs.python.org/fr/3/library/venv.html) or a
Expand All @@ -29,7 +29,15 @@ git clone --branch dev --recurse-submodules https://github.com/agimus-project/ha
cd happypose
conda env create -f environment.yml
conda activate happypose
pip install .
pip install -r requirements/base.txt
```

### Example with uv

```
git clone --branch dev --recurse-submodules https://github.com/agimus-project/happypose.git
cd happypose
uv sync --extra pypi --extra cpu # you *must* choose between cpu / cu124
```

### Example with venv
Expand All @@ -39,13 +47,14 @@ git clone --branch dev --recurse-submodules https://github.com/agimus-project/ha
cd happypose
python -m venv .venv
source .venv/bin/activate
pip install .[pypi]
pip install -r requirements/pypi.txt -r requirements/cpu.txt # you *must* choose between cpu / cu124
```

### Install extras:

- `multiview`: installs cosypose c++ extension
- `pypi`: install torch, pinocchio & opencv from PyPI (don't use this with conda)
- `pypi`: install pinocchio & opencv from PyPI (don't use this with conda)
- `cpu`: install torch for CPU from wheel (don't use this with conda)
- `cu124`: install torch for CUDA 12.4 from wheel (don't use this with conda)

## Create data directory

Expand Down
4 changes: 2 additions & 2 deletions environment.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
#name: happypose_torch2
name: happypose
channels:
- conda-forge
- pytorch
- nvidia
- anaconda
- defaults
dependencies:
- pytorch-cuda==12.1
- pytorch-cuda==12.4
- pip
- pytorch
- torchvision
Expand Down
17 changes: 17 additions & 0 deletions happypose/pose_estimators/cosypose/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,20 @@ requires = [
"pybind11>=2.10.0",
"setuptools>=42"
]

[project]
authors = [
{name = "Yann Labbé"}
]
classifiers = ["License :: OSI Approved :: BSD License"]
description = "CosyPose C extension"
maintainers = [
{email = "[email protected]", name = "Guilhem Saurel"}
]
name = "cosypose"
readme = "README.md"
requires-python = ">=3.10"
version = "1.0.0"

[tool.setuptools]
packages = ["cosypose"]
Loading
Loading