Skip to content
Open
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
29 changes: 0 additions & 29 deletions .circleci/config.yml

This file was deleted.

41 changes: 41 additions & 0 deletions .github/workflows/python-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python

name: Python lint

on:
push:
branches: [ "*" ]
pull_request:
branches: [ "*" ]

jobs:
lint_and_test:

runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
# PYTHON_VER
python-version: ["3.10", "3.11", "3.13", "3.14"]

steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install black pytest
python -m pip install ".[dev]"
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Lint
run: |
# stop the build if there are Python syntax errors or undefined names
black --quiet --diff --config pyproject.toml --check pywebpush
bandit --quiet -c pyproject.toml pywebpush
- name: Test with pytest
run: |
pytest pywebpush
101 changes: 101 additions & 0 deletions .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python

name: Python package

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

jobs:
lint_and_test:

runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
# PYTHON_VER
python-version: ["3.10", "3.11", "3.13", "3.14"]

steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install black pytest
python -m pip install ".[dev]"
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Lint
run: |
# stop the build if there are Python syntax errors or undefined names
black --quiet --diff --config pyproject.toml --check pywebpush
bandit --quiet -c pyproject.toml pywebpush
- name: Test with pytest
run: |
pytest pywebpush

release-build:
runs-on: ubuntu-latest
needs: lint_and_test

steps:
- uses: actions/checkout@v4

- uses: actions/setup-python@v5
with:
python-version: "3.x"

- name: Build release distributions
run: |
# NOTE: put your own distribution build steps here.
python -m pip install --upgrade pip
python -m pip install build
python -m build

- name: Upload distributions
uses: actions/upload-artifact@v4
with:
name: release-dists
path: dist/

pypi-publish:
# Remember, matching strings need to be in single quotes.
if: ${{ github.event_name == 'push' && ( github.ref_name == 'main' || startsWith(github.ref, 'refs/tags/') ) }}
runs-on: ubuntu-latest
needs:
- release-build
permissions:
# IMPORTANT: this permission is mandatory for trusted publishing
id-token: write

# Dedicated environments with protections for publishing are strongly recommended.
# For more information, see: https://docs.github.com/en/actions/deployment/targeting-different-environments/using-environments-for-deployment#deployment-protection-rules
environment:
name: pypi
# OPTIONAL: uncomment and update to include your PyPI project URL in the deployment status:
url: https://pypi.org/p/pywebpush
#
# ALTERNATIVE: if your GitHub Release name is the PyPI project version string
# ALTERNATIVE: exactly, uncomment the following line instead:
# url: https://pypi.org/project/YOURPROJECT/${{ github.event.release.name }}

steps:
- name: Retrieve release distributions
uses: actions/download-artifact@v4
with:
name: release-dists
path: dist/
- name: validate build
run: |
ls -aFl dist/
- name: Publish release distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
packages-dir: dist/
verbose: true
7 changes: 6 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ downloads/
eggs/
.eggs/
include/
ignore/
local/
lib/
lib64/
Expand All @@ -26,6 +27,7 @@ wheels/
share/python-wheels/
*.egg-info/
.installed.cfg
.installed
*.egg
MANIFEST

Expand Down Expand Up @@ -53,6 +55,8 @@ coverage.xml
.hypothesis/
.pytest_cache/
cover/
ltest/
.circleci/

# Translations
*.mo
Expand Down Expand Up @@ -125,6 +129,7 @@ celerybeat.pid
# Environments
.env
.venv
.envrc
env/
venv/
ENV/
Expand Down Expand Up @@ -162,4 +167,4 @@ cython_debug/
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/

.vscode/
.vscode/
2 changes: 2 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@ include *.txt
include setup.*
include LICENSE
recursive-include pywebpush *.py
global-exclude */__pycache__/*
global-exclude *.pyc
27 changes: 27 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Simple Makefile to help with things like formatting
# checks and installs

.PHONY: build
build: .installed

.PHONY: install
install: .installed
.installed:
pip install ".[dev]"
touch .installed

.PHONY: test
test: .installed
pytest

lint: .installed
isort --sp pyproject.toml -c pywebpush
black --quiet --config pyproject.toml --check --target-version py314 pywebpush
bandit --quiet -r -c pyproject.toml pywebpush

format: .installed
isort --sp pyproject.toml pywebpush
black --quiet --config pyproject.toml --target-version py314 pywebpush
bandit --quiet -r -c pyproject.toml pywebpush


42 changes: 38 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,10 @@ build-backend = "setuptools.build_meta"

[project]
name = "pywebpush"
version = "2.3.0"
version = "2.4.0"
# PYTHON_VER
requires-python = ">= 3.10"
license = { text = "MPL-2.0" }
license = "MPL-2.0"
authors = [{ name = "JR Conlin", email = "src+webpusher@jrconlin.com" }]
description = "WebPush publication library"
readme = "README.md"
Expand All @@ -22,13 +23,20 @@ classifiers = [
"Programming Language :: Python",
"Programming Language :: Python :: 3",
]
dynamic = ["dependencies"]
dependencies = [
"aiohttp",
"cryptography>=47.0.0",
"http-ece>=1.1.0",
"requests>=2.21.0",
"py-vapid>=1.7.0",
]


[project.urls]
Homepage = "https://github.com/web-push-libs/pywebpush"

[project.optional-dependencies]
dev = ["black", "mock", "pytest"]
dev = ["isort", "bandit", "black", "mock", "pytest"]

# create the `pywebpush` helper using `python -m pip install --editable .`
[project.scripts]
Expand All @@ -39,3 +47,29 @@ dependencies = { file = "requirements.txt" }

[tool.setuptools.packages.find]
include = ["pywebpush*"]

[tool.isort]
profile = "black"
skip_gitignore = true

[tool.bandit]
# skips asserts
# B101: https://bandit.readthedocs.io/en/latest/plugins/b101_assert_used.html#
# skip false detect of hardcoded sql
# B608:https://bandit.readthedocs.io/en/latest/plugins/B608_hardcoded_sql_expressions.html#
skips = ["B101", "B608"]

[tool.mypy]
disable_error_code = "attr-defined"
disallow_untyped_calls = false
follow_imports = "normal"
ignore_missing_imports = true
pretty = true
show_error_codes = true
strict_optional = true
warn_no_return = true
warn_redundant_casts = true
warn_return_any = true
warn_unused_ignores = true
warn_unreachable = true
check_untyped_defs = true
Loading
Loading