Skip to content

Commit 87f5cd3

Browse files
committed
- Apply the latest zope.meta templates
1 parent f2dc04c commit 87f5cd3

64 files changed

Lines changed: 561 additions & 432 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/pre-commit.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# Generated from:
2+
# https://github.com/zopefoundation/meta/tree/master/config/pure-python
3+
name: pre-commit
4+
5+
on:
6+
pull_request:
7+
push:
8+
branches:
9+
- master
10+
# Allow to run this workflow manually from the Actions tab
11+
workflow_dispatch:
12+
13+
env:
14+
FORCE_COLOR: 1
15+
16+
jobs:
17+
pre-commit:
18+
permissions:
19+
contents: read
20+
pull-requests: write
21+
name: linting
22+
runs-on: ubuntu-latest
23+
steps:
24+
- uses: actions/checkout@v5
25+
- uses: actions/setup-python@v6
26+
with:
27+
python-version: 3.x
28+
- uses: pre-commit/action@2c7b3805fd2a0fd8c1884dcaebf91fc102a13ecd #v3.0.1
29+
with:
30+
extra_args: --all-files --show-diff-on-failure
31+
env:
32+
PRE_COMMIT_COLOR: always
33+
- uses: pre-commit-ci/lite-action@5d6cc0eb514c891a40562a58a8e71576c5c7fb43 #v1.1.0
34+
if: always()
35+
with:
36+
msg: Apply pre-commit code formatting

.github/workflows/tests.yml

Lines changed: 32 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -12,60 +12,58 @@ on:
1212

1313
jobs:
1414
build:
15+
permissions:
16+
contents: read
17+
pull-requests: write
1518
strategy:
1619
# We want to see all failures:
1720
fail-fast: false
1821
matrix:
1922
os:
20-
- ["ubuntu", "ubuntu-20.04"]
23+
- ["ubuntu", "ubuntu-latest"]
2124
- ["windows", "windows-latest"]
2225
config:
2326
# [Python version, tox env]
24-
- ["3.9", "release-check"]
25-
- ["3.9", "lint"]
26-
- ["3.7", "py37"]
27-
- ["3.8", "py38"]
28-
- ["3.9", "py39"]
29-
- ["3.10", "py310"]
30-
- ["3.11", "py311"]
31-
- ["3.12", "py312"]
32-
- ["pypy-3.10", "pypy3"]
33-
- ["3.9", "docs"]
34-
- ["3.9", "coverage"]
27+
- ["3.11", "release-check"]
28+
- ["3.9", "py39"]
29+
- ["3.10", "py310"]
30+
- ["3.11", "py311"]
31+
- ["3.12", "py312"]
32+
- ["3.13", "py313"]
33+
- ["pypy-3.11", "pypy3"]
34+
- ["3.11", "docs"]
35+
- ["3.11", "coverage"]
3536
- ["3.10", "py310-pure"]
3637
exclude:
37-
- { os: ["windows", "windows-latest"], config: ["3.9", "release-check"] }
38-
- { os: ["windows", "windows-latest"], config: ["3.9", "lint"] }
39-
- { os: ["windows", "windows-latest"], config: ["3.9", "docs"] }
40-
- { os: ["windows", "windows-latest"], config: ["3.9", "coverage"] }
38+
- { os: ["windows", "windows-latest"], config: ["3.11", "release-check"] }
39+
- { os: ["windows", "windows-latest"], config: ["3.11", "docs"] }
40+
- { os: ["windows", "windows-latest"], config: ["3.11", "coverage"] }
4141

4242
runs-on: ${{ matrix.os[1] }}
4343
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name
4444
name: ${{ matrix.os[0] }}-${{ matrix.config[1] }}
4545
steps:
46-
- uses: actions/checkout@v4
47-
- name: Set up Python
48-
uses: actions/setup-python@v5
46+
- uses: actions/checkout@v5
4947
with:
50-
python-version: ${{ matrix.config[0] }}
51-
- name: Pip cache
52-
uses: actions/cache@v4
48+
persist-credentials: false
49+
- name: Install uv + caching
50+
uses: astral-sh/setup-uv@v6
5351
with:
54-
path: ~/.cache/pip
55-
key: ${{ runner.os }}-pip-${{ matrix.config[0] }}-${{ hashFiles('setup.*', 'tox.ini') }}
56-
restore-keys: |
57-
${{ runner.os }}-pip-${{ matrix.config[0] }}-
58-
${{ runner.os }}-pip-
59-
- name: Install dependencies
60-
run: |
61-
python -m pip install --upgrade pip
62-
pip install tox
52+
enable-cache: true
53+
cache-dependency-glob: |
54+
setup.*
55+
tox.ini
56+
python-version: ${{ matrix.matrix.config[0] }}
57+
github-token: ${{ secrets.GITHUB_TOKEN }}
6358
- name: Test
64-
run: tox -e ${{ matrix.config[1] }}
59+
if: ${{ !startsWith(runner.os, 'Mac') }}
60+
run: uvx --with tox-uv tox -e ${{ matrix.config[1] }}
61+
- name: Test (macOS)
62+
if: ${{ startsWith(runner.os, 'Mac') }}
63+
run: uvx --with tox-uv tox -e ${{ matrix.config[1] }}-universal2
6564
- name: Coverage
6665
if: matrix.config[1] == 'coverage'
6766
run: |
68-
pip install coveralls
69-
coveralls --service=github
67+
uvx coveralls --service=github
7068
env:
7169
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.meta.toml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# https://github.com/zopefoundation/meta/tree/master/config/pure-python
33
[meta]
44
template = "pure-python"
5-
commit-id = "1404d28b"
5+
commit-id = "b3663390"
66

77
[python]
88
with-windows = true
@@ -70,3 +70,6 @@ additional-ignores = [
7070
additional-config = [
7171
"- [\"3.10\", \"py310-pure\"]",
7272
]
73+
74+
[pre-commit]
75+
teyit-exclude = "docs/articles/old-guide"

.pre-commit-config.yaml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Generated from:
2+
# https://github.com/zopefoundation/meta/tree/master/config/pure-python
3+
minimum_pre_commit_version: '3.6'
4+
repos:
5+
- repo: https://github.com/pycqa/isort
6+
rev: "6.0.1"
7+
hooks:
8+
- id: isort
9+
- repo: https://github.com/hhatto/autopep8
10+
rev: "v2.3.2"
11+
hooks:
12+
- id: autopep8
13+
args: [--in-place, --aggressive, --aggressive]
14+
- repo: https://github.com/asottile/pyupgrade
15+
rev: v3.20.0
16+
hooks:
17+
- id: pyupgrade
18+
args: [--py39-plus]
19+
- repo: https://github.com/isidentical/teyit
20+
rev: 0.4.3
21+
hooks:
22+
- id: teyit
23+
exclude: docs/articles/old-guide
24+
- repo: https://github.com/PyCQA/flake8
25+
rev: "7.3.0"
26+
hooks:
27+
- id: flake8
28+
additional_dependencies:
29+
- flake8-debugger == 4.1.2

CHANGES.rst

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,12 @@
22
Change History
33
================
44

5-
6.0.2 (unreleased)
6-
==================
5+
6.1 (unreleased)
6+
================
7+
8+
- Add support for Python 3.13.
9+
10+
- Drop support for Python 3.7 and 3.8.
711

812

913
6.0.1 (2025-04-13)

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<!--
22
Generated from:
33
https://github.com/zopefoundation/meta/tree/master/config/pure-python
4-
-->
4+
-->
55
# Contributing to zopefoundation projects
66

77
The projects under the zopefoundation GitHub organization are open source and

MANIFEST.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ include *.rst
55
include *.txt
66
include buildout.cfg
77
include tox.ini
8+
include .pre-commit-config.yaml
89

910
recursive-include docs *.py
1011
recursive-include docs *.rst

docs/articles/old-guide/chatter.py

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
1-
2-
import sys, time, os, random
1+
import os
2+
import random
3+
import sys
4+
import time
35

46
import transaction
7+
from BTrees import OOBTree
58
from persistent import Persistent
6-
79
from ZEO import ClientStorage
10+
811
import ZODB
912
from ZODB.POSException import ConflictError
10-
from BTrees import OOBTree
13+
1114

1215
class ChatSession(Persistent):
1316

@@ -32,7 +35,6 @@ def __init__(self, name):
3235
# Internal attribute: _messages holds all the chat messages.
3336
self._messages = OOBTree.OOBTree()
3437

35-
3638
def new_messages(self):
3739
"Return new messages."
3840

@@ -46,7 +48,7 @@ def new_messages(self):
4648

4749
for T2, message in self._messages.items():
4850
if T2 > T:
49-
new.append( message )
51+
new.append(message)
5052
self._v_last_time = T2
5153

5254
return new
@@ -59,7 +61,7 @@ def add_message(self, message):
5961
while 1:
6062
try:
6163
now = time.time()
62-
self._messages[ now ] = message
64+
self._messages[now] = message
6365
transaction.commit()
6466
except ConflictError:
6567
# Conflict occurred; this process should abort,
@@ -72,6 +74,7 @@ def add_message(self, message):
7274
break
7375
# end while
7476

77+
7578
def get_chat_session(conn, channelname):
7679
"""Return the chat session for a given channel, creating the session
7780
if required."""
@@ -81,20 +84,20 @@ def get_chat_session(conn, channelname):
8184
# the key 'chat_sessions'.
8285
root = conn.root()
8386
if not root.has_key('chat_sessions'):
84-
print 'Creating chat_sessions B-tree'
87+
print 'Creating chat_sessions B-tree' # NOQA: E999 print statement
8588
root['chat_sessions'] = OOBTree.OOBTree()
8689
transaction.commit()
8790

8891
sessions = root['chat_sessions']
8992

9093
# Get a session object corresponding to the channel name, creating
9194
# it if necessary.
92-
if not sessions.has_key( channelname ):
95+
if not sessions.has_key(channelname):
9396
print 'Creating new session:', channelname
94-
sessions[ channelname ] = ChatSession(channelname)
97+
sessions[channelname] = ChatSession(channelname)
9598
transaction.commit()
9699

97-
session = sessions[ channelname ]
100+
session = sessions[channelname]
98101
return session
99102

100103

@@ -103,8 +106,8 @@ def get_chat_session(conn, channelname):
103106
print 'Usage: %s <channelname>' % sys.argv[0]
104107
sys.exit(0)
105108

106-
storage = ClientStorage.ClientStorage( ('localhost', 9672) )
107-
db = ZODB.DB( storage )
109+
storage = ClientStorage.ClientStorage(('localhost', 9672))
110+
db = ZODB.DB(storage)
108111
conn = db.open()
109112

110113
s = session = get_chat_session(conn, sys.argv[1])
@@ -114,12 +117,12 @@ def get_chat_session(conn, channelname):
114117
while 1:
115118
# Send a random message
116119
msg = random.choice(messages)
117-
session.add_message( '%s: pid %i' % (msg,os.getpid() ))
120+
session.add_message('%s: pid %i' % (msg, os.getpid()))
118121

119122
# Display new messages
120123
for msg in session.new_messages():
121124
print msg
122125

123126
# Wait for a few seconds
124-
pause = random.randint( 1, 4 )
125-
time.sleep( pause )
127+
pause = random.randint(1, 4)
128+
time.sleep(pause)

docs/articles/old-guide/convert_zodb_guide.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,19 @@
11
# Use the python docs converter to convert to rst
22
# Requires http://svn.python.org/projects/doctools/converter
33

4-
from converter import restwriter, convert_file
5-
6-
import sys
74
import os
5+
import sys
6+
7+
from converter import convert_file
8+
from converter import restwriter
89

910

1011
if __name__ == '__main__':
1112
try:
1213
rootdir = sys.argv[1]
1314
destdir = os.path.abspath(sys.argv[2])
1415
except IndexError:
15-
print "usage: convert.py docrootdir destdir"
16+
print "usage: convert.py docrootdir destdir" # NOQA: E999 print
1617
sys.exit()
1718

1819
os.chdir(rootdir)
@@ -27,4 +28,4 @@ def get(self, a, b=None):
2728

2829
for infile in os.listdir('.'):
2930
if infile.endswith('.tex'):
30-
convert_file(infile, os.path.join(destdir, infile[:-3]+'rst'))
31+
convert_file(infile, os.path.join(destdir, infile[:-3] + 'rst'))

0 commit comments

Comments
 (0)