Skip to content
Merged
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
50 changes: 50 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -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
63 changes: 63 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -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
16 changes: 16 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
26 changes: 19 additions & 7 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [
Expand All @@ -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"
Expand All @@ -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
Expand All @@ -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
"""
3 changes: 2 additions & 1 deletion test/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down