Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
jaraco committed Apr 19, 2024
2 parents 02a0564 + f4529af commit f34982d
Show file tree
Hide file tree
Showing 9 changed files with 112 additions and 71 deletions.
4 changes: 4 additions & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,7 @@ disable_warnings =

[report]
show_missing = True
exclude_also =
# jaraco/skeleton#97
@overload
if TYPE_CHECKING:
80 changes: 39 additions & 41 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,49 +1,40 @@
name: tests

on: [push, pull_request]
on:
merge_group:
push:
branches-ignore:
# temporary GH branches relating to merge queues (jaraco/skeleton#93)
- gh-readonly-queue/**
tags:
# required if branches-ignore is supplied (jaraco/skeleton#103)
- '**'
pull_request:

permissions:
contents: read

env:
# Environment variables to support color support (jaraco/skeleton#66):
# Request colored output from CLI tools supporting it. Different tools
# interpret the value differently. For some, just being set is sufficient.
# For others, it must be a non-zero integer. For yet others, being set
# to a non-empty value is sufficient. For tox, it must be one of
# <blank>, 0, 1, false, no, off, on, true, yes. The only enabling value
# in common is "1".
# Environment variable to support color support (jaraco/skeleton#66)
FORCE_COLOR: 1
# MyPy's color enforcement (must be a non-zero number)
MYPY_FORCE_COLOR: -42
# Recognized by the `py` package, dependency of `pytest` (must be "1")
PY_COLORS: 1
# Make tox-wrapped tools see color requests
TOX_TESTENV_PASSENV: >-
FORCE_COLOR
MYPY_FORCE_COLOR
NO_COLOR
PY_COLORS
PYTEST_THEME
PYTEST_THEME_MODE

# Suppress noisy pip warnings
PIP_DISABLE_PIP_VERSION_CHECK: 'true'
PIP_NO_PYTHON_VERSION_WARNING: 'true'
PIP_NO_WARN_SCRIPT_LOCATION: 'true'

# Disable the spinner, noise in GHA; TODO(webknjaz): Fix this upstream
# Must be "1".
TOX_PARALLEL_NO_SPINNER: 1
# Ensure tests can sense settings about the environment
TOX_OVERRIDE: >-
testenv.pass_env+=GITHUB_*,FORCE_COLOR
jobs:
test:
strategy:
# https://blog.jaraco.com/efficient-use-of-ci-resources/
matrix:
python:
- "3.8"
- "3.11"
- "3.12"
platform:
- ubuntu-latest
Expand All @@ -54,43 +45,51 @@ jobs:
platform: ubuntu-latest
- python: "3.10"
platform: ubuntu-latest
- python: pypy3.9
- python: "3.11"
platform: ubuntu-latest
- python: pypy3.10
platform: ubuntu-latest
runs-on: ${{ matrix.platform }}
continue-on-error: ${{ matrix.python == '3.12' }}
continue-on-error: ${{ matrix.python == '3.13' }}
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}
allow-prereleases: true
- name: Install tox
run: |
python -m pip install tox
run: python -m pip install tox
- name: Run
run: tox

docs:
collateral:
strategy:
fail-fast: false
matrix:
job:
- diffcov
- docs
runs-on: ubuntu-latest
env:
TOXENV: docs
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: 3.x
- name: Install tox
run: |
python -m pip install tox
- name: Run
run: tox
run: python -m pip install tox
- name: Eval ${{ matrix.job }}
run: tox -e ${{ matrix.job }}

check: # This job does nothing and is only used for the branch protection
if: always()

needs:
- test
- docs
- collateral

runs-on: ubuntu-latest

Expand All @@ -109,14 +108,13 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: 3.x
- name: Install tox
run: |
python -m pip install tox
run: python -m pip install tox
- name: Run
run: tox -e release
env:
Expand Down
7 changes: 4 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
repos:
- repo: https://github.com/psf/black
rev: 22.6.0
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.1.8
hooks:
- id: black
- id: ruff
- id: ruff-format
8 changes: 6 additions & 2 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ python:

# required boilerplate readthedocs/readthedocs.org#10401
build:
os: ubuntu-22.04
os: ubuntu-lts-latest
tools:
python: "3"
python: latest
# post-checkout job to ensure the clone isn't shallow jaraco/skeleton#114
jobs:
post_checkout:
- git fetch --unshallow || true
8 changes: 2 additions & 6 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,18 @@

.. image:: https://img.shields.io/pypi/pyversions/jaraco.crypto.svg

.. image:: https://github.com/jaraco/jaraco.crypto/workflows/tests/badge.svg
.. image:: https://github.com/jaraco/jaraco.crypto/actions/workflows/main.yml/badge.svg
:target: https://github.com/jaraco/jaraco.crypto/actions?query=workflow%3A%22tests%22
:alt: tests

.. image:: https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/charliermarsh/ruff/main/assets/badge/v2.json
:target: https://github.com/astral-sh/ruff
:alt: Ruff

.. image:: https://img.shields.io/badge/code%20style-black-000000.svg
:target: https://github.com/psf/black
:alt: Code style: Black

.. image:: https://readthedocs.org/projects/jaracocrypto/badge/?version=latest
:target: https://jaracocrypto.readthedocs.io/en/latest/?badge=latest

.. image:: https://img.shields.io/badge/skeleton-2023-informational
.. image:: https://img.shields.io/badge/skeleton-2024-informational
:target: https://blog.jaraco.com/skeleton

A set of cryptographic routines and utilities
Expand Down
10 changes: 3 additions & 7 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,12 @@ Homepage = "https://github.com/jaraco/jaraco.crypto"
[project.optional-dependencies]
testing = [
# upstream
"pytest >= 6",
"pytest >= 6, != 8.1.*",
"pytest-checkdocs >= 2.4",
'pytest-black >= 0.3.7; python_implementation != "PyPy"', # workaround for jaraco/skeleton#22
"pytest-cov",
'pytest-mypy >= 0.9.1; python_implementation != "PyPy"', # workaround for jaraco/skeleton#22
"pytest-mypy",
"pytest-enabler >= 2.2",
"pytest-ruff",
"pytest-ruff >= 0.2.1",

# local
]
Expand All @@ -56,7 +55,4 @@ exclude = [
]
namespaces = true

[tool.black]
skip-string-normalization = true

[tool.setuptools_scm]
16 changes: 7 additions & 9 deletions pytest.ini
Original file line number Diff line number Diff line change
@@ -1,20 +1,15 @@
[pytest]
norecursedirs=dist build .tox .eggs
addopts=--doctest-modules
addopts=
--doctest-modules
--import-mode importlib
consider_namespace_packages=true
filterwarnings=
## upstream

# Ensure ResourceWarnings are emitted
default::ResourceWarning

# shopkeep/pytest-black#55
ignore:<class 'pytest_black.BlackItem'> is not using a cooperative constructor:pytest.PytestDeprecationWarning
ignore:The \(fspath. py.path.local\) argument to BlackItem is deprecated.:pytest.PytestDeprecationWarning
ignore:BlackItem is an Item subclass and should not be a collector:pytest.PytestWarning

# shopkeep/pytest-black#67
ignore:'encoding' argument not specified::pytest_black

# realpython/pytest-mypy#152
ignore:'encoding' argument not specified::pytest_mypy

Expand All @@ -24,6 +19,9 @@ filterwarnings=
# pypa/build#615
ignore:'encoding' argument not specified::build.env

# dateutil/dateutil#1284
ignore:datetime.datetime.utcfromtimestamp:DeprecationWarning:dateutil.tz.tz

## end upstream

# itsdangerous is pinned to old version
Expand Down
28 changes: 28 additions & 0 deletions ruff.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
[lint]
extend-select = [
"C901",
"W",
]
ignore = [
# https://docs.astral.sh/ruff/formatter/#conflicting-lint-rules
"W191",
"E111",
"E114",
"E117",
"D206",
"D300",
"Q000",
"Q001",
"Q002",
"Q003",
"COM812",
"COM819",
"ISC001",
"ISC002",
]

[format]
# Enable preview, required for quote-style = "preserve"
preview = true
# https://docs.astral.sh/ruff/settings/#format-quote-style
quote-style = "preserve"
22 changes: 19 additions & 3 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
[testenv]
description = perform primary checks (tests, style, types, coverage)
deps =
setenv =
PYTHONWARNDEFAULTENCODING = 1
Expand All @@ -8,32 +9,47 @@ usedevelop = True
extras =
testing

[testenv:diffcov]
description = run tests and check that diff from main is covered
deps =
{[testenv]deps}
diff-cover
commands =
pytest {posargs} --cov-report xml
diff-cover coverage.xml --compare-branch=origin/main --html-report diffcov.html
diff-cover coverage.xml --compare-branch=origin/main --fail-under=100

[testenv:docs]
description = build the documentation
extras =
docs
testing
changedir = docs
commands =
python -m sphinx -W --keep-going . {toxinidir}/build/html
python -m sphinxlint
python -m sphinxlint \
# workaround for sphinx-contrib/sphinx-lint#83
--jobs 1

[testenv:finalize]
description = assemble changelog and tag a release
skip_install = True
deps =
towncrier
jaraco.develop >= 7.23
passenv = *
pass_env = *
commands =
python -m jaraco.develop.finalize


[testenv:release]
description = publish the package to PyPI and GitHub
skip_install = True
deps =
build
twine>=3
jaraco.develop>=7.1
passenv =
pass_env =
TWINE_PASSWORD
GITHUB_TOKEN
setenv =
Expand Down

0 comments on commit f34982d

Please sign in to comment.