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

UV replacement of Poetry #2346

Merged
merged 2 commits into from
Jan 26, 2025
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
4 changes: 2 additions & 2 deletions .github/workflows/constraints.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
pip==23.2
virtualenv==20.17.1
pip==24.3.1
virtualenv==20.29.1
1 change: 1 addition & 0 deletions .github/workflows/hatch-constraints.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
hatch==1.14.0
8 changes: 3 additions & 5 deletions .github/workflows/integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,11 @@ jobs:
pip install --constraint=.github/workflows/constraints.txt pip
pip --version

- name: Install Poetry
run: |
pipx install --pip-args=--constraint=.github/workflows/poetry-constraints.txt poetry
poetry --version
- name: Install UV
uses: astral-sh/setup-uv@v5

- name: Install dependencies
run: poetry install
run: uv sync --all-extras --frozen

- name: Test integration
run: ./scripts/test_integration.sh
8 changes: 3 additions & 5 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,11 @@ jobs:
pip install --constraint=.github/workflows/constraints.txt pip
pip --version

- name: Install Poetry
run: |
pip install --constraint=.github/workflows/poetry-constraints.txt poetry
poetry --version
- name: Install UV
uses: astral-sh/setup-uv@v5

- name: Install dependencies
run: poetry install
run: uv sync --all-extras --frozen

- name: Lint
run: ./scripts/lint.sh
1 change: 0 additions & 1 deletion .github/workflows/poetry-constraints.txt

This file was deleted.

30 changes: 30 additions & 0 deletions .github/workflows/release-dev.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
---
name: Release Dev

"on":
push:
branches:
- main

jobs:
release:
if: github.repository_owner == 'PyCQA'
name: Release
runs-on: ubuntu-latest
steps:
- name: Check out the repository
uses: actions/checkout@v4
with:
fetch-depth: 2

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.13"

- name: Install UV
uses: astral-sh/setup-uv@v5

- name: Build package
run: |
uv build
36 changes: 13 additions & 23 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ name: Release

"on":
push:
branches:
- main
tags:
- "v[0-9]+.[0-9]+.[0-9]+"

jobs:
release:
Expand All @@ -17,45 +17,35 @@ jobs:
with:
fetch-depth: 2

- name: Set Tag env
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
python-version: "3.13"

- name: Upgrade pip
run: |
pip install --constraint=.github/workflows/constraints.txt pip
pip --version

- name: Install Poetry
- name: Install Hatch
run: |
pip install --constraint=.github/workflows/poetry-constraints.txt poetry
poetry --version
pip install --constraint=.github/workflows/hatch-constraints.txt hatch
hatch --version

- name: Install UV
uses: astral-sh/setup-uv@v5

- name: Check if there is a parent commit
id: check-parent-commit
run: |
echo "::set-output name=sha::$(git rev-parse --verify --quiet HEAD^)"

- name: Detect and tag new version
id: check-version
if: steps.check-parent-commit.outputs.sha
uses: salsify/action-detect-and-tag-new-version@v2
with:
tag-template: "{VERSION}"
version-command: |
bash -o pipefail -c "poetry version | awk '{ print \$2 }'"

- name: Bump version for developmental release
if: "! steps.check-version.outputs.tag"
run: |
poetry version patch &&
version=$(poetry version | awk '{ print $2 }') &&
poetry version $version.dev.$(date +%s)

- name: Build package
run: |
poetry build --ansi
uv build

- name: Publish package on PyPI
if: steps.check-version.outputs.tag
Expand Down
8 changes: 3 additions & 5 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,11 @@ jobs:
pip install --constraint=.github/workflows/constraints.txt pip
pip --version

- name: Install Poetry
run: |
pip install --constraint=.github/workflows/poetry-constraints.txt poetry
poetry --version
- name: Install UV
uses: astral-sh/setup-uv@v5

- name: Install dependencies
run: poetry install
run: uv sync --all-extras --frozen

- name: Test
shell: bash
Expand Down
10 changes: 5 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
ARG VERSION=3
FROM python:$VERSION

# Install pip and poetry
RUN python -m pip install --upgrade pip && python -m pip install poetry
# Install pip and uv
RUN python -m pip install --upgrade pip && python -m pip install uv

# Setup as minimal a stub project as possible, simply to allow caching base dependencies
# between builds.
Expand All @@ -14,13 +14,13 @@ RUN touch /isort/isort/__init__.py
RUN touch /isort/tests/__init__.py
RUN touch /isort/README.md
WORKDIR /isort
COPY pyproject.toml poetry.lock /isort/
RUN poetry install
COPY pyproject.toml uv.lock /isort/
RUN uv sync

# Install latest code for actual project
RUN rm -rf /isort
COPY . /isort
RUN poetry install
RUN uv sync

# Run full test suite
CMD /isort/scripts/test.sh
6 changes: 3 additions & 3 deletions docs/contributing/1.-contributing-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Account Requirements:
Base System Requirements:

- Python3.9+
- poetry
- uv
- bash or a bash compatible shell (should be auto-installed on Linux / Mac)
- WSL users running Ubuntu may need to install Python's venv module even after installing Python.

Expand All @@ -25,8 +25,8 @@ Once you have verified that your system matches the base requirements you can st
2. Clone your fork to your local file system:
`git clone https://github.com/$GITHUB_ACCOUNT/isort.git`
3. `cd isort`
4. `poetry install`
* Optionally, isolate poetry's installation from the rest of your system using the instructions on the poetry site here: https://python-poetry.org/docs/#installation
4. `uv sync --all-extras --frozen`
* Optionally, isolate uv's installation from the rest of your system using the instructions on the uv site here: https://docs.astral.sh/uv/
5. `./scripts/test.sh` should yield Success: no issues found
6. `./scripts/clean.sh` should yield a Safety report checking packages

Expand Down
4 changes: 4 additions & 0 deletions docs/quick_start/1.-install.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ Install `isort` using your preferred Python package manager:

OR

`uv add isort`

OR

`poetry add isort`

OR
Expand Down
174 changes: 0 additions & 174 deletions example_isort_formatting_plugin/poetry.lock

This file was deleted.

Loading
Loading