Skip to content

Commit

Permalink
Redo CI (#128)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
hynek committed Aug 19, 2022
1 parent 42282cd commit 1133f3c
Show file tree
Hide file tree
Showing 16 changed files with 172 additions and 330 deletions.
23 changes: 13 additions & 10 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
- Don’t break backwards compatibility.
- Don’t break backwards-compatibility.


## Local Development Environment
Expand All @@ -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.
It’s out of scope for this document to list all the ways to manage virtual environments in Python, but if you don’t 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
Expand All @@ -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]'
```

Expand All @@ -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
Expand Down Expand Up @@ -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.
```
Expand Down
59 changes: 29 additions & 30 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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
40 changes: 26 additions & 14 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -43,15 +52,14 @@ jobs:
path: .coverage.*
if-no-files-found: ignore


coverage:
name: Combine & check coverage.
runs-on: ubuntu-latest
needs: tests

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}}
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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]
Expand Down
10 changes: 4 additions & 6 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -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/
14 changes: 11 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
3 changes: 1 addition & 2 deletions AUTHORS.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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>`_.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -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
Expand Down
15 changes: 10 additions & 5 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -47,18 +47,23 @@
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
----------------------------

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-

0 comments on commit 1133f3c

Please sign in to comment.