Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Python version support. #37

Merged
merged 7 commits into from
Jan 20, 2025
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
29 changes: 0 additions & 29 deletions .coveragerc

This file was deleted.

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/buildout-recipe
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/action@v3.0.1
with:
extra_args: --all-files --show-diff-on-failure
env:
PRE_COMMIT_COLOR: always
- uses: pre-commit-ci/lite-action@v1.1.0
if: always()
with:
msg: Apply pre-commit code formatting
21 changes: 12 additions & 9 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,14 @@ jobs:
- ["ubuntu", "ubuntu-latest"]
config:
# [Python version, tox env]
- ["3.9", "release-check"]
- ["3.9", "lint"]
- ["3.7", "py37"]
- ["3.8", "py38"]
- ["3.9", "py39"]
- ["3.10", "py310"]
- ["3.11", "py311"]
- ["3.12", "py312"]
- ["3.11", "release-check"]
- ["3.9", "py39"]
- ["3.10", "py310"]
- ["3.11", "py311"]
- ["3.12", "py312"]
- ["3.13", "py313"]
- ["pypy-3.10", "pypy3"]
- ["3.9", "coverage"]
- ["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 @@ -40,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 All @@ -53,7 +52,11 @@ jobs:
python -m pip install --upgrade pip
pip install tox
- name: Test
if: ${{ !startsWith(runner.os, 'Mac') }}
run: tox -e ${{ matrix.config[1] }}
- name: Test (macOS)
if: ${{ startsWith(runner.os, 'Mac') }}
run: tox -e ${{ matrix.config[1] }}-universal2
- name: Coverage
if: matrix.config[1] == 'coverage'
run: |
Expand Down
10 changes: 6 additions & 4 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/buildout-recipe
[meta]
template = "buildout-recipe"
commit-id = "7713fd86"
commit-id = "a3a78df1"

[python]
with-pypy = true
Expand All @@ -18,12 +18,14 @@ fail-under = 79
[coverage-run]
additional-config = [
"data_file = $COVERAGE_HOME.coverage",
"omit = */__main__.py",
]
]
omit = [
"*/__main__.py",
]

[tox]
coverage-setenv = [
"COVERAGE_PROCESS_START={toxinidir}/.coveragerc",
"COVERAGE_PROCESS_START={toxinidir}/pyproject.toml",
"COVERAGE_HOME={toxinidir}/",
]
use-flake8 = true
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/buildout-recipe
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.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.1.1"
hooks:
- id: flake8
additional_dependencies:
- flake8-debugger == 4.1.2
3 changes: 3 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ Change log
5.2 (unreleased)
================

- Add support for Python 3.13.

- Drop support for Python 3.7, 3.8.

5.1 (2024-05-03)
================
Expand Down
2 changes: 1 addition & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ include *.rst
include *.txt
include buildout.cfg
include tox.ini
include .coveragerc
include .pre-commit-config.yaml

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

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

[tool.coverage.run]
branch = true
source = ["zdaemon"]
parallel = true
data_file = "$COVERAGE_HOME.coverage"
omit = [
"*/__main__.py",
]

[tool.coverage.report]
fail_under = 79
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"

[tool.coverage.paths]
source = ["src/", ".tox/*/lib/python*/site-packages/", ".tox/pypy*/site-packages/"]
5 changes: 2 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,11 @@ def read(*rnames):
'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 :: CPython',
'Programming Language :: Python :: Implementation :: PyPy',
'Operating System :: POSIX',
Expand All @@ -74,7 +73,7 @@ def read(*rnames):
zip_safe=False,
entry_points=entry_points,
include_package_data=True,
python_requires='>=3.7',
python_requires='>=3.9',
install_requires=[
"ZConfig",
"setuptools"
Expand Down
4 changes: 2 additions & 2 deletions src/zdaemon/tests/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
pkg_resources.Requirement.parse('zdaemon')).location
zconfig_loc = pkg_resources.working_set.find(
pkg_resources.Requirement.parse('ZConfig')).location
except (ImportError, AttributeError):
except (ModuleNotFoundError, AttributeError):
zdaemon_loc = os.path.dirname(os.path.dirname(zdaemon.__file__))
zconfig_loc = os.path.dirname(os.path.dirname(ZConfig.__file__))

Expand Down Expand Up @@ -535,7 +535,7 @@ def checkenv(match):

try:
import coverage
except ImportError:
except ModuleNotFoundError:
pass
else:
coverage.process_startup()
Expand Down
2 changes: 1 addition & 1 deletion src/zdaemon/tests/testzdoptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ def test_handler_side_effect(self):
L = []
options.add("setting", None, "a:", "append=", handler=L.append)
options.realize(["-a2", "--append", "3"])
self.assertTrue(options.setting is None)
self.assertIsNone(options.setting)
self.assertEqual(L, ["2", "3"])

def test_handler_with_bad_value(self):
Expand Down
11 changes: 7 additions & 4 deletions src/zdaemon/tests/testzdrun.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ def tearDown(self):
signal.signal(sig, signal.SIG_DFL)
try:
os.unlink(self.zdsock)
except os.error:
except OSError:
pass
output = self.new_stdout.getvalue()
self.assertEqual(self.expect, output)
Expand Down Expand Up @@ -234,8 +234,11 @@ def testRunIgnoresParentSignals(self):
# Make sure the child is still responsive.
response = send_action('status\n', zdrun_socket,
raise_on_error=True)
self.assertTrue(b'\n' in response,
'no newline in response: ' + repr(response))
self.assertIn(
b'\n',
response,
'no newline in response: ' + repr(response)
)
# Kill the process.
send_action('stop\n', zdrun_socket)
finally:
Expand All @@ -252,7 +255,7 @@ def testRunIgnoresParentSignals(self):
for fname in os.listdir(tmp):
try:
os.unlink(os.path.join(tmp, fname))
except os.error:
except OSError:
pass
os.rmdir(tmp)

Expand Down
2 changes: 1 addition & 1 deletion src/zdaemon/zdctl.py
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,7 @@ def do_kill(self, arg):
print("kill(%d, %d)" % (self.zd_pid, sig))
try:
os.kill(self.zd_pid, sig)
except os.error as msg:
except OSError as msg:
print("Error:", msg)
else:
print("signal %s sent to process %d" % (signame, self.zd_pid))
Expand Down
Loading
Loading