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

Replace poetry with uv #931

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
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
22 changes: 7 additions & 15 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ jobs:
env:
REPO: ${{ github.event.pull_request.head.repo.full_name }}
BRANCH: ${{ github.event.pull_request.head.ref }}
SKIP_POETRY_SHELL: 1

steps:
- name: Checkout code
Expand All @@ -38,29 +37,22 @@ jobs:
if: matrix.os == 'macos-latest'
run: sh install/install_openadapt.sh

- name: Install poetry
uses: snok/install-poetry@v1
with:
version: 1.5.1
virtualenvs-create: true
virtualenvs-in-project: true
- name: Install uv
run: pip install uv

- name: Cache deps
id: cache-deps
uses: actions/cache@v2
with:
path: .venv
key: pydeps-${{ hashFiles('**/poetry.lock') }}
key: pydeps-${{ hashFiles('**/pyproject.toml') }}

- run: poetry install --no-interaction --no-root
- name: Create virtual environment
if: steps.cache-deps.outputs.cache-hit != 'true'

- name: Activate virtualenv
run: source .venv/bin/activate
if: steps.cache-deps.outputs.cache-hit == 'true'
run: uv venv

- name: Check formatting with Black
run: poetry run black --preview --check . --exclude '/(alembic|\.cache|\.venv|venv|contrib|__pycache__)/'
run: uv run black --preview --check . --exclude '/(alembic|\.cache|\.uv|venv|contrib|__pycache__)/'

- name: Run Flake8
run: poetry run flake8 --exclude=alembic,.venv,venv,contrib,.cache,.git
run: uv run flake8 --exclude=alembic,.venv,venv,contrib,.cache,.git
30 changes: 12 additions & 18 deletions .github/workflows/release-and-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,13 @@ jobs:
python-version: '3.10'
- name: Install dependencies
run: |
pip install poetry
poetry install
pip install uv
brew install nvm
poetry run postinstall
uv run python scripts/postinstall
brew install python-tk@3.10
- name: Build MacOS executable
run: |
poetry run python -m openadapt.build
uv run python -m openadapt.build
cd dist
zip -r ../OpenAdapt.app.zip OpenAdapt.app
mv OpenAdapt.dmg ..
Expand Down Expand Up @@ -82,16 +81,15 @@ jobs:
node-version: 21
- name: Install dependencies
run: |
pip install poetry
poetry install
pip install uv
cd openadapt/app/dashboard
npm install
cd ../../../
pip install wheel
poetry run postinstall
uv pip install wheel
uv run python scripts/postinstall.py
- name: Build Windows executable
run: |
poetry run python -m openadapt.build
uv run python -m openadapt.build
cd dist
7z a -tzip ../OpenAdapt.zip OpenAdapt
move OpenAdapt_Installer.exe ..
Expand Down Expand Up @@ -190,8 +188,7 @@ jobs:
- name: Install the latest version of the project
run: |
git pull
pip install poetry
poetry install
pip install uv
- name: Download macOS executable
uses: actions/download-artifact@v4
with:
Expand Down Expand Up @@ -238,12 +235,9 @@ jobs:
uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Install uv
run: pip install uv
- name: Publish to PyPI
env:
PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}
run: |
pip install poetry
poetry install
poetry config pypi-token.pypi $PYPI_TOKEN
poetry build
poetry publish --no-interaction --skip-existing
UV_PUBLISH_TOKEN: ${{ secrets.PYPI_TOKEN }}
run: uv publish
12 changes: 6 additions & 6 deletions install/install_openadapt.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -358,14 +358,14 @@ Install-VCRedist
# OpenAdapt Setup
RunAndCheck "git clone -q https://github.com/MLDSAI/OpenAdapt.git" "clone git repo"
Set-Location .\OpenAdapt
RunAndCheck "pip install poetry" "Run ``pip install poetry``"
RunAndCheck "poetry install" "Run ``poetry install``"
RunAndCheck "poetry run postinstall" "Install other dependencies" -SkipCleanup:$true
RunAndCheck "pip install uv" "Run ``pip install uv``"
RunAndCheck "uv venv" "Run ``uv venv``"
RunAndCheck "uv run python scripts/postinstall.py" "Install other dependencies" -SkipCleanup:$true
RunAndCheck "cd openadapt"
RunAndCheck "poetry run alembic upgrade head" "Run ``alembic upgrade head``" -SkipCleanup:$true
RunAndCheck "uv run alembic upgrade head" "Run ``alembic upgrade head``" -SkipCleanup:$true
RunAndCheck "cd .."
RunAndCheck "poetry run pytest" "Run ``Pytest``" -SkipCleanup:$true
RunAndCheck "uv run pytest" "Run ``Pytest``" -SkipCleanup:$true
Write-Host "OpenAdapt installed Successfully!" -ForegroundColor Green
Start-Process powershell -Verb RunAs -ArgumentList "-NoExit", "-Command", "Set-Location -Path '$pwd'; poetry shell"
Start-Process powershell -Verb RunAs -ArgumentList "-NoExit", "-Command", "Set-Location -Path '$pwd';"

################################ SCRIPT ###################################
13 changes: 5 additions & 8 deletions install/install_openadapt.sh
Original file line number Diff line number Diff line change
Expand Up @@ -155,14 +155,11 @@ RunAndCheck "git clone $REPO_URL" "Clone git repo"
cd OpenAdapt
RunAndCheck "git checkout $BRANCH" "Checkout branch $BRANCH"

RunAndCheck "pip3.10 install poetry" "Install Poetry"
RunAndCheck "poetry install" "Install Python dependencies"
RunAndCheck "poetry run postinstall" "Install other dependencies"
RunAndCheck "pip3.10 install uv " "Install uv"
RunAndCheck "uv venv" "Create virtual environment"
RunAndCheck "uv run python scripts/postinstall.py" "Install other dependencies"
RunAndCheck "cd openadapt"
RunAndCheck "poetry run alembic upgrade head" "Update database"
RunAndCheck "uv run alembic upgrade head" "Update database"
RunAndCheck "cd .."
RunAndCheck "poetry run pytest" "Run tests"
if [ -z "$SKIP_POETRY_SHELL" ]; then
RunAndCheck "poetry shell" "Activate virtual environment"
fi
RunAndCheck "uv run pytest" "Run tests"
echo OpenAdapt installed successfully!
Loading
Loading