Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Generated from:
# https://github.com/zopefoundation/meta/tree/master/config/pure-python
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:
permissions:
contents: read
pull-requests: write
name: linting
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: 3.x
- uses: pre-commit/action@2c7b3805fd2a0fd8c1884dcaebf91fc102a13ecd #v3.0.1
with:
extra_args: --all-files --show-diff-on-failure
env:
PRE_COMMIT_COLOR: always
- uses: pre-commit-ci/lite-action@5d6cc0eb514c891a40562a58a8e71576c5c7fb43 #v1.1.0
if: always()
with:
msg: Apply pre-commit code formatting
55 changes: 28 additions & 27 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,50 +12,51 @@ on:

jobs:
build:
permissions:
contents: read
pull-requests: write
strategy:
# We want to see all failures:
fail-fast: false
matrix:
os:
- ["ubuntu", "ubuntu-20.04"]
- ["ubuntu", "ubuntu-latest"]
config:
# [Python version, tox env]
- ["3.9", "lint"]
- ["3.7", "py37"]
- ["3.8", "py38"]
- ["3.9", "py39"]
- ["3.10", "py310"]
- ["3.11", "py311"]
- ["pypy-3.9", "pypy3"]
- ["3.9", "coverage"]
- ["3.11", "release-check"]
- ["3.9", "py39"]
- ["3.10", "py310"]
- ["3.11", "py311"]
- ["3.12", "py312"]
- ["3.13", "py313"]
- ["pypy-3.10", "pypy3"]
- ["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
name: ${{ matrix.config[1] }}
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
- uses: actions/checkout@v4
with:
python-version: ${{ matrix.config[0] }}
- name: Pip cache
uses: actions/cache@v3
persist-credentials: false
- name: Install uv + caching
uses: astral-sh/setup-uv@v5
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ matrix.config[0] }}-${{ hashFiles('setup.*', 'tox.ini') }}
restore-keys: |
${{ runner.os }}-pip-${{ matrix.config[0] }}-
${{ runner.os }}-pip-
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install tox
enable-cache: true
cache-dependency-glob: |
setup.*
tox.ini
python-version: ${{ matrix.matrix.config[0] }}
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Test
run: tox -e ${{ matrix.config[1] }}
if: ${{ !startsWith(runner.os, 'Mac') }}
run: uvx --with tox-uv tox -e ${{ matrix.config[1] }}
- name: Test (macOS)
if: ${{ startsWith(runner.os, 'Mac') }}
run: uvx --with tox-uv tox -e ${{ matrix.config[1] }}-universal2
- name: Coverage
if: matrix.config[1] == 'coverage'
run: |
pip install coveralls
coveralls --service=github
uvx coveralls --service=github
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
6 changes: 2 additions & 4 deletions .meta.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@
# https://github.com/zopefoundation/meta/tree/master/config/pure-python
[meta]
template = "pure-python"
commit-id = "fd874ae4"
commit-id = "c6354ebd"

[python]
with-pypy = true
with-sphinx-doctests = false
with-windows = false
with-future-python = false
with-macos = false
with-docs = false

[coverage]
fail-under = 95
Expand All @@ -21,9 +22,6 @@ additional-config = [
" src/grokcore/layout/__init__.py: F401",
]

[tox]
use-flake8 = true

[manifest]
additional-rules = [
"recursive-include src *.pt",
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/pure-python
minimum_pre_commit_version: '3.6'
repos:
- repo: https://github.com/pycqa/isort
rev: "6.0.1"
hooks:
- id: isort
- repo: https://github.com/hhatto/autopep8
rev: "v2.3.2"
hooks:
- id: autopep8
args: [--in-place, --aggressive, --aggressive]
- repo: https://github.com/asottile/pyupgrade
rev: v3.19.1
hooks:
- id: pyupgrade
args: [--py39-plus]
- repo: https://github.com/isidentical/teyit
rev: 0.4.3
hooks:
- id: teyit
- repo: https://github.com/PyCQA/flake8
rev: "7.2.0"
hooks:
- id: flake8
additional_dependencies:
- flake8-debugger == 4.1.2
4 changes: 3 additions & 1 deletion CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ Changelog
4.1 (unreleased)
----------------

- Nothing changed yet.
- Add support for Python 3.12, 3.13.

- Drop support for Python 3.7, 3.8.


4.0 (2023-08-28)
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<!--
Generated from:
https://github.com/zopefoundation/meta/tree/master/config/pure-python
-->
-->
# Contributing to zopefoundation projects

The projects under the zopefoundation GitHub organization are open source and
Expand Down
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
32 changes: 32 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Generated from:
# https://github.com/zopefoundation/meta/tree/master/config/pure-python

[build-system]
requires = [
"setuptools == 75.8.2",
"wheel",
]
build-backend = "setuptools.build_meta"

[tool.coverage.run]
branch = true
source = ["grokcore.layout"]

[tool.coverage.report]
fail_under = 95
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"
2 changes: 0 additions & 2 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# Generated from:
# https://github.com/zopefoundation/meta/tree/master/config/pure-python
[bdist_wheel]
universal = 0

[flake8]
doctests = 1
Expand Down
8 changes: 4 additions & 4 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,11 @@
'License :: OSI Approved :: Zope Public License',
'Programming Language :: Python',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10',
'Programming Language :: Python :: 3.11',
'Programming Language :: Python :: 3.12',
'Programming Language :: Python :: 3.13',
'Programming Language :: Python :: Implementation',
'Programming Language :: Python :: Implementation :: CPython',
'Programming Language :: Python :: Implementation :: PyPy',
Expand All @@ -54,13 +54,13 @@
author='Grok Team',
author_email='zope-dev@zope.dev',
url='https://github.com/zopefoundation/grokcore.layout',
license='ZPL 2.1',
license='ZPL-2.1',
packages=find_packages('src'),
package_dir={'': 'src'},
namespace_packages=['grokcore'],
include_package_data=True,
zip_safe=False,
python_requires='>=3.7',
python_requires='>=3.9',
extras_require={'test': test_requires},
install_requires=[
'grokcore.component >= 2.5',
Expand Down
2 changes: 1 addition & 1 deletion src/grokcore/layout/meta.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,5 +38,5 @@ def execute(self, factory, config, context, layer, provides, **kw):
discriminator=('adapter', adapts, provides),
callable=grokcore.component.provideAdapter,
args=(factory, adapts, provides),
)
)
return True
6 changes: 3 additions & 3 deletions src/grokcore/layout/tests/test_functional.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@ def suiteFromPackage(name):
getRootFolder = layer.getRootFolder
globs = dict(
getRootFolder=getRootFolder,
)
)
optionflags = (
doctest.ELLIPSIS +
doctest.NORMALIZE_WHITESPACE +
doctest.REPORT_NDIFF
)
)

for filename in files:
if filename == '__init__.py':
Expand All @@ -54,6 +54,6 @@ def test_suite():
suite = unittest.TestSuite()
for name in [
'functional'
]:
]:
suite.addTest(suiteFromPackage(name))
return suite
2 changes: 1 addition & 1 deletion src/grokcore/layout/tests/test_package.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def suiteFromPackage(name):
continue
if filename == '__init__.py':
continue
dottedname = 'grokcore.layout.tests.{}.{}'.format(name, filename[:-3])
dottedname = f'grokcore.layout.tests.{name}.{filename[:-3]}'
suite.addTest(make_test(dottedname))
return suite

Expand Down
Loading
Loading