Skip to content

Commit

Permalink
Merge branch 'master' into dataflake/tomlkit
Browse files Browse the repository at this point in the history
  • Loading branch information
icemac authored Dec 15, 2023
2 parents 2594956 + cb0568c commit 43fd75b
Show file tree
Hide file tree
Showing 7 changed files with 64 additions and 27 deletions.
10 changes: 5 additions & 5 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
rev: v4.5.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
Expand All @@ -11,13 +11,13 @@ repos:
- id: debug-statements
language_version: python3
- repo: https://github.com/PyCQA/flake8
rev: 6.0.0
rev: 6.1.0
hooks:
- id: flake8
language_version: python3
additional_dependencies: [flake8-typing-imports==1.14.0]
additional_dependencies: [flake8-typing-imports==1.15.0]
- repo: https://github.com/pre-commit/mirrors-autopep8
rev: v2.0.1
rev: v2.0.4
hooks:
- id: autopep8
- repo: https://github.com/timothycrosley/isort
Expand All @@ -38,7 +38,7 @@ repos:
additional_dependencies: [pygments, restructuredtext_lint]
# This can deal with sphinx directives
- repo: https://github.com/myint/rstcheck
rev: "v6.1.1"
rev: "v6.2.0"
hooks:
- id: rstcheck
args: [--ignore-messages, Duplicate implicit target.*]
7 changes: 7 additions & 0 deletions config/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,9 @@ updated. Example:
" src/foo/bar.py: E221 E222",
"extend-ignore = D203, W503",
]
additional-plugins = [
"mccabe",
]
additional-sources = "testproj foo bar.py"
[manifest]
Expand Down Expand Up @@ -522,6 +525,10 @@ additional-config
list of strings so the leading white spaces and comments are preserved when
writing the value to ``setup.cfg``.

additional-plugins
Some packages want to have additional flake8 plugins installed.
This option is a list of strings.

additional-sources
Sometimes not only ``src`` and ``setup.py`` contain Python code to be checked
by flake8. Additional files or directories can be configured here. This
Expand Down
10 changes: 5 additions & 5 deletions config/config-package.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
Generated from:
https://github.com/zopefoundation/meta/tree/master/config/{config_type}
--> """
FUTURE_PYTHON_VERSION = ""
FUTURE_PYTHON_VERSION = "3.13.0-alpha - 3.13.0"
DEFAULT = object()


Expand Down Expand Up @@ -226,10 +226,7 @@ def with_pypy(self):

@cached_property
def with_future_python(self):
if FUTURE_PYTHON_VERSION:
return self._set_python_config_value('future-python')
else:
return False
return self._set_python_config_value('future-python')

@cached_property
def with_docs(self):
Expand Down Expand Up @@ -423,6 +420,8 @@ def tox(self):
coverage_setenv = self.tox_option('coverage-setenv')
coverage_run_additional_config = self.meta_cfg['coverage-run'].get(
'additional-config', [])
flake8_additional_plugins = self.meta_cfg['flake8'].get(
'additional-plugins', '')
flake8_additional_sources = self.meta_cfg['flake8'].get(
'additional-sources', '')
if flake8_additional_sources:
Expand Down Expand Up @@ -454,6 +453,7 @@ def tox(self):
coverage_setenv=coverage_setenv,
fail_under=self.fail_under,
flake8_additional_sources=flake8_additional_sources,
flake8_additional_plugins=flake8_additional_plugins,
isort_additional_sources=isort_additional_sources,
testenv_additional=testenv_additional,
testenv_additional_extras=testenv_additional_extras,
Expand Down
3 changes: 3 additions & 0 deletions config/default/tests.yml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ jobs:
{% endif %}
config:
# [Python version, tox env]
- ["3.9", "release-check"]
- ["3.9", "lint"]
- ["3.7", "py37"]
- ["3.8", "py38"]
Expand All @@ -61,13 +62,15 @@ jobs:
exclude:
{% endif %}
{% if with_windows %}
- { os: ["windows", "windows-latest"], config: ["3.9", "release-check"] }
- { os: ["windows", "windows-latest"], config: ["3.9", "lint"] }
{% if with_docs %}
- { os: ["windows", "windows-latest"], config: ["3.9", "docs"] }
{% endif %}
- { os: ["windows", "windows-latest"], config: ["3.9", "coverage"] }
{% endif %}
{% if with_macos %}
- { os: ["macos", "macos-11"], config: ["3.9", "release-check"] }
- { os: ["macos", "macos-11"], config: ["3.9", "lint"] }
{% if with_docs %}
- { os: ["macos", "macos-11"], config: ["3.9", "docs"] }
Expand Down
1 change: 1 addition & 0 deletions config/default/tox-envlist.j2
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
[tox]
minversion = 3.18
envlist =
release-check
lint
py37
py38
Expand Down
35 changes: 24 additions & 11 deletions config/default/tox-lint.j2
Original file line number Diff line number Diff line change
@@ -1,21 +1,35 @@

[testenv:lint]
[testenv:release-check]
description = ensure that the distribution is ready to release
basepython = python3
skip_install = true
deps =
twine
build
check-manifest
check-python-versions >= 0.20.0
wheel
commands =
{% if use_flake8 %}
isort --check-only --diff {toxinidir}/src {toxinidir}/setup.py%(isort_additional_sources)s
flake8 src setup.py%(flake8_additional_sources)s
{% endif %}
check-manifest
check-python-versions
python -m build --sdist --no-isolation
twine check dist/*

[testenv:lint]
basepython = python3
skip_install = true
deps =
check-manifest
check-python-versions >= 0.19.1
wheel
isort
{% if use_flake8 %}
flake8
isort
{% for line in flake8_additional_plugins %}
%(line)s
{% endfor %}
{% endif %}
commands =
isort --check-only --diff {toxinidir}/src {toxinidir}/setup.py%(isort_additional_sources)s
{% if use_flake8 %}
flake8 src setup.py%(flake8_additional_sources)s
{% endif %}

[testenv:isort-apply]
basepython = python3
Expand All @@ -25,4 +39,3 @@ deps =
isort
commands =
isort {toxinidir}/src {toxinidir}/setup.py%(isort_additional_sources)s []
{% endif %}
25 changes: 19 additions & 6 deletions config/zope-product/tox.ini.j2
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,29 @@ commands =
%(line)s
{% endfor %}
{% else %}
{envdir}/bin/test {posargs:-cv}
{envbindir}/test {posargs:-cv}
{% endif %}
{% for line in testenv_additional %}
%(line)s
{% endfor %}

[testenv:release-check]
description = ensure that the distribution is ready to release
basepython = python3
skip_install = true
deps =
twine
build
check-manifest
check-python-versions >= 0.20.0
wheel
commands_pre =
commands =
check-manifest
check-python-versions
python -m build --sdist --no-isolation
twine check dist/*

[testenv:lint]
basepython = python3
commands_pre =
Expand All @@ -50,11 +67,7 @@ commands =
isort --check-only --diff {toxinidir}/src {toxinidir}/setup.py%(isort_additional_sources)s
flake8 {toxinidir}/src {toxinidir}/setup.py%(flake8_additional_sources)s
{% endif %}
check-manifest
check-python-versions
deps =
check-manifest
check-python-versions
{% if use_flake8 %}
flake8
isort
Expand Down Expand Up @@ -95,7 +108,7 @@ commands =
%(line)s
{% endfor %}
{% else %}
coverage run {envdir}/bin/test {posargs:-cv}
coverage run {envbindir}/test {posargs:-cv}
{% endif %}
coverage html
coverage report -m --fail-under=%(fail_under)s
Expand Down

0 comments on commit 43fd75b

Please sign in to comment.