From d6959aad9145fcd67f75f97ee3766d6548234b09 Mon Sep 17 00:00:00 2001 From: Jason Madden Date: Fri, 11 Oct 2024 05:23:15 -0500 Subject: [PATCH] Add new Python versions; Drop legacy python versions including 2; drop pkg_resources; drop zopyx.txng3.ext --- .github/workflows/tests.yml | 67 ++++++++++++------------ CHANGES.rst | 7 ++- pyproject.toml | 5 ++ setup.py | 26 ++++----- src/nti/__init__.py | 1 - src/nti/zope_catalog/tests/test_index.py | 22 +------- tox.ini | 2 +- 7 files changed, 61 insertions(+), 69 deletions(-) create mode 100644 pyproject.toml diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 1cec0bb..1c9bc59 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -11,44 +11,45 @@ jobs: test: strategy: matrix: - # XXX: PyPy 3, both 3.6 and 3.7 (7.3.4) crash in the test - # suite when calling a C extension. It's likely - # zopyx.txng3.ext, which compiles with many warnings. - python-version: [2.7, pypy2, 3.6, 3.7, 3.8, 3.9] + python-version: ["3.12", "pypy-3.10-v7.3.17", '3.9', '3.10', '3.11', "3.13"] runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - name: Set up Python - uses: actions/setup-python@v2 - with: - python-version: ${{ matrix.python-version }} - - name: Pip cache - uses: actions/cache@v2 - with: - path: ~/.cache/pip - key: ${{ runner.os }}-pip-${{ matrix.python-version }}-${{ hashFiles('setup.*') }} - - name: Install dependencies - run: | - python -m pip install -U pip setuptools wheel - python -m pip install -U coverage - python -m pip install -U -e ".[test,docs]" - - name: Test - run: | - coverage run -m zope.testrunner --test-path=src --auto-color --auto-progress - coverage run -a -m sphinx -b doctest -d docs/_build/doctrees docs docs/_build/doctests - coverage report -i - - name: Submit to Coveralls - # This is a container action, which only runs on Linux. - uses: AndreMiras/coveralls-python-action@develop - with: - parallel: true + - name: checkout + uses: actions/checkout@v4 + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + cache: 'pip' + cache-dependency-path: setup.py + - name: Install dependencies + run: | + python -m pip install -U pip setuptools wheel + python -m pip install -U coverage + python -m pip install -U -e ".[test,docs]" + - name: Test + run: | + coverage run -m zope.testrunner --test-path=src --auto-color --auto-progress + coverage run -a -m sphinx -b doctest -d docs/_build/doctrees docs docs/_build/doctests + - name: Report coverage + run: | + python -m coverage combine || true + python -m coverage report -i || true + python -m coverage xml -i || true + - name: Submit to Coveralls + # This is a container action, which only runs on Linux. + uses: coverallsapp/github-action@v2 + with: + flag-name: run-${{ join(matrix.*, '-') }} + parallel: true + format: cobertura coveralls_finish: needs: test runs-on: ubuntu-latest steps: - - name: Coveralls Finished - uses: AndreMiras/coveralls-python-action@develop - with: - parallel-finished: true + - name: Coveralls Finished + uses: coverallsapp/github-action@v2 + with: + parallel-finished: true diff --git a/CHANGES.rst b/CHANGES.rst index 3f6ef3d..de8ae95 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -2,10 +2,13 @@ Changes ========= -3.0.2 (unreleased) +4.0.0 (unreleased) ================== -- Nothing changed yet. +- Drop support for Python 2. We now only support Python 3.9 and above. +- Add support for Python 3.10, 11, 12, and 13. +- Remove dependency on ``zopyx.txng3.ext``. +- Remove dependency on ``pkg_resources``. 3.0.1 (2021-05-13) diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..96625b5 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,5 @@ +[build-system] +requires = [ + "wheel", + "setuptools", +] diff --git a/setup.py b/setup.py index 498f5ad..a53dd54 100755 --- a/setup.py +++ b/setup.py @@ -1,5 +1,6 @@ import codecs -from setuptools import setup, find_packages +from setuptools import setup +from setuptools import find_namespace_packages TESTS_REQUIRE = [ @@ -30,32 +31,33 @@ def _read(fname): 'Operating System :: OS Independent', 'Framework :: ZODB', 'License :: OSI Approved :: Apache Software License', - 'Programming Language :: Python :: 2', - 'Programming Language :: Python :: 2.7', 'Programming Language :: Python :: 3', - 'Programming Language :: Python :: 3.6', - 'Programming Language :: Python :: 3.7', - 'Programming Language :: Python :: 3.8', + "Programming Language :: Python :: 3 :: Only", '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', ], url="https://github.com/OpenNTI/nti.zope_catalog", + project_urls={ + 'Documentation': 'https://ntizope-catalog.readthedocs.io/en/latest/', + }, zip_safe=True, - packages=find_packages('src'), + packages=find_namespace_packages(where='src'), package_dir={'': 'src'}, include_package_data=True, - namespace_packages=['nti'], tests_require=TESTS_REQUIRE, install_requires=[ - 'setuptools', 'BTrees >= 4.8.0', 'nti.property >= 1.0.0', 'nti.zodb >= 1.0.0', 'persistent', 'pytz', 'six', - 'zc.catalog[stemmer] >= 2.0.1', + 'zc.catalog >= 2.0.1', 'ZODB >= 5.0.0', 'zope.cachedescriptors', 'zope.catalog', @@ -64,14 +66,14 @@ def _read(fname): 'zope.index', 'zope.interface', 'zope.location', - 'zopyx.txng3.ext >= 4.0.0' ], extras_require={ 'test': TESTS_REQUIRE, 'docs': [ - 'Sphinx < 4', # 4 breaks autointerface == 0.8 + 'Sphinx', 'repoze.sphinx.autointerface', 'sphinx_rtd_theme', ], }, + python_requires=">=3.9", ) diff --git a/src/nti/__init__.py b/src/nti/__init__.py index 656dc0f..e69de29 100644 --- a/src/nti/__init__.py +++ b/src/nti/__init__.py @@ -1 +0,0 @@ -__import__('pkg_resources').declare_namespace(__name__) # pragma: no cover diff --git a/src/nti/zope_catalog/tests/test_index.py b/src/nti/zope_catalog/tests/test_index.py index 3a9ed00..50ede79 100644 --- a/src/nti/zope_catalog/tests/test_index.py +++ b/src/nti/zope_catalog/tests/test_index.py @@ -339,23 +339,5 @@ def test_query_stemmer(self): index.index_doc(1, self) assert_that(index.documentCount(), is_(1)) - - # Make sure the words got stemmed correctly. This fails - # if zopyx.txng3.ext is not installed. - assert_that(index.lexicon.get_wid('resources'), is_(0)) - assert_that(index.lexicon.get_wid('resource'), is_(0)) - assert_that(index.lexicon.get_wid('resourc'), is_not(0)) - - - - assert_that(index.apply("resource"), - contains(1)) - - assert_that(index.apply("human"), - contains(1)) - - assert_that(index.apply("valuable"), - contains(1)) - - assert_that(list(index.apply("resource*")), - is_([])) + # This used to contain tests that the zopyx.txng3.ext stemmer + # was being used. That isn't supported any more. diff --git a/tox.ini b/tox.ini index 5b90f7b..3db73ab 100644 --- a/tox.ini +++ b/tox.ini @@ -1,6 +1,6 @@ [tox] envlist = - py27,py36,py37,py38,py39,pypy,pypy3,coverage,docs + py39,py310,py311,py312,py313,pypy,pypy3,coverage,docs [testenv] commands =