Skip to content

Commit

Permalink
Merge ede0287 into b17c087
Browse files Browse the repository at this point in the history
  • Loading branch information
jpadilla committed Apr 8, 2020
2 parents b17c087 + ede0287 commit f04c795
Show file tree
Hide file tree
Showing 55 changed files with 1,281 additions and 1,240 deletions.
6 changes: 0 additions & 6 deletions .coveragerc

This file was deleted.

6 changes: 0 additions & 6 deletions .flake8

This file was deleted.

127 changes: 87 additions & 40 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,40 +1,87 @@
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions

name: Python package

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

jobs:
build:

runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.5, 3.6, 3.7, 3.8]

steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Lint with flake8
run: |
pip install flake8
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Test with pytest
run: |
pip install pytest
pytest
---
name: CI

on:
push:
branches: ["master"]
pull_request:
branches: ["master"]
# Allow rebuilds via API.
repository_dispatch:
types: rebuild

jobs:
tests:
name: "Python ${{ matrix.python-version }}"
runs-on: "ubuntu-latest"
env:
USING_COVERAGE: '3.8'

strategy:
matrix:
python-version: ["3.5", "3.6", "3.7", "3.8"]

steps:
- uses: "actions/checkout@v2"
- uses: "actions/setup-python@v1"
with:
python-version: "${{ matrix.python-version }}"
- name: "Install dependencies"
run: |
set -xe
python -VV
python -m site
python -m pip install --upgrade pip setuptools wheel
python -m pip install --upgrade coverage[toml] virtualenv tox tox-gh-actions
- name: "Run tox targets for ${{ matrix.python-version }}"
run: "python -m tox"

- name: "Combine coverage"
run: |
set -xe
python -m coverage combine
python -m coverage xml
if: "contains(env.USING_COVERAGE, matrix.python-version)"
- name: "Upload coverage to Codecov"
if: "contains(env.USING_COVERAGE, matrix.python-version)"
uses: "codecov/codecov-action@v1"
with:
fail_ci_if_error: true

package:
name: "Build & verify package"
runs-on: "ubuntu-latest"

steps:
- uses: "actions/checkout@v2"
- uses: "actions/setup-python@v1"
with:
python-version: "3.8"

- name: "Install pep517 and twine"
run: "python -m pip install pep517 twine"
- name: "Build package"
run: "python -m pep517.build --source --binary ."
- name: "List result"
run: "ls -l dist"
- name: "Check long_description"
run: "python -m twine check dist/*"

install-dev:
strategy:
matrix:
os: ["ubuntu-latest", "windows-latest", "macos-latest"]

name: "Verify dev env"
runs-on: "${{ matrix.os }}"

steps:
- uses: "actions/checkout@v2"
- uses: "actions/setup-python@v1"
with:
python-version: "3.8"
- name: "Install in dev mode"
run: "python -m pip install -e .[dev]"
- name: "Import package"
run: "python -c 'import jwt; print(jwt.__version__)'"
69 changes: 10 additions & 59 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,61 +1,12 @@
# Created by https://www.gitignore.io

### Python ###
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]

# C extensions
*.so

# Distribution / packaging
.Python
env/
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
*.egg-info/
.installed.cfg
*.egg

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.coverage
*.egg-info
*.pyc
.cache
nosetests.xml
coverage.xml

# Translations
*.mo
*.pot

# Django stuff:
*.log

# Sphinx documentation
docs/_build/

# PyBuilder
target/

.pytest_cache
.coverage*
.mypy_cache
.pytest_cache
.tox
build
dist
docs/_build/
htmlcov
pip-wheel-metadata
14 changes: 7 additions & 7 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
repos:
- repo: https://github.com/psf/black
rev: 19.3b0
rev: 19.10b0
hooks:
- id: black
language_version: python3.7
language_version: python3.8

- repo: https://gitlab.com/pycqa/flake8
rev: 3.7.8
rev: 3.7.9
hooks:
- id: flake8
language_version: python3.7
language_version: python3.8

- repo: https://github.com/asottile/seed-isort-config
rev: v1.9.3
rev: v1.9.4
hooks:
- id: seed-isort-config

Expand All @@ -21,10 +21,10 @@ repos:
hooks:
- id: isort
additional_dependencies: [toml]
language_version: python3.7
language_version: python3.8

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v2.3.0
rev: v2.4.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
Expand Down
10 changes: 6 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
language: python
matrix:
include:
- python: 3.8
env: TOXENV=lint,typing
- python: 3.5
env: TOXENV=py35-crypto,py35-nocrypto,py35-contrib_crypto
env: TOXENV=py35-crypto,py35-nocrypto
- python: 3.6
env: TOXENV=py36-crypto,py36-nocrypto,py36-contrib_crypto
env: TOXENV=py36-crypto,py36-nocrypto
- python: 3.7
env: TOXENV=lint,typing,py37-crypto,py37-nocrypto,py37-contrib_crypto
env: TOXENV=py37-crypto,py37-nocrypto
- python: 3.8
env: TOXENV=py38-crypto,py38-nocrypto,py38-contrib_crypto
env: TOXENV=py38-crypto,py38-nocrypto
install:
- pip install -U pip
- pip install -U tox coveralls
Expand Down
22 changes: 19 additions & 3 deletions MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,23 @@ include README.rst
include CHANGELOG.md
include LICENSE
include AUTHORS
include *.rst *.toml *.yml *.yaml *.md
graft .github
global-exclude *.pyc

# Tests
include tox.ini
recursive-exclude * __pycache__
recursive-exclude * *.py[co]
graft tests
recursive-include tests *.py
recursive-include tests *.cer
recursive-include tests *.json
recursive-include tests *.pem
recursive-include tests *.pub
recursive-include tests *.priv

# Documentation
include docs/Makefile docs/docutils.conf
recursive-include docs *.py
recursive-include docs *.rst
recursive-include docs *.css
recursive-include docs *.txt
prune docs/_build
15 changes: 0 additions & 15 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -50,21 +50,6 @@ Usage
{'some': 'payload'}
Command line
------------

Usage::

pyjwt [options] INPUT

Decoding examples::

pyjwt --key=secret decode TOKEN
pyjwt decode --no-verify TOKEN

See more options executing ``pyjwt --help``.


Documentation
-------------

Expand Down
1 change: 1 addition & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
# a list of builtin themes.
import sphinx_rtd_theme


# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
Expand Down
14 changes: 0 additions & 14 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -42,20 +42,6 @@ Example Usage
See :doc:`Usage Examples <usage>` for more examples.

Command line
------------

Usage::

pyjwt [options] INPUT

Decoding examples::

pyjwt --key=secret decode TOKEN
pyjwt decode --no-verify TOKEN

See more options executing ``pyjwt --help``.

Index
-----

Expand Down
35 changes: 0 additions & 35 deletions docs/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -23,39 +23,4 @@ The ``pyjwt[crypto]`` format is recommended in requirements files in
projects using ``PyJWT``, as a separate ``cryptography`` requirement line
may later be mistaken for an unused requirement and removed.

.. _legacy-deps:

Legacy Dependencies
-------------------

Some environments, most notably Google App Engine, do not allow the installation
of Python packages that require compilation of C extensions and therefore
cannot install ``cryptography``. If you can install ``cryptography``, you
should disregard this section.

If you are deploying an application to one of these environments, you may
need to use the legacy implementations of the digital signature algorithms:

.. code-block:: console
$ pip install pycrypto ecdsa
Once you have installed ``pycrypto`` and ``ecdcsa``, you can tell PyJWT to use
the legacy implementations with ``jwt.register_algorithm()``. The following
example code shows how to configure PyJWT to use the legacy implementations
for RSA with SHA256 and EC with SHA256 signatures.

.. code-block:: python
import jwt
from jwt.contrib.algorithms.pycrypto import RSAAlgorithm
from jwt.contrib.algorithms.py_ecdsa import ECAlgorithm
jwt.unregister_algorithm('RS256')
jwt.unregister_algorithm('ES256')
jwt.register_algorithm('RS256', RSAAlgorithm(RSAAlgorithm.SHA256))
jwt.register_algorithm('ES256', ECAlgorithm(ECAlgorithm.SHA256))
.. _`cryptography`: https://cryptography.io

0 comments on commit f04c795

Please sign in to comment.