* Update .gitignore

* Simplify packaging, move mypy config to pyproject.toml

* Reflow Tidelift spiel

* Freshen up contribution guide

* Update CI

* Modernize tox & CI

* 3.11

* Don't pass args to build in CI

* oops

* Add wheel/dist inspection

* Simplify conf.py

* fix

* simplify

* Clarify license

* cleanup

* docs

* add missing _

* parallel output sucks
This commit is contained in:
Hynek Schlawack 2022-08-19 09:15:15 +02:00 committed by GitHub
parent 42282cd88c
commit 1133f3c2ba
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
16 changed files with 177 additions and 335 deletions

View File

@ -22,8 +22,11 @@ Please report any harm to [Hynek Schlawack] in any way you find appropriate.
This is a hard rule; patches with missing tests or documentation can't be merged.
- Make sure your changes pass our [CI].
You won't get any feedback until it's green unless you ask for it.
- For the CI to pass, the coverage must be 100%.
If you have problems to test something, open anyway and ask for advice.
In some situations, we may agree to add an `# pragma: no cover`.
- Once you've addressed review feedback, make sure to bump the pull request with a short note, so we know you're done.
- Dont break backwards compatibility.
- Dont break backwards-compatibility.
## Local Development Environment
@ -35,13 +38,13 @@ We highly recommend to develop using the latest Python release because we try to
First create a [virtual environment](https://virtualenv.pypa.io/) so you don't break your system-wide Python installation.
Its out of scope for this document to list all the ways to manage virtual environments in Python, but if you dont already have a pet way, take some time to look at tools like [*direnv*](https://hynek.me/til/python-project-local-venvs/), [*virtualfish*](https://virtualfish.readthedocs.io/), and [*virtualenvwrapper*](https://virtualenvwrapper.readthedocs.io/).
Next, get an up to date checkout of the *argon2-cffi* repository:
Next, get an up-to-date checkout of the *argon2-cffi* repository:
```console
$ git clone git@github.com:hynek/argon2-cffi.git
```
or if you want to use git via `https`:
or if you prefer to use *Git* via `https`:
```console
$ git clone https://github.com/hynek/argon2-cffi.git
@ -51,7 +54,7 @@ Change into the newly created directory and **after activating your virtual envi
```console
$ cd argon2-cffi
$ python -m pip install --upgrade pip setuptools # PLEASE don't skip this step
$ python -m pip install --upgrade pip wheel # PLEASE don't skip this step
$ python -m pip install -e '.[dev]'
```
@ -70,20 +73,20 @@ $ make html
The built documentation can then be found in `docs/_build/html/`.
To avoid committing code that violates our style guide, we strongly advise you to install [*pre-commit*] [^dev] hooks:
To avoid committing code that violates our style guide, we strongly advise you to install [*pre-commit*] and its hooks:
```console
$ pre-commit install
```
You can also run them anytime (as our tox does) using:
This is not strictly necessary, because our [*tox*] file contains an environment that runs:
```console
$ pre-commit run --all-files
```
[^dev]: *pre-commit* should have been installed into your virtualenv automatically when you ran `pip install -e '.[dev]'` above.
If *pre-commit* is missing, your probably need to run `pip install -e '.[dev]'` again.
and our CI has integration with `pre-commit.ci <https://pre-commit.ci>`_.
But it's way more comfortable to run it locally and *git* catching avoidable errors.
## Code
@ -128,9 +131,9 @@ $ pre-commit run --all-files
## Documentation
- Use [semantic newlines] in [*Markdown*] files (files ending in `.md`):
- Use [semantic newlines] in [*reStructuredText*] and [*Markdown*](https://docs.github.com/en/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax) files (files ending in `.rst` and `.md`):
```markdown
```rst
This is a sentence.
This is another sentence.
```

View File

@ -13,12 +13,12 @@ name: "CodeQL"
on:
push:
branches: [ "main" ]
branches: ["main"]
pull_request:
# The branches below must be a subset of the branches above
branches: [ "main" ]
branches: ["main"]
schedule:
- cron: '24 5 * * 4'
- cron: "24 5 * * 4"
jobs:
analyze:
@ -32,41 +32,40 @@ jobs:
strategy:
fail-fast: false
matrix:
language: [ 'python' ]
language: ["python"]
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Checkout repository
uses: actions/checkout@v3
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
# queries: security-extended,security-and-quality
# Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
# queries: security-extended,security-and-quality
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v2
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v2
# Command-line programs to run using the OS shell.
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
# Command-line programs to run using the OS shell.
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
# If the Autobuild fails above, remove it and uncomment the following three lines.
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.
# If the Autobuild fails above, remove it and uncomment the following three lines.
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.
# - run: |
# echo "Run, Build Application using script"
# ./location_of_script_within_repo/buildscript.sh
# - run: |
# echo "Run, Build Application using script"
# ./location_of_script_within_repo/buildscript.sh
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2

View File

@ -9,22 +9,31 @@ on:
workflow_dispatch:
env:
FORCE_COLOR: "1" # Make tools pretty.
FORCE_COLOR: "1" # Make tools pretty.
TOX_TESTENV_PASSENV: FORCE_COLOR
PYTHON_LATEST: "3.10"
jobs:
tests:
name: tox on ${{ matrix.python-version }}
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.6", "3.7", "3.8", "3.9", "3.10", "pypy-3.7", "pypy-3.8"]
python-version:
[
"3.6",
"3.7",
"3.8",
"3.9",
"3.10",
"3.11.0-beta - 3.11",
"pypy-3.7",
"pypy-3.8",
]
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v3
- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
@ -43,7 +52,6 @@ jobs:
path: .coverage.*
if-no-files-found: ignore
coverage:
name: Combine & check coverage.
runs-on: ubuntu-latest
@ -51,7 +59,7 @@ jobs:
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v3
- uses: actions/setup-python@v4
with:
# Use latest Python, so it understands all syntax.
python-version: ${{env.PYTHON_LATEST}}
@ -75,14 +83,13 @@ jobs:
path: htmlcov
if: ${{ failure() }}
system-package:
name: Install & test with system package of Argon2.
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v3
- uses: actions/setup-python@v4
with:
python-version: ${{env.PYTHON_LATEST}}
- name: Install dependencies
@ -95,24 +102,29 @@ jobs:
- run: python -m tox -e system-argon2
package:
name: Build & verify package
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v3
- uses: actions/setup-python@v4
with:
python-version: ${{env.PYTHON_LATEST}}
- run: python -m pip install build twine check-wheel-contents
- run: python -m build .
- run: python -m pip install build twine check-wheel-contents wheel
- run: python -m build
- run: ls -l dist
- run: check-wheel-contents dist/*.whl
- name: Check long_description
run: python -m twine check dist/*
- name: Inspect sdist & wheel contents.
run: |
cd dist
mkdir out
python -m wheel unpack --dest out *.whl
tar xf *.tar.gz -C out
tree -a out
install-dev:
name: Verify dev env
@ -123,7 +135,7 @@ jobs:
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v3
- uses: actions/setup-python@v4
with:
python-version: ${{env.PYTHON_LATEST}}
- run: python -m pip install -e .[dev]

10
.gitignore vendored
View File

@ -1,15 +1,13 @@
*.dylib
*.egg-info
*.pyc
*.so
.DS_Store
.cache
.coverage
.coverage.*
.eggs
.direnv
.hypothesis
.pytest_cache/
.tox
.vscode
__pycache__
_build
dist
pip-wheel-metadata/
docs/_build/

View File

@ -2,12 +2,14 @@
ci:
autoupdate_schedule: monthly
default_language_version:
python: python3.10
repos:
- repo: https://github.com/psf/black
rev: 22.6.0
hooks:
- id: black
language_version: python3.10
- repo: https://github.com/PyCQA/isort
rev: 5.10.1
@ -21,11 +23,17 @@ repos:
- id: pyupgrade
args: [--py36-plus]
- repo: https://github.com/asottile/yesqa
rev: v1.4.0
hooks:
- id: yesqa
additional_dependencies: [flake8-bugbear]
- repo: https://github.com/PyCQA/flake8
rev: 5.0.2
rev: 5.0.4
hooks:
- id: flake8
language_version: python3.10
additional_dependencies: [flake8-bugbear]
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.3.0

View File

@ -3,7 +3,6 @@ Credits & License
*argon2-cffi* is maintained by `Hynek Schlawack <https://hynek.me/>`_ and released under the `MIT license <https://github.com/hynek/argon2-cffi/blob/main/LICENSE>`_.
The development is kindly supported by `Variomedia AG <https://www.variomedia.de/>`_.
Please consider `supporting me <https://hynek.me/say-thanks/>`_ too!
The development is kindly supported by `Variomedia AG <https://www.variomedia.de/>`_, *argon2-cffi* `Tidelift subscribers <https://tidelift.com/subscription/pkg/pypi-argon2-cffi?utm_source=pypi-argon2-cffi&utm_medium=referral&utm_campaign=enterprise&utm_term=repo>`_, and all my amazing `GitHub Sponsors <https://github.com/sponsors/hynek>`_.
A full list of contributors can be found in GitHub's `overview <https://github.com/hynek/argon2-cffi/graphs/contributors>`_.

View File

@ -26,6 +26,11 @@ What explicitly *may* change over time are the default hashing parameters and th
## [Unreleased](https://github.com/hynek/argon2-cffi/compare/21.3.0...HEAD)
### Added
- Official support for Python 3.11.
## [21.3.0](https://github.com/hynek/argon2-cffi/compare/21.2.0...21.3.0) - 2021-12-11
### Fixed

View File

@ -1,6 +1,6 @@
The MIT License (MIT)
Copyright (c) 2015 Hynek Schlawack
Copyright (c) 2015 Hynek Schlawack and the argon2-cffi contributors
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal

View File

@ -47,11 +47,14 @@
Project Information
===================
*argon2-cffi* is available from `PyPI <https://pypi.org/project/argon2-cffi/>`_, the documentation lives at `Read the Docs <https://argon2-cffi.readthedocs.io/>`_, the code on `GitHub <https://github.com/hynek/argon2-cffi>`_.
The low-level Argon2 CFFI bindings are maintained in the separate project `argon2-cffi-bindings <https://github.com/hynek/argon2-cffi-bindings>`_.
- **License**: `MIT <https://choosealicense.com/licenses/mit/>`_
- **PyPI**: https://pypi.org/project/argon2-cffi/
- **Source Code**: https://github.com/hynek/argon2-cffi
- **Documentation**: https://argon2-cffi.readthedocs.io/
- **Changelog**: https://github.com/hynek/argon2-cffi/blob/main/CHANGELOG.md
- **Supported Python Versions**: 3.6 and later
It targets Python 3.6 and newer, and PyPy3.
The last version that works with Python 2.7 is 20.1.0, and the last version that works with Python 3.5 is 21.1.0.
The low-level Argon2 CFFI bindings are maintained in the separate project `argon2-cffi-bindings <https://github.com/hynek/argon2-cffi-bindings>`_.
*argon2-cffi* for Enterprise
@ -59,6 +62,8 @@ The last version that works with Python 2.7 is 20.1.0, and the last version that
Available as part of the Tidelift Subscription.
The maintainers of *argon2-cffi* and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source packages you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact packages you use. `Learn more. <https://tidelift.com/subscription/pkg/pypi-argon2-cffi?utm_source=undefined&utm_medium=referral&utm_campaign=enterprise&utm_term=repo>`_
The maintainers of *argon2-cffi* and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open-source packages you use to build your applications.
Save time, reduce risk, and improve code health, while paying the maintainers of the exact packages you use.
`Learn more. <https://tidelift.com/subscription/pkg/pypi-argon2-cffi?utm_source=undefined&utm_medium=referral&utm_campaign=enterprise&utm_term=repo>`_
.. -end-meta-

View File

@ -3,16 +3,6 @@
from importlib import metadata
# 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.
# sys.path.insert(0, os.path.abspath('.'))
# -- General configuration ------------------------------------------------
# If your documentation needs a minimal Sphinx version, state it here.
# needs_sphinx = '1.0'
# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
@ -53,7 +43,7 @@ version = release.rsplit(".", 1)[0]
rst_epilog = f"""
.. |changelog| replace:: Whats new?
.. _changelog: https://github.com/hynek/argon2-cffi/blob/{release}/CHANGELOG.md
""" # noqa
"""
# In dev mode, always point to main branch. There's no tags yet.
if release.endswith(".dev0"):
@ -64,125 +54,22 @@ autodoc_typehints = "description"
autodoc_typehints_description_target = "documented"
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
# language = None
# There are two options for replacing |today|: either, you set today to some
# non-false value, then it is used:
# today = ''
# Else, today_fmt is used as the format for a strftime call.
# today_fmt = '%B %d, %Y'
# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
exclude_patterns = ["_build"]
# The reST default role (used for this markup: `text`) to use for all
# documents.
# default_role = None
default_role = "any"
# If true, '()' will be appended to :func: etc. cross-reference text.
# add_function_parentheses = True
# If true, the current module name will be prepended to all description
# unit titles (such as .. function::).
# add_module_names = True
# If true, sectionauthor and moduleauthor directives will be shown in the
# output. They are ignored by default.
# show_authors = False
# A list of ignored prefixes for module index sorting.
# modindex_common_prefix = []
# If true, keep warnings as "system message" paragraphs in the built documents.
# keep_warnings = False
add_function_parentheses = True
# -- Options for HTML output ----------------------------------------------
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
html_theme = "furo"
# 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
# documentation.
# html_theme_options = {}
# Add any paths that contain custom themes here, relative to this directory.
# html_theme_path = []
# The name for this set of Sphinx documents. If None, it defaults to
# "<project> v<release> documentation".
# html_title = None
# A shorter title for the navigation bar. Default is the same as html_title.
# html_short_title = None
# The name of an image file (relative to this directory) to place at the top
# of the sidebar.
# html_logo = None
# The name of an image file (within the static path) to use as favicon of the
# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
# pixels large.
# html_favicon = None
# 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']
# Add any extra paths that contain custom files (such as robots.txt or
# .htaccess) here, relative to this directory. These files are copied
# directly to the root of the documentation.
# html_extra_path = []
# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
# using the given strftime format.
# html_last_updated_fmt = '%b %d, %Y'
# If true, SmartyPants will be used to convert quotes and dashes to
# typographically correct entities.
# html_use_smartypants = True
# Custom sidebar templates, maps document names to template names.
# html_sidebars = {}
# Additional templates that should be rendered to pages, maps page names to
# template names.
# html_additional_pages = {}
# If false, no module index is generated.
# html_domain_indices = True
# If false, no index is generated.
# html_use_index = True
# If true, the index is split into individual pages for each letter.
# html_split_index = False
# If true, links to the reST sources are added to the pages.
# html_show_sourcelink = True
# If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
# html_show_sphinx = True
# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
# html_show_copyright = True
# If true, an OpenSearch description file will be output, and all pages will
# contain a <link> tag referring to it. The value of this option must be the
# base URL from which the finished HTML is served.
# html_use_opensearch = ''
# This is the file name suffix for HTML files (e.g. ".xhtml").
# html_file_suffix = None
# Output file base name for HTML help builder.
htmlhelp_basename = "argon2-cffidoc"
@ -211,27 +98,6 @@ latex_documents = [
)
]
# The name of an image file (relative to this directory) to place at the top of
# the title page.
# latex_logo = None
# For "manual" documents, if this is true, then toplevel headings are parts,
# not chapters.
# latex_use_parts = False
# If true, show page references after internal links.
# latex_show_pagerefs = False
# If true, show URL addresses after external links.
# latex_show_urls = False
# Documents to append as an appendix to all manuals.
# latex_appendices = []
# If false, no module index is generated.
# latex_domain_indices = True
# -- Options for manual page output ---------------------------------------
# One entry per manual page. List of tuples
@ -246,9 +112,6 @@ man_pages = [
)
]
# If true, show URL addresses after external links.
# man_show_urls = False
# -- Options for Texinfo output -------------------------------------------
@ -262,23 +125,11 @@ texinfo_documents = [
"argon2-cffi Documentation",
"Hynek Schlawack",
"argon2-cffi",
"One line description of project.",
"Argon2 for Python",
"Miscellaneous",
)
]
# Documents to append as an appendix to all manuals.
# texinfo_appendices = []
# If false, no module index is generated.
# texinfo_domain_indices = True
# How to display URL addresses: 'footnote', 'no', or 'inline'.
# texinfo_show_urls = 'footnote'
# If true, do not generate a @detailmenu in the "Top" node's menu.
# texinfo_no_detailmenu = False
# Example configuration for intersphinx: refer to the Python standard library.
intersphinx_mapping = {"https://docs.python.org/3": None}

View File

@ -22,17 +22,12 @@ User's Guide
parameters
cli
faq
license
.. include:: ../README.rst
:start-after: -begin-meta-
:end-before: -end-meta-
.. toctree::
:maxdepth: 1
license
Indices and tables
==================

View File

@ -11,7 +11,7 @@ As of September 2021, we have the official Internet standard `RFC 9106`_ to help
It comes with two recommendations in `section 4 <https://www.rfc-editor.org/rfc/rfc9106.html#section-4>`_, that (as of *argon2-cffi* 21.2.0) you can load directly from the :mod:`argon2.profiles` module: :data:`argon2.profiles.RFC_9106_HIGH_MEMORY` (called "FIRST RECOMMENDED") and :data:`argon2.profiles.RFC_9106_LOW_MEMORY` ("SECOND RECOMMENDED") into :meth:`argon2.PasswordHasher.from_parameters()`.
Please use the :doc:`cli` interface together with its `\-\-profile` argument to see if they work for you.
Please use the :doc:`cli` interface together with its ``--profile`` argument to see if they work for you.
----

View File

@ -1,28 +0,0 @@
[mypy]
# show error messages from unrelated files
follow_imports = normal
# suppress errors about unsatisfied imports
ignore_missing_imports = True
# be strict
check_untyped_defs = True
disallow_any_generics = True
disallow_incomplete_defs = True
disallow_untyped_calls = True
disallow_untyped_defs = True
no_implicit_optional = True
strict_optional = True
warn_no_return = True
warn_redundant_casts = True
warn_unreachable = True
warn_unused_ignores = True
# sometimes redefinition is just fine
allow_redefinition = True
[mypy-tests.*]
ignore_errors = True
[mypy-conftest]
ignore_errors = True

View File

@ -4,16 +4,12 @@
requires = ["flit_core >=3.4,<4"]
build-backend = "flit_core.buildapi"
[project]
name = "argon2-cffi"
authors = [{name = "Hynek Schlawack", email = "hs@ox.cx"}]
authors = [{ name = "Hynek Schlawack", email = "hs@ox.cx" }]
dynamic = ["version", "description"]
requires-python = ">=3.6"
dependencies = [
"argon2-cffi-bindings",
"dataclasses; python_version < '3.7'",
"typing-extensions; python_version < '3.8'", # c.f. _typing.py module
]
license = { file = "LICENSE" }
readme = "README.rst"
keywords = ["password", "hash", "hashing", "security"]
@ -32,6 +28,7 @@ classifiers = [
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: Implementation :: CPython",
"Programming Language :: Python :: Implementation :: PyPy",
"Programming Language :: Python",
@ -39,6 +36,16 @@ classifiers = [
"Topic :: Security",
"Topic :: Software Development :: Libraries :: Python Modules",
]
dependencies = [
"argon2-cffi-bindings",
"dataclasses; python_version < '3.7'",
"typing-extensions; python_version < '3.8'", # c.f. _typing.py module
]
[project.optional-dependencies]
tests = ["hypothesis", "pytest"]
docs = ["sphinx", "sphinx-notfound-page", "furo"]
dev = ["argon2-cffi[tests,docs]", "mypy"]
[project.urls]
Changelog = "https://github.com/hynek/argon2-cffi/blob/main/CHANGELOG.md"
@ -48,60 +55,29 @@ Funding = "https://github.com/sponsors/hynek"
Tidelift = "https://tidelift.com/subscription/pkg/pypi-argon2-cffi?utm_source=pypi-argon2-cffi&utm_medium=pypi"
Ko-fi = "https://ko-fi.com/the_hynek"
[tool.flit.sdist]
include = [
"*.ini",
"*.rst",
".github",
".pre-commit-config.yaml",
".readthedocs.yml",
"docs",
"tests",
]
exclude = [
"docs/_build",
"tests/__pycache__",
"tests/.mypy_cache",
]
[project.optional-dependencies]
tests = ["coverage[toml]>=5.0.2", "hypothesis", "pytest"]
docs = ["sphinx", "sphinx-notfound-page", "furo"]
# Combine tests and docs and a few more dev tools to a dev environment.
# Refresh using `tox -e cog`
dev = [
"pre-commit",
"cogapp",
"tomli",
# [[[cog
# import pathlib, tomli
# cfg = tomli.loads(pathlib.Path("pyproject.toml").read_text())
# opt = cfg["project"]["optional-dependencies"]
# for dep in opt["tests"] + opt["docs"]:
# print(f'"{dep}",')
# ]]]
"coverage[toml]>=5.0.2",
"hypothesis",
"pytest",
"sphinx",
"sphinx-notfound-page",
"furo",
# [[[end]]]
]
[tool.flit.module]
name = "argon2"
[tool.flit.sdist]
include = [
".github",
".pre-commit-config.yaml",
".readthedocs.yml",
"*.ini",
"*.md",
"*.rst",
"docs",
"tests",
]
exclude = ["docs/_build", "tests/__pycache__", "tests/.mypy_cache"]
[tool.pytest.ini_options]
addopts = "-ra --strict-markers --capture=no"
addopts = ["-ra", "--strict-markers", "--strict-config"]
xfail_strict = true
testpaths = "tests"
filterwarnings = [
"once::Warning",
]
filterwarnings = ["once::Warning"]
[tool.coverage.run]
@ -134,6 +110,38 @@ exclude_lines = [
omit = []
[tool.mypy]
# show error messages from unrelated files
follow_imports = "normal"
# suppress errors about unsatisfied imports
ignore_missing_imports = true
# be strict
check_untyped_defs = true
disallow_any_generics = true
disallow_incomplete_defs = true
disallow_untyped_calls = true
disallow_untyped_defs = true
no_implicit_optional = true
strict_optional = true
warn_no_return = true
warn_redundant_casts = true
warn_unreachable = true
warn_unused_ignores = true
# sometimes redefinition is just fine
allow_redefinition = true
[[tool.mypy.overrides]]
module = "tests.*"
ignore_errors = true
[[tool.mypy.overrides]]
module = "conftest.*"
ignore_errors = true
[tool.black]
line-length = 79

View File

@ -208,7 +208,7 @@ class PasswordHasher:
hash = _ensure_bytes(hash, "ascii")
try:
hash_type = self._header_to_type[hash[:9]]
except (IndexError, KeyError, LookupError):
except LookupError:
raise InvalidHash()
return verify_secret(

33
tox.ini
View File

@ -16,14 +16,15 @@ ignore =
python =
3.6: py36
3.7: py37
3.8: py38
3.8: py38, docs
3.9: py39, mypy
3.10: py310, cogCheck, docs, bindings-main
3.10: py310, bindings-main
3.11: py311
pypy-3: pypy3
[tox]
envlist = pre-commit,mypy,cogCheck,cog,py36,py37,py38,py39,py310,pypy3,system-argon2,bindings-main,docs,pypi-description,coverage-report
envlist = pre-commit,mypy,py36,py37,py38,py39,py310,py311,pypy3,system-argon2,bindings-main,docs,pypi-description,coverage-report
isolated_build = true
@ -40,7 +41,6 @@ commands =
[testenv:pre-commit]
description = Run all pre-commit hooks.
basepython = python3.10
skip_install = true
deps = pre-commit
passenv = HOMEPATH # needed on Windows
@ -55,26 +55,10 @@ deps = mypy
commands = mypy src typing_examples.py
[testenv:cog]
description = "Update pyproject.toml's metadata"
skip_install = true
deps =
cogapp>=3.3.0
tomli
commands = python -m cogapp -rP pyproject.toml
[testenv:cogCheck]
description = "Ensure pyproject.toml is up to date"
basepython = python3.10
skip_install = true
deps = {[testenv:cog]deps}
commands = python -m cogapp --check -P pyproject.toml
[testenv:py37]
description = Run tests and measure coverage.
extras = tests
deps = coverage[toml]
commands =
coverage run -m pytest {posargs}
coverage run -m argon2 -n 1 -t 1 -m 8 -p 1
@ -84,6 +68,7 @@ commands =
[testenv:py310]
description = Run tests and measure coverage.
extras = tests
deps = coverage[toml]
commands =
coverage run -m pytest {posargs}
coverage run -m argon2 -n 1 -t 1 -m 8 -p 1
@ -92,9 +77,11 @@ commands =
[testenv:coverage-report]
description = Report coverage over all test runs.
depends = py310
depends =
py37
py310
basepython = python3.10
deps = coverage[toml]>=5.0.2
deps = coverage[toml]
skip_install = true
commands =
coverage combine