diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..279834b --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,47 @@ +name: Publish +on: + push: + tags: + - '**' + +jobs: + pypi-publish: + name: Build package and upload it to PyPI + runs-on: ubuntu-latest + # Specifying a GitHub environment is optional, but strongly encouraged + environment: pypi + permissions: + # IMPORTANT: this permission is mandatory for trusted publishing + id-token: write + + steps: + - name: Checkout current branch + uses: actions/checkout@v4 + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: '3.11' + + - name: Install and configure Poetry + uses: snok/install-poetry@v1 + with: + virtualenvs-create: true + virtualenvs-in-project: true + installer-parallel: true + + - name: Set up cache + uses: actions/cache@v3 + id: cache + with: + path: ${{ env.pythonLocation }} + key: ${{ runner.os }}-python-${{ env.pythonLocation }}-${{ hashFiles('pyproject.toml') }}-publish + + - name: Install dependencies + run: poetry install + + - name: Build package + run: poetry build + + - name: Publish package distributions to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 diff --git a/unparallel/unparallel.py b/unparallel/unparallel.py index 083d201..7afb1bf 100644 --- a/unparallel/unparallel.py +++ b/unparallel/unparallel.py @@ -1,5 +1,4 @@ import asyncio -import contextlib import logging from dataclasses import dataclass from typing import Any, Callable, Dict, List, Optional, Tuple, Union