Skip to content

Commit

Permalink
Configuring for zope-product
Browse files Browse the repository at this point in the history
  • Loading branch information
icemac committed Oct 16, 2024
1 parent 450e042 commit 6d308f1
Show file tree
Hide file tree
Showing 7 changed files with 112 additions and 54 deletions.
33 changes: 33 additions & 0 deletions .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Generated from:
# https://github.com/zopefoundation/meta/tree/master/config/zope-product
name: pre-commit

on:
pull_request:
push:
branches:
- master
# Allow to run this workflow manually from the Actions tab
workflow_dispatch:

env:
FORCE_COLOR: 1

jobs:
pre-commit:
name: linting
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: 3.x
- uses: pre-commit/[email protected]
with:
extra_args: --all-files --show-diff-on-failure
env:
PRE_COMMIT_COLOR: always
- uses: pre-commit-ci/[email protected]
if: always()
with:
msg: Apply pre-commit code formatting
17 changes: 9 additions & 8 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@ jobs:
- ["ubuntu", "ubuntu-latest"]
config:
# [Python version, tox env]
- ["3.11", "release-check"]
- ["3.11", "lint"]
- ["3.8", "py38"]
- ["3.9", "py39"]
- ["3.10", "py310"]
- ["3.11", "py311"]
- ["3.12", "py312"]
- ["3.11", "coverage"]
- ["3.11", "release-check"]
- ["3.8", "py38"]
- ["3.9", "py39"]
- ["3.10", "py310"]
- ["3.11", "py311"]
- ["3.12", "py312"]
- ["3.13", "py313"]
- ["3.11", "coverage"]

runs-on: ${{ matrix.os[1] }}
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name
Expand All @@ -38,6 +38,7 @@ jobs:
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.config[0] }}
allow-prereleases: true
- name: Pip cache
uses: actions/cache@v4
with:
Expand Down
4 changes: 2 additions & 2 deletions .meta.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# https://github.com/zopefoundation/meta/tree/master/config/zope-product
[meta]
template = "zope-product"
commit-id = "b1221c3c"
commit-id = "1b884354"

[python]
with-pypy = false
Expand All @@ -18,7 +18,7 @@ testenv-deps = [
]

[coverage]
fail-under = 89
fail-under = 88.5

[manifest]
additional-rules = [
Expand Down
28 changes: 28 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Generated from:
# https://github.com/zopefoundation/meta/tree/master/config/zope-product
minimum_pre_commit_version: '3.6'
repos:
- repo: https://github.com/pycqa/isort
rev: "5.13.2"
hooks:
- id: isort
- repo: https://github.com/hhatto/autopep8
rev: "v2.3.1"
hooks:
- id: autopep8
args: [--in-place, --aggressive, --aggressive]
- repo: https://github.com/asottile/pyupgrade
rev: v3.17.0
hooks:
- id: pyupgrade
args: [--py38-plus]
- repo: https://github.com/isidentical/teyit
rev: 0.4.3
hooks:
- id: teyit
- repo: https://github.com/PyCQA/flake8
rev: "7.1.1"
hooks:
- id: flake8
additional_dependencies:
- flake8-debugger == 4.1.2
1 change: 1 addition & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ include *.rst
include *.txt
include buildout.cfg
include tox.ini
include .pre-commit-config.yaml

recursive-include src *.py
recursive-include src *.pt
Expand Down
21 changes: 21 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#
# Generated from:
# https://github.com/zopefoundation/meta/tree/master/config/zope-product

[build-system]
requires = ["setuptools < 74"]
build-backend = "setuptools.build_meta"

[tool.coverage.run]
branch = true
source = ["five.localsitemanager"]

[tool.coverage.report]
fail_under = 88.5
precision = 2
ignore_errors = true
show_missing = true
exclude_lines = ["pragma: no cover", "pragma: nocover", "except ImportError:", "raise NotImplementedError", "if __name__ == '__main__':", "self.fail", "raise AssertionError", "raise unittest.Skip"]

[tool.coverage.html]
directory = "parts/htmlcov"
62 changes: 18 additions & 44 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -10,27 +10,35 @@ envlist =
py310
py311
py312
py313
coverage

[testenv]
skip_install = true
deps =
setuptools < 69
zc.buildout >= 3.0.1
setuptools < 74
zc.buildout >= 3.1
wheel > 0.37
setenv =
py312: VIRTUALENV_PIP=23.1.2
py312: PIP_REQUIRE_VIRTUALENV=0
commands_pre =
{envbindir}/buildout -nc {toxinidir}/buildout.cfg buildout:directory={envdir} buildout:develop={toxinidir} install test
commands =
{envbindir}/test {posargs:-cv}

[testenv:setuptools-latest]
basepython = python3
deps =
git+https://github.com/pypa/setuptools.git\#egg=setuptools
zc.buildout >= 3.1
wheel > 0.37


[testenv:release-check]
description = ensure that the distribution is ready to release
basepython = python3
skip_install = true
deps =
setuptools < 74
twine
build
check-manifest
Expand All @@ -44,29 +52,14 @@ commands =
twine check dist/*

[testenv:lint]
description = This env runs all linters configured in .pre-commit-config.yaml
basepython = python3
commands_pre =
mkdir -p {toxinidir}/parts/flake8
allowlist_externals =
mkdir
commands =
isort --check-only --diff {toxinidir}/src {toxinidir}/setup.py
flake8 {toxinidir}/src {toxinidir}/setup.py
skip_install = true
deps =
flake8
isort
# Useful flake8 plugins that are Python and Plone specific:
flake8-coding
flake8-debugger
mccabe

[testenv:isort-apply]
basepython = python3
pre-commit
commands_pre =
deps =
isort
commands =
isort {toxinidir}/src {toxinidir}/setup.py []
pre-commit run --all-files --show-diff-on-failure

[testenv:coverage]
basepython = python3
Expand All @@ -76,28 +69,9 @@ allowlist_externals =
mkdir
deps =
{[testenv]deps}
coverage
coverage[toml]
commands =
mkdir -p {toxinidir}/parts/htmlcov
coverage run {envbindir}/test {posargs:-cv}
coverage html
coverage report -m --fail-under=89

[coverage:run]
branch = True
source = five.localsitemanager

[coverage:report]
precision = 2
ignore_errors = True
exclude_lines =
pragma: no cover
pragma: nocover
except ImportError:
raise NotImplementedError
if __name__ == '__main__':
self.fail
raise AssertionError

[coverage:html]
directory = parts/htmlcov
coverage report

0 comments on commit 6d308f1

Please sign in to comment.