From 1eeb1d0561dd9aa3f5af7d315535c0924d8fe702 Mon Sep 17 00:00:00 2001 From: Jelle Zijlstra Date: Wed, 21 Aug 2024 13:18:10 -0700 Subject: [PATCH 1/5] Update CI setup --- .github/workflows/lint.yml | 53 +++++++++++++++++++++++++++++ .github/workflows/publish.yml | 63 +++++++++++++++++++++++++++++++++++ README.md | 14 ++++++++ pyproject.toml | 22 ++++++++---- 4 files changed, 145 insertions(+), 7 deletions(-) create mode 100644 .github/workflows/lint.yml create mode 100644 .github/workflows/publish.yml diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 0000000..3c48f5e --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,53 @@ +name: Lint + +on: [push, pull_request] + +concurrency: + group: check-${{ github.ref }} + cancel-in-progress: true + +jobs: + mypy: + name: mypy + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Setup python + uses: actions/setup-python@v4 + with: + python-version: "3.10" + - name: Install dependencies + run: python -m pip install -e .[dev] + - name: Run mypy + run: mypy . + + test: + name: test with ${{ matrix.py }} on ${{ matrix.os }} + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + py: + - "3.12" + - "3.11" + - "3.10" + - "3.9" + - "3.8" + os: + - ubuntu-latest + - macos-latest + - windows-latest + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + - name: Setup python for test ${{ matrix.py }} + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.py }} + - name: Install tox + run: python -m pip install tox-gh>=1.2 + - name: Setup test suite + run: tox -vv --notest + - name: Run test suite + run: tox --skip-pkg-install \ No newline at end of file diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..fa7561b --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,63 @@ +# Based on +# https://packaging.python.org/guides/publishing-package-distribution-releases-using-github-actions-ci-cd-workflows/ + +name: Publish Python distribution to PyPI + +on: + release: + types: [published] + push: + branches: [main] + pull_request: + +permissions: + contents: read + +concurrency: + group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} + cancel-in-progress: true + +jobs: + build: + name: Build distribution + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: "3.x" + - name: Install pypa/build + run: | + python -m pip install --upgrade build + python -m pip list + - name: Build a binary wheel and a source tarball + run: python -m build + - name: Store the distribution packages + uses: actions/upload-artifact@v4 + with: + name: python-package-distributions + path: dist/ + + publish-to-pypi: + name: >- + Publish Python distribution to PyPI + if: github.event_name == 'release' # only publish to PyPI on releases + needs: + - build + runs-on: ubuntu-latest + environment: + name: release + url: https://pypi.org/p/compat-fork-apns2 + permissions: + id-token: write # IMPORTANT: mandatory for trusted publishing + + steps: + - name: Download all the dists + uses: actions/download-artifact@v4 + with: + name: python-package-distributions + path: dist/ + - name: Publish distribution to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 diff --git a/README.md b/README.md index 87b48e1..dc92b6a 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,17 @@ +# compat-fork-apns2 + +This is a fork of the [apns2](https://github.com/compat-fork/PyAPNs2) +library to provide compatibility with newer versions of Python and of the +pyjwt library. It is +maintained by the [compat-fork](https://github.com/compat-fork) project. + +compat-fork changelog: +* Version 0.8.0 + * Declare support for Python 3.10; drop support for Python 3.7 + * Support pyjwt 2 + +Original README follows: + # PyAPNs2 [![PyPI version](https://img.shields.io/pypi/v/apns2.svg)](https://pypi.python.org/pypi/apns2) diff --git a/pyproject.toml b/pyproject.toml index ac5145a..9dcbb68 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,8 +4,9 @@ build-backend = "poetry.core.masonry.api" [tool] [tool.poetry] -name = "apns2" -version = "0.7.1" +name = "compat-fork-apns2" +packages = [{ include = "apns2" }] +version = "0.8.0" description = "A python library for interacting with the Apple Push Notification Service via HTTP/2 protocol" readme = 'README.md' authors = [ @@ -16,14 +17,14 @@ license = "MIT" classifiers = [ "Development Status :: 4 - Beta", "License :: OSI Approved :: MIT License", - "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", "Topic :: Software Development :: Libraries" ] [tool.poetry.dependencies] -python = ">=3.7" +python = ">=3.8" cryptography = ">=1.7.2" hyper = ">=0.7" pyjwt = ">=2.0.0" @@ -31,9 +32,10 @@ pyjwt = ">=2.0.0" [tool.poetry.dev-dependencies] pytest = "*" freezegun = "*" +mypy = "1.11.1" [tool.mypy] -python_version = "3.7" +python_version = "3.8" strict = true [tool.pylint.design] @@ -49,12 +51,18 @@ disable = "missing-docstring, too-few-public-methods, locally-disabled, invalid- [tool.tox] legacy_tox_ini = """ [tox] -envlist = py37, py38, py39 +envlist = py38, py39, py310 isolated_build = True [testenv] -whitelist_externals = poetry +allowlist_externals = poetry commands = poetry install -v poetry run pytest {posargs} + +[gh] +python = + 3.10 = py310 + 3.9 = py39 + 3.8 = py38 """ From 14bf06ed5625d3458173a3213f33f668cf836f4a Mon Sep 17 00:00:00 2001 From: Jelle Zijlstra Date: Wed, 21 Aug 2024 13:21:07 -0700 Subject: [PATCH 2/5] Fix mypy check --- .github/workflows/lint.yml | 6 ++---- pyproject.toml | 1 - 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 3c48f5e..3b3ef68 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -17,7 +17,7 @@ jobs: with: python-version: "3.10" - name: Install dependencies - run: python -m pip install -e .[dev] + run: python -m pip install -e . pytest freezegun mypy==1.11.1 - name: Run mypy run: mypy . @@ -28,8 +28,6 @@ jobs: fail-fast: false matrix: py: - - "3.12" - - "3.11" - "3.10" - "3.9" - "3.8" @@ -46,7 +44,7 @@ jobs: with: python-version: ${{ matrix.py }} - name: Install tox - run: python -m pip install tox-gh>=1.2 + run: python -m pip install tox-gh>=1.2 poetry - name: Setup test suite run: tox -vv --notest - name: Run test suite diff --git a/pyproject.toml b/pyproject.toml index 9dcbb68..284d361 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -32,7 +32,6 @@ pyjwt = ">=2.0.0" [tool.poetry.dev-dependencies] pytest = "*" freezegun = "*" -mypy = "1.11.1" [tool.mypy] python_version = "3.8" From e57f12bcb84c753f830a57966ae5a92b8164abe6 Mon Sep 17 00:00:00 2001 From: Jelle Zijlstra Date: Wed, 21 Aug 2024 13:27:19 -0700 Subject: [PATCH 3/5] fix mypy --- pyproject.toml | 2 ++ test/test_client.py | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 284d361..394a2cf 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -36,6 +36,8 @@ freezegun = "*" [tool.mypy] python_version = "3.8" strict = true +disallow_untyped_calls = true +disallow_untyped_defs = false [tool.pylint.design] max-args = 10 diff --git a/test/test_client.py b/test/test_client.py index 92f9467..ba66dd2 100644 --- a/test/test_client.py +++ b/test/test_client.py @@ -3,7 +3,8 @@ import pytest -from apns2.client import APNsClient, Credentials, CONCURRENT_STREAMS_SAFETY_MAXIMUM, Notification +from apns2.client import APNsClient, CONCURRENT_STREAMS_SAFETY_MAXIMUM, Notification +from apns2.credentials import Credentials from apns2.errors import ConnectionFailed from apns2.payload import Payload From a56f3e2b4a15cb301a695733fb7bd5ce5a2e3ffa Mon Sep 17 00:00:00 2001 From: Jelle Zijlstra Date: Wed, 21 Aug 2024 13:28:51 -0700 Subject: [PATCH 4/5] No 3.10 either --- .github/workflows/lint.yml | 1 - pyproject.toml | 7 +++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 3b3ef68..acc3611 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -28,7 +28,6 @@ jobs: fail-fast: false matrix: py: - - "3.10" - "3.9" - "3.8" os: diff --git a/pyproject.toml b/pyproject.toml index 394a2cf..f9e1464 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -19,7 +19,6 @@ classifiers = [ "License :: OSI Approved :: MIT License", "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", - "Programming Language :: Python :: 3.10", "Topic :: Software Development :: Libraries" ] @@ -52,7 +51,7 @@ disable = "missing-docstring, too-few-public-methods, locally-disabled, invalid- [tool.tox] legacy_tox_ini = """ [tox] -envlist = py38, py39, py310 +envlist = py38, py39 isolated_build = True [testenv] @@ -63,6 +62,10 @@ commands = [gh] python = + 3.14 = py314 + 3.13 = py313 + 3.12 = py312 + 3.11 = py311 3.10 = py310 3.9 = py39 3.8 = py38 From 2f0076eae3ce71baa47381f5c16803229f0ad62c Mon Sep 17 00:00:00 2001 From: Jelle Zijlstra Date: Wed, 21 Aug 2024 13:31:32 -0700 Subject: [PATCH 5/5] Update README --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index dc92b6a..3413c30 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,9 @@ maintained by the [compat-fork](https://github.com/compat-fork) project. compat-fork changelog: * Version 0.8.0 - * Declare support for Python 3.10; drop support for Python 3.7 + * No significant code changes from upstream `master` + * No longer declare support for Python 3.7 (it probably still works + but we're not in the business of supporting unsupported Python versions) * Support pyjwt 2 Original README follows: