-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Update for modern python (#158)
* feat: Update for modern python This updates things to use more modern python practices. This includes: * Adding a pyproject.toml file * Add type hints **BREAKING CHANGE** `Webpusher.encode` will now return a `NoData` exception if no data is present to encode. Chances are you probably won't be impacted by this change since most push messages contain data, but one never knows. This alters the prior behavior where it would return `None`. Includes fixes from #152 by https://github.com/TobeTek (Thanks!)
- Loading branch information
Showing
13 changed files
with
695 additions
and
317 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# SOP Python circleci file | ||
|
||
version: 2.1 | ||
|
||
orbs: | ||
python: circleci/[email protected] | ||
|
||
jobs: | ||
build_and_test: | ||
executor: python/default | ||
steps: | ||
- checkout | ||
- python/install-packages: | ||
pkg-manager: pip | ||
- run: | ||
name: Build | ||
command: pip3 install -r test-requirements.txt | ||
- run: | ||
name: Run tests | ||
command: python -m pytest pywebpush | ||
- persist_to_workspace: | ||
root: ~/project | ||
paths: | ||
- . | ||
|
||
workflows: | ||
build_and_test: | ||
jobs: | ||
- build_and_test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
## Description | ||
|
||
*_NOTE_*: All commits MUST be signed! See https://docs.github.com/en/github/authenticating-to-github/signing-commits | ||
|
||
_Describe these changes._ | ||
|
||
## Testing | ||
|
||
_How should reviewers test?_ | ||
|
||
## Issue(s) | ||
|
||
Closes _#IssueNumber_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
[console_scripts] | ||
pywebpush = "pywebpush.__main__:main" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
[build-system] | ||
# This uses the semi-built-in "setuptools" which is currently the | ||
# python pariah, but there are a lot of behaviors that still carry. | ||
# This will draw a lot of information from `setup.py` and `setup.cfg` | ||
# For more info see https://packaging.python.org/en/latest/ | ||
# (although, be fore-warned, it gets fairly wonky and obsessed with | ||
# details that you may not care about.) | ||
requires = ["setuptools", "wheel"] | ||
build-backend = "setuptools.build_meta" | ||
|
||
[project] | ||
# `dependencies` are taken from `setup.py` and include the contents of the | ||
# `requirements.txt` file | ||
name = "pywebpush" | ||
authors = [{ name = "JR Conlin", email = "[email protected]" }] | ||
description = "WebPush publication library" | ||
readme = "README.md" | ||
# Use the LICENSE file for our license, since "MPL2" isn't included in the | ||
# canonical list | ||
license = { file = "LICENSE" } | ||
keywords = ["webpush", "vapid", "notification"] | ||
classifiers = [ | ||
"Topic :: Internet :: WWW/HTTP", | ||
"Programming Language :: Python :: Implementation :: PyPy", | ||
"Programming Language :: Python", | ||
"Programming Language :: Python :: 3", | ||
] | ||
# use the following fields defined in the setup.py file | ||
# (When the guides talk about something being "dynamic", they | ||
# want you to add the field here. | ||
dynamic = ["version", "entry-points"] | ||
|
||
[project.urls] | ||
Homepage = "https://github.com/web-push-libs/pywebpush" | ||
|
||
[project.optional-dependencies] | ||
dev = ["black", "mock", "pytest"] | ||
|
||
# create the `pywebpush` helper using `python -m pip install --editable .` | ||
[project.scripts] | ||
pywebpush = "pywebpush.__main__:main" |
Oops, something went wrong.