diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 0000000..acc3611 --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,50 @@ +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 . pytest freezegun mypy==1.11.1 + - 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.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 poetry + - 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..3413c30 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,19 @@ +# 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 + * 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: + # 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..f9e1464 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,13 @@ 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", "Topic :: Software Development :: Libraries" ] [tool.poetry.dependencies] -python = ">=3.7" +python = ">=3.8" cryptography = ">=1.7.2" hyper = ">=0.7" pyjwt = ">=2.0.0" @@ -33,8 +33,10 @@ pytest = "*" freezegun = "*" [tool.mypy] -python_version = "3.7" +python_version = "3.8" strict = true +disallow_untyped_calls = true +disallow_untyped_defs = false [tool.pylint.design] max-args = 10 @@ -49,12 +51,22 @@ disable = "missing-docstring, too-few-public-methods, locally-disabled, invalid- [tool.tox] legacy_tox_ini = """ [tox] -envlist = py37, py38, py39 +envlist = py38, py39 isolated_build = True [testenv] -whitelist_externals = poetry +allowlist_externals = poetry commands = poetry install -v poetry run pytest {posargs} + +[gh] +python = + 3.14 = py314 + 3.13 = py313 + 3.12 = py312 + 3.11 = py311 + 3.10 = py310 + 3.9 = py39 + 3.8 = py38 """ 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