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/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:
permissions:
contents: read
pull-requests: write
name: linting
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: actions/setup-python@v6
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
57 changes: 28 additions & 29 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,52 +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", "release-check"]
- ["3.9", "lint"]
- ["3.7", "py37"]
- ["3.8", "py38"]
- ["3.9", "py39"]
- ["3.10", "py310"]
- ["3.11", "py311"]
- ["3.12", "py312"]
- ["3.9", "docs"]
- ["3.9", "coverage"]
- ["3.11", "release-check"]
- ["3.9", "py39"]
- ["3.10", "py310"]
- ["3.11", "py311"]
- ["3.12", "py312"]
- ["3.13", "py313"]
- ["3.11", "docs"]
- ["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@v5
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@v6
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.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 }}
2 changes: 1 addition & 1 deletion .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 = "acd8d239"
commit-id = "96dd7c5d"

[python]
with-windows = false
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: "6.1.0"
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.20.0
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.3.0"
hooks:
- id: flake8
additional_dependencies:
- flake8-debugger == 4.1.2
6 changes: 6 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ Change log
4.3 (unreleased)
----------------

- Drop support for Python 3.7 and 3.8.

- Add support for Python 3.13.

- Update package management files from latest ``zope.meta`` templates.


4.2 (2023-12-28)
----------------
Expand Down
4 changes: 4 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
<!--
Generated from:
https://github.com/zopefoundation/meta/tree/master/config/zope-product
-->
# Contributing to dataflake projects

The projects under the dataflake 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 docs *.py
recursive-include docs *.rst
Expand Down
3 changes: 1 addition & 2 deletions buildout.cfg
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
[buildout]
extends =
https://zopefoundation.github.io/Zope/releases/master/versions-prod.cfg
https://zopefoundation.github.io/Zope/releases/master/versions.cfg
develop = .
parts =
test


[test]
recipe = zc.recipe.testrunner
defaults = ['-cv']
eggs = Products.mcdutils
15 changes: 7 additions & 8 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,12 @@

import datetime
import os
import pkginfo
import sys
from importlib.metadata import distribution

parent = os.path.dirname(os.path.dirname(__file__))
parent_dir = os.path.abspath(parent)
pkg_info = pkginfo.Develop(parent_dir)
pkg_version = pkg_info.version or ''

sys.path.append(os.path.abspath('../src'))
rqmt = distribution('Products.mcdutils')
year = datetime.datetime.now().year

# -- Project information -----------------------------------------------------
Expand All @@ -22,9 +21,9 @@
author = 'Tres Seaver and contributors'

# The short X.Y version.
version = pkg_version.replace('.dev0', '')
version = '%s.%s' % tuple(map(int, rqmt.version.split('.')[:2]))
# The full version, including alpha/beta/rc tags.
release = pkg_version
release = rqmt.version

# -- General configuration ---------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
Expand All @@ -37,5 +36,5 @@
# -- Options for HTML output -------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output

html_theme = 'sphinx_rtd_theme'
html_theme = 'furo'
html_static_path = ['_static']
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/zope-product

[build-system]
requires = [
"setuptools >= 78.1.1,< 81",
"wheel",
]
build-backend = "setuptools.build_meta"

[tool.coverage.run]
branch = true
source = ["Products.mcdutils"]

[tool.coverage.report]
fail_under = 84
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/zope-product
[bdist_wheel]
universal = 0

[flake8]
doctests = 1
Expand Down
61 changes: 30 additions & 31 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,23 +25,23 @@ def _read(name):
description=('A Zope product with memcached-backed ZCache and '
'Zope session implementations.'),
long_description=_read('README.rst') + '\n\n' + _read('CHANGES.rst'),
long_description_content_type='text/x-rst',
classifiers=[
'Development Status :: 6 - Mature',
'Environment :: Web Environment',
'Framework :: Zope',
'Framework :: Zope :: 5',
'Intended Audience :: Developers',
'License :: OSI Approved :: Zope Public License',
'Operating System :: OS Independent',
'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',
'Topic :: Internet :: WWW/HTTP :: Session',
'Development Status :: 6 - Mature',
'Environment :: Web Environment',
'Framework :: Zope',
'Framework :: Zope :: 5',
'Intended Audience :: Developers',
'License :: OSI Approved :: Zope Public License',
'Operating System :: OS Independent',
'Programming Language :: Python',
'Programming Language :: Python :: 3',
'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',
'Topic :: Internet :: WWW/HTTP :: Session',
],
keywords='zope session memcache memcached Products',
author='Tres Seaver and contributors',
Expand All @@ -50,27 +50,26 @@ def _read(name):
maintainer_email='jens@dataflake.org',
url='https://mcdutils.readthedocs.io',
project_urls={
'Documentation': 'https://mcdutils.readthedocs.io',
'Issue Tracker': ('https://github.com/dataflake/Products.mcdutils'
'/issues'),
'Sources': 'https://github.com/dataflake/Products.mcdutils',
'Documentation': 'https://mcdutils.readthedocs.io',
'Issue Tracker': ('https://github.com/dataflake/Products.mcdutils'
'/issues'),
'Sources': 'https://github.com/dataflake/Products.mcdutils',
},
license='ZPL 2.1',
license='ZPL-2.1',
packages=find_packages('src'),
package_dir={'': 'src'},
include_package_data=True,
namespace_packages=['Products'],
zip_safe=False,
python_requires='>=3.7',
python_requires='>=3.9',
install_requires=[
'setuptools',
'python-memcached',
'Zope >= 5',
],
'setuptools',
'python-memcached',
'Zope >= 5',
],
extras_require={
'docs': ['sphinx',
'repoze.sphinx.autointerface',
'sphinx-rtd-theme',
'pkginfo'],
},
'docs': ['sphinx',
'repoze.sphinx.autointerface',
'furo'],
},
)
4 changes: 2 additions & 2 deletions src/Products/mcdutils/ftests/test_proxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def test_writing_to_mapping_no_memcache(self):

sdc = self._makeOne()
mapping = sdc.new_or_existing('foobar')
self.assertTrue(isinstance(mapping, MemCacheMapping))
self.assertIsInstance(mapping, MemCacheMapping)
self.assertFalse(mapping._p_changed)
self.assertFalse(mapping._p_joined)
mapping['abc'] = 1345
Expand All @@ -45,7 +45,7 @@ def test_writing_to_mapping_with_memcache(self):
sdc = self._makeOne()
sdc._get_proxy().servers = ('localhost:11211',)
mapping = sdc.new_or_existing('foobar')
self.assertTrue(isinstance(mapping, MemCacheMapping))
self.assertIsInstance(mapping, MemCacheMapping)
self.assertFalse(mapping._p_changed)
self.assertTrue(mapping._p_joined)
mapping['abc'] = 1345
Expand Down
6 changes: 3 additions & 3 deletions src/Products/mcdutils/tests/test_sessiondata.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,9 @@ def test_new_or_existing_returns_txn_aware_mapping(self):
from transaction.interfaces import IDataManager
sdc = self._makeOne('mcsdc')
created = sdc.new_or_existing('foobar')
self.assertTrue(isinstance(created, PersistentMapping))
self.assertIsInstance(created, PersistentMapping)
jar = created._p_jar
self.assertFalse(jar is None)
self.assertIsNotNone(jar)
self.assertTrue(IDataManager.providedBy(jar))

def test_has_key_after_new_or_existing_returns_True(self):
Expand All @@ -88,4 +88,4 @@ def test_has_key_after_new_or_existing_returns_True(self):
def test_get_after_new_or_existing_returns_same(self):
sdc = self._makeOne('mcsdc')
created = sdc.new_or_existing('foobar')
self.assertTrue(sdc.get('foobar') is created)
self.assertIs(sdc.get('foobar'), created)
Loading