Skip to content

refactor: replace poetry with uv #123

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
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
53 changes: 29 additions & 24 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,71 +2,76 @@ name: CI

on:
pull_request:
branches: [main]
branches: [ main ]
push:
branches: [main]
branches: [ main ]

jobs:
build:
name: Build
runs-on: ubuntu-24.04
env:
PYTHON_VERSION: 3.9
UV_VERSION: 0.7.9

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Setup Python
uses: actions/setup-python@v5
- name: Install uv
uses: astral-sh/setup-uv@v5
with:
python-version: "3.11"
enable-cache: true
version: ${{ env.UV_VERSION }}

- name: Install Poetry
uses: snok/install-poetry@v1
- name: "Set up Python"
uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}

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

- name: Lint
run: poetry run black --check .
run: uv run black --check .

- name: Build
run: poetry build
run: uv build

# the `coverage xml -i` command is needed to re-write the
# coverage report with relative paths
- name: Test
run: |
poetry run pytest --cov src --cov-report xml tests
poetry run coverage xml -i
run: uv run pytest

test:
name: Test
runs-on: ubuntu-24.04
strategy:
fail-fast: false
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
poetry-version: ["1.8.2"]
python-version: [ "3.8", "3.9", "3.10", "3.11", "3.12", "3.13" ]
env:
UV_PYTHON: ${{ matrix.python-version }}

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Install uv
uses: astral-sh/setup-uv@v5
with:
enable-cache: true
version: ${{ env.UV_VERSION }}

- name: Setup python
uses: actions/setup-python@v5
with:
python-version: "${{ matrix.python-version }}"

- name: Install Poetry
uses: snok/install-poetry@v1
with:
version: "${{ matrix.poetry-version }}"

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

- name: Build
run: poetry build
run: uv build

- name: Test
run: poetry run tox
run: uv run pytest
27 changes: 12 additions & 15 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@ name: Publish

on:
release:
types: [published]
types: [ published ]

jobs:
deploy:
name: Deploy to package index
runs-on: ubuntu-24.04
env:
PYTHON_VERSION: 3.9
REPOSITORY_USERNAME: ${{ secrets.PYPI_USERNAME }}
REPOSITORY_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
UV_VERSION: 0.7.9
UV_PUBLISH_TOKEN: ${{ secrets.PYPI_PASSWORD }}
REPOSITORY_URL: ${{ secrets.PYPI_PUBLISH_URL }}
ANACONDA_TOKEN: ${{ secrets.ANACONDA_TOKEN }}
CONDA_ENV_NAME: conda-env
Expand All @@ -20,6 +20,11 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v4

- name: Install uv
uses: astral-sh/setup-uv@v5
with:
version: ${{ env.UV_VERSION }}

- name: Setup Python
uses: actions/setup-python@v5
with:
Expand All @@ -32,21 +37,13 @@ jobs:
activate-environment: ${{ env.CONDA_ENV_NAME }}
python-version: ${{ env.PYTHON_VERSION }}

- name: Install Poetry
uses: snok/install-poetry@v1

- name: Configure Poetry
run: |
poetry config repositories.publish $REPOSITORY_URL
poetry config http-basic.publish $REPOSITORY_USERNAME $REPOSITORY_PASSWORD

- name: Build
run: |
poetry build
uv build

- name: Publish
run: |
poetry publish -r publish
uv publish

- name: Publish to Anaconda
shell: bash -el {0}
Expand All @@ -64,7 +61,7 @@ jobs:
while [ $count -lt $max_retries ]; do
# Create meta.yaml recipe for the package pulled from PyPi
grayskull pypi fds.sdk.utils==${version}

if [ -f ./fds.sdk.utils/meta.yaml ]; then
echo "Version ${version} of fds.sdk.utils is available on PyPI."

Expand All @@ -85,7 +82,7 @@ jobs:
conda config --set anaconda_upload no
package_file=$(conda build fds.sdk.utils --output)
conda build -c conda-forge fds.sdk.utils

anaconda -t $ANACONDA_TOKEN upload -u factset -l main ${package_file}
break
else
Expand Down
Loading