diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml index 31cb9dd..eaf543e 100644 --- a/.github/workflows/deploy.yaml +++ b/.github/workflows/deploy.yaml @@ -1,5 +1,7 @@ name: Build package and push to PyPi + on: + workflow_dispatch: push: tags: - "v*.*.*" @@ -8,10 +10,58 @@ jobs: build: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - - name: Build and publish to pypi - uses: JRubics/poetry-publish@v1.13 + - name: Check out repository + uses: actions/checkout@v4 + with: + fetch-depth: 0 # Includes getting tags + + - name: Cache $HOME/.local # Significantly speeds up Poetry Install + uses: actions/cache@v3 + with: + path: ~/.local + key: dotlocal-${{ runner.os }}-${{ hashFiles('.github/workflows/deploy.yml') }} + + - name: Set up python 3.12 + uses: actions/setup-python@v4 + with: + python-version: "3.12" + + - name: Install poetry + uses: snok/install-poetry@v1 + with: + virtualenvs-create: true + virtualenvs-in-project: true + installer-parallel: true + + - name: Add Poetry Plugins + run: | + poetry self add poetry-dynamic-versioning[plugin] + + - name: Load cached venv + id: cached-poetry-dependencies + uses: actions/cache@v3 + with: + path: .venv + key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }} + + - name: Install dependencies + if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true' + run: poetry install --no-interaction --no-root --without=dev + + - name: Install project + run: poetry install --no-interaction --without=dev + + - name: Build package + run: poetry build + + - name: Publish package + if: github.event_name != 'workflow_dispatch' + run: | + poetry config pypi-token.pypi ${{ secrets.PYPI_TOKEN }} + poetry publish + + - uses: actions/upload-artifact@v3 + if: always() with: - pypi_token: ${{ secrets.PYPI_TOKEN }} - ignore_dev_requirements: "yes" - plugins: "poetry-dynamic-versioning[plugin]" + name: dist + path: dist/ diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index eaecbfb..d4b4d0b 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -24,7 +24,7 @@ jobs: strategy: matrix: os: [ubuntu-latest, macos-latest, windows-latest] - python-version: ["3.8", "3.9", "3.10", "3.11"] + python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] env: OS: ${{ matrix.os }} PYTHON: ${{ matrix.python-version }} diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 2b93c32..7fb1fe0 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,18 +1,18 @@ repos: - repo: https://github.com/charliermarsh/ruff-pre-commit - rev: "v0.0.277" + rev: "v0.1.1" hooks: - id: ruff args: [--fix, --exit-non-zero-on-fix] - repo: https://github.com/codespell-project/codespell - rev: v2.2.5 + rev: v2.2.6 hooks: - id: codespell args: ["-L", "ClassE,classe"] - repo: https://github.com/psf/black - rev: 23.7.0 + rev: 23.10.1 hooks: - id: black args: @@ -24,12 +24,12 @@ repos: exclude: ^typesafety/ - repo: https://github.com/asottile/blacken-docs - rev: 1.15.0 + rev: 1.16.0 hooks: - id: blacken-docs - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.4.0 + rev: v4.5.0 hooks: - id: check-added-large-files - id: check-ast @@ -55,7 +55,7 @@ repos: exclude: \.(html|svg)$ - repo: https://github.com/RobertCraigie/pyright-python - rev: v1.1.316 + rev: v1.1.332 hooks: - id: pyright exclude: ^typesafety/ diff --git a/tests/test_abc.py b/tests/test_abc.py index 4633a06..a0fa2ef 100644 --- a/tests/test_abc.py +++ b/tests/test_abc.py @@ -31,7 +31,7 @@ class Pikachu(Pokemon): def test_abc_multiple_inheritence_first(): - """The programmer doesn't know inheritting from ABC is superfluous.""" + """The programmer doesn't know inheriting from ABC is superfluous.""" class Pokemon(ABC, Registry): @abstractmethod @@ -58,7 +58,7 @@ class Pikachu(Pokemon): def test_abc_multiple_inheritence_last(): - """The programmer doesn't know inheritting from ABC is superfluous.""" + """The programmer doesn't know inheriting from ABC is superfluous.""" class Pokemon(Registry, ABC): @abstractmethod diff --git a/tests/test_meta_extension.py b/tests/test_meta_extension.py index c8e6e25..833fdd7 100644 --- a/tests/test_meta_extension.py +++ b/tests/test_meta_extension.py @@ -20,7 +20,7 @@ def test_extended_registry(): foo = Foo() bar = Bar() - assert foo.extended_attribute == "Foo" - assert bar.extended_attribute == "Bar" + assert foo.extended_attribute == "Foo" # pyright: ignore[reportGeneralTypeIssues] + assert bar.extended_attribute == "Bar" # pyright: ignore[reportGeneralTypeIssues] assert list(Foo) == ["bar"]