diff --git a/.coveragerc b/.coveragerc deleted file mode 100644 index b888ac72..00000000 --- a/.coveragerc +++ /dev/null @@ -1,8 +0,0 @@ -[run] -branch = True -source = . - -[report] -exclude_lines = - pragma: no cover - raise NotImplementedError diff --git a/.travis.yml b/.travis.yml index 12fd07a6..4da6eb14 100644 --- a/.travis.yml +++ b/.travis.yml @@ -13,12 +13,9 @@ addons: install: - pip install codecov - pip install tox tox-travis - - pip install isort black script: - codecov --version - tox - - isort --check src tests - - black -l 100 --check src tests after_success: - codecov notifications: diff --git a/doc/conf.py b/doc/conf.py index 1cc6d858..28cd9204 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -31,36 +31,38 @@ # Add any Sphinx extension module names here, as strings. They can be # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom # ones. -extensions = ['sphinx.ext.autodoc', - 'sphinx.ext.intersphinx', - 'sphinx.ext.coverage', - 'sphinx.ext.viewcode'] +extensions = [ + "sphinx.ext.autodoc", + "sphinx.ext.intersphinx", + "sphinx.ext.coverage", + "sphinx.ext.viewcode", +] # Add any paths that contain templates here, relative to this directory. -templates_path = ['_templates'] +templates_path = ["_templates"] # The suffix(es) of source filenames. # You can specify multiple suffix as a list of string: # # source_suffix = ['.rst', '.md'] -source_suffix = '.rst' +source_suffix = ".rst" # The master toctree document. -master_doc = 'index' +master_doc = "index" # General information about the project. -project = 'CryptoJWT' -copyright = '2018, Roland Hedberg' -author = 'Roland Hedberg' +project = "CryptoJWT" +copyright = "2018, Roland Hedberg" +author = "Roland Hedberg" # The version info for the project you're documenting, acts as replacement for # |version| and |release|, also used in various other places throughout the # built documents. # # The short X.Y version. -version = '0.4' +version = "0.4" # The full version, including alpha/beta/rc tags. -release = '0.4' +release = "0.4" # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. @@ -72,10 +74,10 @@ # List of patterns, relative to source directory, that match files and # directories to ignore when looking for source files. # This patterns also effect to html_static_path and html_extra_path -exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store'] +exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"] # The name of the Pygments (syntax highlighting) style to use. -pygments_style = 'sphinx' +pygments_style = "sphinx" # If true, `todo` and `todoList` produce output, else they produce nothing. todo_include_todos = False @@ -86,7 +88,7 @@ # The theme to use for HTML and HTML Help pages. See the documentation for # a list of builtin themes. # -html_theme = 'default' +html_theme = "default" # Theme options are theme-specific and customize the look and feel of a theme # further. For a list of options available for each theme, see the @@ -97,7 +99,7 @@ # Add any paths that contain custom static files (such as style sheets) here, # relative to this directory. They are copied after the builtin static files, # so a file named "default.css" will overwrite the builtin "default.css". -html_static_path = ['_static'] +html_static_path = ["_static"] # Custom sidebar templates, must be a dictionary that maps document names # to template names. @@ -105,9 +107,9 @@ # This is required for the alabaster theme # refs: http://alabaster.readthedocs.io/en/latest/installation.html#sidebars html_sidebars = { - '**': [ - 'relations.html', # needs 'show_related': True theme option to display - 'searchbox.html', + "**": [ + "relations.html", # needs 'show_related': True theme option to display + "searchbox.html", ] } @@ -115,7 +117,7 @@ # -- Options for HTMLHelp output ------------------------------------------ # Output file base name for HTML help builder. -htmlhelp_basename = 'CryptoJWTdoc' +htmlhelp_basename = "CryptoJWTdoc" # -- Options for LaTeX output --------------------------------------------- @@ -124,15 +126,12 @@ # The paper size ('letterpaper' or 'a4paper'). # # 'papersize': 'letterpaper', - # The font size ('10pt', '11pt' or '12pt'). # # 'pointsize': '10pt', - # Additional stuff for the LaTeX preamble. # # 'preamble': '', - # Latex figure (float) alignment # # 'figure_align': 'htbp', @@ -142,8 +141,7 @@ # (source start file, target name, title, # author, documentclass [howto, manual, or own class]). latex_documents = [ - (master_doc, 'CryptoJWT.tex', 'CryptoJWT Documentation', - 'Roland Hedberg', 'manual'), + (master_doc, "CryptoJWT.tex", "CryptoJWT Documentation", "Roland Hedberg", "manual"), ] @@ -151,10 +149,7 @@ # One entry per manual page. List of tuples # (source start file, name, description, authors, manual section). -man_pages = [ - (master_doc, 'cryptojwt', 'CryptoJWT Documentation', - [author], 1) -] +man_pages = [(master_doc, "cryptojwt", "CryptoJWT Documentation", [author], 1)] # -- Options for Texinfo output ------------------------------------------- @@ -163,13 +158,17 @@ # (source start file, target name, title, author, # dir menu entry, description, category) texinfo_documents = [ - (master_doc, 'CryptoJWT', 'CryptoJWT Documentation', - author, 'CryptoJWT', 'One line description of project.', - 'Miscellaneous'), + ( + master_doc, + "CryptoJWT", + "CryptoJWT Documentation", + author, + "CryptoJWT", + "One line description of project.", + "Miscellaneous", + ), ] - - # Example configuration for intersphinx: refer to the Python standard library. -intersphinx_mapping = {'https://docs.python.org/': None} +intersphinx_mapping = {"https://docs.python.org/": None} diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 00000000..d639eb5e --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,21 @@ +# PEP 518: https://www.python.org/dev/peps/pep-0518/ + +[tool.black] +line-length = 100 + +[tool.isort] +force_single_line = true +known_first_party = "cryptojwt" +include_trailing_comma = true +force_grid_wrap = 0 +use_parentheses = true +line_length = 100 + +[tool.coverage.run] +branch = true + +[tool.coverage.report] +exclude_lines = [ + "pragma: no cover", + "raise NotImplementedError", +] diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index 6a04d9e3..00000000 --- a/setup.cfg +++ /dev/null @@ -1,7 +0,0 @@ -[isort] -force_single_line = 1 -known_first_party = cryptojwt -include_trailing_comma = True -force_grid_wrap = 0 -use_parentheses = True -line_length = 100 diff --git a/setup.py b/setup.py index fe415e37..d62ad040 100644 --- a/setup.py +++ b/setup.py @@ -20,13 +20,12 @@ from setuptools import setup -__author__ = 'Roland Hedberg' +__author__ = "Roland Hedberg" -with open('src/cryptojwt/__init__.py', 'r') as fd: - version = re.search(r'^__version__\s*=\s*[\'"]([^\'"]*)[\'"]', - fd.read(), re.MULTILINE).group(1) +with open("src/cryptojwt/__init__.py", "r") as fd: + version = re.search(r'^__version__\s*=\s*[\'"]([^\'"]*)[\'"]', fd.read(), re.MULTILINE).group(1) -tests_requires = ['responses', 'pytest', 'isort>=5.0.2', 'black'] +tests_requires = ["responses", "pytest", "isort>=5.0.2", "black"] setup( name="cryptojwt", @@ -35,8 +34,14 @@ author="Roland Hedberg", author_email="roland@catalogix.se", license="Apache 2.0", - packages=["cryptojwt", "cryptojwt/jwe", "cryptojwt/jwk", "cryptojwt/jws", "cryptojwt/tools", - "cryptojwt/serialize"], + packages=[ + "cryptojwt", + "cryptojwt/jwe", + "cryptojwt/jwk", + "cryptojwt/jws", + "cryptojwt/tools", + "cryptojwt/serialize", + ], package_dir={"": "src"}, classifiers=[ "Development Status :: 4 - Beta", @@ -45,22 +50,22 @@ "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", - "Programming Language :: Python :: 3.8" + "Programming Language :: Python :: 3.8", ], install_requires=["cryptography", "requests"], - tests_require=['pytest'], + tests_require=["pytest"], zip_safe=False, extras_require={ - 'testing': tests_requires, - 'docs': ['Sphinx', 'sphinx-autobuild', 'alabaster'], - 'quality': ['isort>=5.0.2', 'black'], + "testing": tests_requires, + "docs": ["Sphinx", "sphinx-autobuild", "alabaster"], + "quality": ["isort>=5.0.2", "black"], }, - scripts=glob.glob('script/*.py'), + scripts=glob.glob("script/*.py"), entry_points={ "console_scripts": [ "jwkgen = cryptojwt.tools.keygen:main", "jwkconv = cryptojwt.tools.keyconv:main", "jwtpeek = cryptojwt.tools.jwtpeek:main", ] - } + }, ) diff --git a/tests/test_04_key_jar.py b/tests/test_04_key_jar.py index 567627bd..5e63e9ce 100755 --- a/tests/test_04_key_jar.py +++ b/tests/test_04_key_jar.py @@ -444,6 +444,7 @@ def test_no_use(self): assert enc_key != [] @pytest.mark.network + @pytest.mark.skip("connect-op.herokuapp.com is broken") def test_provider(self): kj = KeyJar() _url = "https://connect-op.herokuapp.com/jwks.json" diff --git a/tox.ini b/tox.ini index c3b44dff..def7f92e 100644 --- a/tox.ini +++ b/tox.ini @@ -4,13 +4,15 @@ envlist = py{36,37,38},quality [testenv] passenv = CI TRAVIS TRAVIS_* commands = - py.test --cov=cryptojwt tests/ {posargs} + py.test --cov=cryptojwt --isort --black {posargs} codecov extras = testing deps = codecov + pytest-black pytest-cov pytest-httpserver + pytest-isort [pep8] max-line-length=100 @@ -20,10 +22,10 @@ addopts = --color=yes markers = network [testenv:quality] -# Black need python 3.6 -basepython = python3.6 +basepython = python3.8 ignore_errors = True deps = twine extras = quality commands = - isort --recursive --diff --check-only src/ tests/ + isort --check --diff src tests + black --check src tests