Skip to content

Commit

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

This file was deleted.

7 changes: 2 additions & 5 deletions .flake8
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
[flake8]
ignore = E203, E266, E501, W503
max-line-length = 80
max-complexity = 18
select = B,C,E,F,W,T4,B9
exclude = docs/conf.py,.tox
max-line-length = 79
extend-ignore = E203, E501
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
11 changes: 11 additions & 0 deletions .readthedocs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
version: 2
python:
# Keep version in sync with tox.ini (docs and gh-actions).
version: 3.7

install:
- method: pip
path: .
extra_requirements:
- docs
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
19 changes: 2 additions & 17 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -44,27 +44,12 @@ Usage
>>> import jwt
>>> encoded = jwt.encode({'some': 'payload'}, 'secret', algorithm='HS256')
'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzb21lIjoicGF5bG9hZCJ9.4twFt5NiznN84AWoo1d7KO1T_yoc0Z6XOpOVswacPZg'
>>> print(encoded)
eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzb21lIjoicGF5bG9hZCJ9.Joh1R2dYzkRvDkqv3sygm5YyK8Gi4ShZqbhK2gxcs2U
>>> jwt.decode(encoded, 'secret', algorithms=['HS256'])
{'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

0 comments on commit 4a1e3a3

Please sign in to comment.