Skip to content

Use pyproject.toml #59

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Jul 29, 2020
Merged
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
8 changes: 0 additions & 8 deletions .coveragerc

This file was deleted.

3 changes: 0 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
69 changes: 34 additions & 35 deletions doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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
Expand All @@ -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
Expand All @@ -97,25 +99,25 @@
# 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.
#
# 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",
]
}


# -- Options for HTMLHelp output ------------------------------------------

# Output file base name for HTML help builder.
htmlhelp_basename = 'CryptoJWTdoc'
htmlhelp_basename = "CryptoJWTdoc"


# -- Options for LaTeX output ---------------------------------------------
Expand All @@ -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',
Expand All @@ -142,19 +141,15 @@
# (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"),
]


# -- Options for manual page output ---------------------------------------

# 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 -------------------------------------------
Expand All @@ -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}
21 changes: 21 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -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",
]
7 changes: 0 additions & 7 deletions setup.cfg

This file was deleted.

33 changes: 19 additions & 14 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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",
Expand All @@ -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",
]
}
},
)
1 change: 1 addition & 0 deletions tests/test_04_key_jar.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
10 changes: 6 additions & 4 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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