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

ci: 👷 replace Poetry workflow with uv and switch to mkdocs-material-insiders #1771

Merged
merged 18 commits into from
Feb 18, 2025
Merged
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
730bbd2
ci: 👷 replace Poetry workflow with UV testing workflow and update dep…
onuralpszr Jan 8, 2025
fc40438
ci: 🐍 migrate from Poetry to uv for Python setup and dependency insta…
onuralpszr Jan 8, 2025
6ae1dfd
ci: 🐍 update workflows to use specific uv version and improve environ…
onuralpszr Jan 8, 2025
a61a6c7
chore: update author and maintainer email addresses in pyproject.toml
onuralpszr Jan 8, 2025
9587439
ci: 🔑 add GitHub App token creation for mkdocs and install mkdocs-mat…
onuralpszr Jan 8, 2025
071feea
docs: 📝 update CONTRIBUTING.md to replace Poetry with uv for dependen…
onuralpszr Jan 8, 2025
16848e9
docs: 📝 update installation instructions to replace Poetry with uv in…
onuralpszr Jan 8, 2025
3ee6de3
docs: 📝 update error message to include uv as an alternative for inst…
onuralpszr Jan 8, 2025
e543aac
ci: 🔑 separate TestPyPI publishing workflows
onuralpszr Jan 8, 2025
2a1542c
ci: 👷 rename release actions files
onuralpszr Jan 8, 2025
483cc06
build: 🛠️ set include-package-data to false in pyproject.toml
onuralpszr Jan 9, 2025
a5cad09
ci: 🔧 add version string to uv setup actions and refine test workflow…
onuralpszr Jan 9, 2025
4c03f89
Merge branch 'develop' into ci/build/changes
onuralpszr Jan 9, 2025
ea03d55
chore: delete removed B410 bandit rule
onuralpszr Jan 27, 2025
ee95689
Merge branch 'develop' into ci/build/changes
onuralpszr Feb 3, 2025
dc08d88
chore: update astral-sh/setup-uv to version 5.2.2 in workflow files
onuralpszr Feb 8, 2025
2c53eb1
chore: simplify numpy and scipy version constraints in pyproject.toml…
onuralpszr Feb 9, 2025
afcd0d6
chore: update email address for author and maintainer in pyproject.toml
onuralpszr Feb 18, 2025
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
45 changes: 0 additions & 45 deletions .github/workflows/poetry-test.yml

This file was deleted.

24 changes: 16 additions & 8 deletions .github/workflows/publish-docs.yml
Original file line number Diff line number Diff line change
@@ -33,17 +33,25 @@ jobs:
with:
fetch-depth: 0

- name: 🐍 Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0
- name: 🐍 Install uv and set Python ${{ matrix.python-version }}
uses: astral-sh/setup-uv@4db96194c378173c656ce18a155ffc14a9fc4355 # v5.2.2
with:
python-version: ${{ matrix.python-version }}

- name: 📜 Setup Poetry
uses: abatilo/actions-poetry@3765cf608f2d4a72178a9fc5b918668e542b89b1 # v4.0.0
- name: 🔑 Create GitHub App token (mkdocs)
id: mkdocs_token
uses: actions/create-github-app-token@c1a285145b9d317df6ced56c09f525b5c2b6f755 # v1.11.1
with:
app-id: ${{ secrets.MKDOCS_APP_ID }}
private-key: ${{ secrets.MKDOCS_PEM }}
owner: roboflow
repositories: mkdocs-material-insiders

- name: 📦 Install dependencies
- name: 🏗️ Install dependencies
run: |
poetry install --with=docs
uv pip install -r pyproject.toml --extra docs
# Install mkdocs-material-insiders using the GitHub App token
uv pip install "git+https://roboflow:${{ steps.mkdocs_token.outputs.token }}@github.com/roboflow/mkdocs-material-insiders.git@9.5.49-insiders-4.53.14#egg=mkdocs-material[imaging]"

- name: ⚙️ Configure git for github-actions
run: |
@@ -53,10 +61,10 @@ jobs:
- name: 🚀 Deploy Development Docs
if: (github.event_name == 'push' && github.ref == 'refs/heads/develop') || github.event_name == 'workflow_dispatch'
run: |
MKDOCS_GIT_COMMITTERS_APIKEY=${{ secrets.GITHUB_TOKEN }} poetry run mike deploy --push develop
MKDOCS_GIT_COMMITTERS_APIKEY=${{ secrets.GITHUB_TOKEN }} uv run mike deploy --push develop

- name: 🚀 Deploy Release Docs
if: github.event_name == 'release' && github.event.action == 'published'
run: |
latest_tag=$(git describe --tags `git rev-list --tags --max-count=1`)
MKDOCS_GIT_COMMITTERS_APIKEY=${{ secrets.GITHUB_TOKEN }} poetry run mike deploy --push --update-aliases $latest_tag latest
MKDOCS_GIT_COMMITTERS_APIKEY=${{ secrets.GITHUB_TOKEN }} uv run mike deploy --push --update-aliases $latest_tag latest
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Publish Supervision Pre-Releases to PyPI and TestPyPI
name: Publish Supervision Pre-Releases to PyPI

on:
push:
@@ -11,10 +11,12 @@ on:
permissions: {} # Explicitly remove all permissions by default

jobs:
build-and-publish-pre-release:
name: Publish Pre-releasePackage
publish-pre-release:
name: Publish Pre-release Package
runs-on: ubuntu-latest
environment: test
environment:
name: test
url: https://pypi.org/project/supervision/
timeout-minutes: 10
permissions:
id-token: write # Required for PyPI publishing
@@ -26,27 +28,18 @@ jobs:
- name: 📥 Checkout the repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2

- name: 🐍 Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0
- name: 🐍 Install uv and set Python version ${{ matrix.python-version }}
uses: astral-sh/setup-uv@4db96194c378173c656ce18a155ffc14a9fc4355 # v5.2.2
with:
python-version: ${{ matrix.python-version }}

- name: 📜 Setup Poetry
uses: abatilo/actions-poetry@3765cf608f2d4a72178a9fc5b918668e542b89b1 # v4.0.0

- name: 🏗️ Build source and wheel distributions
run: |
poetry install --with=build
poetry build
poetry run twine check --strict dist/*
uv pip install -r pyproject.toml --extra build
uv build
uv run twine check --strict dist/*

- name: 🚀 Publish to PyPi
uses: pypa/gh-action-pypi-publish@76f52bc884231f62b9a034ebfe128415bbaabdfc # v1.12.4
with:
attestations: true

- name: 🚀 Publish to Test-PyPi
uses: pypa/gh-action-pypi-publish@76f52bc884231f62b9a034ebfe128415bbaabdfc # v1.12.4
with:
repository-url: https://test.pypi.org/legacy/
attestations: true
43 changes: 43 additions & 0 deletions .github/workflows/publish-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Publish Supervision Releases to PyPI

on:
push:
tags:
- "[0-9]+.[0-9]+[0-9]+.[0-9]"
workflow_dispatch:

permissions: {} # Explicitly remove all permissions by default

jobs:
publish-release:
name: Publish Release Package
runs-on: ubuntu-latest
environment:
name: release
url: https://pypi.org/project/supervision/
timeout-minutes: 10
permissions:
id-token: write # Required for PyPI publishing
contents: read # Required for checkout
strategy:
matrix:
python-version: ["3.10"]
steps:
- name: 📥 Checkout the repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2

- name: 🐍 Install uv and set Python version ${{ matrix.python-version }}
uses: astral-sh/setup-uv@4db96194c378173c656ce18a155ffc14a9fc4355 # v5.2.2
with:
python-version: ${{ matrix.python-version }}

- name: 🏗️ Build source and wheel distributions
run: |
uv pip install -r pyproject.toml --extra build
uv build
uv run twine check --strict dist/*

- name: 🚀 Publish to PyPi
uses: pypa/gh-action-pypi-publish@67339c736fd9354cd4f8cb0b744f2b82a74b5c70 # v1.12.3
with:
attestations: true
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
name: Publish Supervision Releases to PyPI and TestPyPI
name: Publish Supervision Releases to TestPyPI

on:
push:
tags:
- "[0-9]+.[0-9]+[0-9]+.[0-9]"
workflow_dispatch:

permissions: {} # Explicitly remove all permissions by default

jobs:
build-and-publish-pre-release:
publish-testpypi:
name: Publish Release Package
runs-on: ubuntu-latest
environment: release
environment:
name: release
url: https://pypi.org/project/supervision/
timeout-minutes: 10
permissions:
id-token: write # Required for PyPI publishing
@@ -24,24 +23,16 @@ jobs:
- name: 📥 Checkout the repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2

- name: 🐍 Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0
- name: 🐍 Install uv and set Python version ${{ matrix.python-version }}
uses: astral-sh/setup-uv@4db96194c378173c656ce18a155ffc14a9fc4355 # v5.2.2
with:
python-version: ${{ matrix.python-version }}

- name: 📜 Setup Poetry
uses: abatilo/actions-poetry@3765cf608f2d4a72178a9fc5b918668e542b89b1 # v4.0.0

- name: 🏗️ Build source and wheel distributions
run: |
poetry install --with=build
poetry build
poetry run twine check --strict dist/*

- name: 🚀 Publish to PyPi
uses: pypa/gh-action-pypi-publish@76f52bc884231f62b9a034ebfe128415bbaabdfc # v1.12.4
with:
attestations: true
uv pip install -r pyproject.toml --extra build
uv build
uv run twine check --strict dist/*

- name: 🚀 Publish to Test-PyPi
uses: pypa/gh-action-pypi-publish@76f52bc884231f62b9a034ebfe128415bbaabdfc # v1.12.4
13 changes: 5 additions & 8 deletions .github/workflows/test-doc.yml
Original file line number Diff line number Diff line change
@@ -23,18 +23,15 @@ jobs:
with:
fetch-depth: 0

- name: 🐍 Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0
- name: 🐍 Install uv and set Python ${{ matrix.python-version }}
uses: astral-sh/setup-uv@4db96194c378173c656ce18a155ffc14a9fc4355 # v5.2.2
with:
python-version: ${{ matrix.python-version }}

- name: 📜 Setup Poetry
uses: abatilo/actions-poetry@3765cf608f2d4a72178a9fc5b918668e542b89b1 # v4.0.0

- name: 🏗️ Install dependencies
run: |
poetry install --with=docs
uv pip install -r pyproject.toml --extra docs


- name: 🧪 Test Docs Build
run: |
poetry run mkdocs build --verbose
run: uv run mkdocs build --verbose
33 changes: 33 additions & 0 deletions .github/workflows/uv-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: 🔧 Pytest/Test Workflow

on:
pull_request:
branches: [main, develop]

jobs:
run-tests:
name: Import Test and Pytest Run
timeout-minutes: 10
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"]
runs-on: ${{ matrix.os }}
steps:
- name: 📥 Checkout the repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2

- name: 🐍 Install uv and set Python version ${{ matrix.python-version }}
uses: astral-sh/setup-uv@4db96194c378173c656ce18a155ffc14a9fc4355 # v5.2.2
with:
python-version: ${{ matrix.python-version }}

- name: 🚀 Install Packages
run: uv pip install -r pyproject.toml --extra dev --extra docs --extra metrics

- name: 🧪 Run the Import test
run: uv run python -c "import supervision; from supervision import assets; from supervision import metrics; print(supervision.__version__)"

- name: 🧪 Run the Test
run: uv run pytest
23 changes: 6 additions & 17 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -155,31 +155,20 @@ Before starting your work on the project, set up your development environment:
source .venv/bin/activate
```

3. Install Poetry:
3. Install `uv`:

Using pip:

```bash
pip install -U pip setuptools
pip install poetry
```

Or using pipx (recommended for global installation):

```bash
pipx install poetry
```
Follow the instructions on the [uv installation page](https://docs.astral.sh/uv/getting-started/installation/).

4. Install project dependencies:

```bash
poetry install
uv pip install -r pyproject.toml --extra dev --extra docs --extra metrics
```

5. Run pytest to verify the setup:

```bash
poetry run pytest
uv run pytest
```

## 🎨 Code Style and Quality
@@ -192,7 +181,7 @@ Furthermore, we have integrated a pre-commit GitHub Action into our workflow. Th

To run the pre-commit tool, follow these steps:

1. Install pre-commit by running the following command: `poetry install --with dev`. It will not only install pre-commit but also install all the deps and dev-deps of project
1. Install pre-commit by running the following command: `uv pip install -r pyproject.toml --extra dev`. It will not only install pre-commit but also install all the deps and dev-deps of project

2. Once pre-commit is installed, navigate to the project's root directory.

@@ -214,7 +203,7 @@ So far, **there is no type checking with mypy**. See [issue](https://github.com/

The `supervision` documentation is stored in a folder called `docs`. The project documentation is built using `mkdocs`.

To run the documentation, install the project requirements with `poetry install --with dev`. Then, run `mkdocs serve` to start the documentation server.
To run the documentation, install the project requirements with `uv pip install -r pyproject.toml --extra dev --extra docs`. Then, run `mkdocs serve` to start the documentation server.

You can learn more about mkdocs on the [mkdocs website](https://www.mkdocs.org/).

9 changes: 5 additions & 4 deletions docs/index.md
Original file line number Diff line number Diff line change
@@ -113,18 +113,19 @@ You can install `supervision` in a
pip install -e "."
```

=== "poetry"
=== "uv"
```bash
# clone repository and navigate to root directory
git clone --depth 1 -b develop https://github.com/roboflow/supervision.git
cd supervision

# setup python environment and activate it
poetry env use python3.10
poetry shell
uv venv
source .venv/bin/activate

# installation
poetry install
uv pip install -r pyproject.toml -e . --all-extras

```

## 🚀 Quickstart
Loading