From c24cafecec52dd569ffc8ee0551cc440457cea99 Mon Sep 17 00:00:00 2001 From: Thomas Tanner Date: Fri, 4 Sep 2026 10:52:52 +0100 Subject: [PATCH] chore: remove constraints.txt and setup.cfg Consolidates setup.cfg and constraints.txt into pyproject.toml, and additionally cleans up the list so that only the optional eventlet, gevent and sasl dependencies are visible, the various dev ones are not. Updated pytest to the latest supporting 3.8 or it can't cope with the .toml file... Removed Makefile which isn't used anywhere and references a bunch of requirements*.txt files which don't exist. --- .readthedocs.yaml | 5 +- Makefile | 51 --------------------- constraints.txt | 19 -------- docs/requirements.txt | 2 + pyproject.toml | 91 +++++++++++++++++++++++++++++++++++- setup.cfg | 104 ------------------------------------------ tox.ini | 34 +++++++------- 7 files changed, 110 insertions(+), 196 deletions(-) delete mode 100644 Makefile delete mode 100644 constraints.txt create mode 100644 docs/requirements.txt diff --git a/.readthedocs.yaml b/.readthedocs.yaml index ef6b82d3..d613e7bc 100644 --- a/.readthedocs.yaml +++ b/.readthedocs.yaml @@ -26,7 +26,4 @@ formats: [] # Optionally declare the Python requirements required to build your docs python: install: - - method: pip - path: . - extra_requirements: - - docs + - requirements: docs/requirements.txt diff --git a/Makefile b/Makefile deleted file mode 100644 index f49c3c93..00000000 --- a/Makefile +++ /dev/null @@ -1,51 +0,0 @@ -HERE = $(shell pwd) -BIN = $(HERE)/bin -PYTHON = $(BIN)/python -INSTALL = $(BIN)/pip install -TOX_VENV ?= py37 -BUILD_DIRS = bin build include lib lib64 man share - -PYTHON_EXE = $(shell [ -f $(PYTHON) ] && echo $(PYTHON) || echo python) -PYPY = $(shell $(PYTHON_EXE) -c "import sys; print(getattr(sys, 'pypy_version_info', False) and 'yes' or 'no')") -CI ?= false -CI_PYTHON_VERSION ?= $(shell $(PYTHON_EXE) -c "import sys; print('.'.join([str(s) for s in sys.version_info][:2]))") - -GREENLET_SUPPORTED = yes -ifeq ($(findstring 3.,$(CI_PYTHON_VERSION)), 3.) - GREENLET_SUPPORTED = no - VENV_CMD = $(PYTHON_EXE) -m venv . -else - VENV_CMD = $(PYTHON_EXE) -m virtualenv . -endif -ifeq ($(PYPY),yes) - GREENLET_SUPPORTED = no -endif - -.PHONY: all build clean test - -all: build - -$(PYTHON): - $(VENV_CMD) - -build: $(PYTHON) -ifeq ($(GREENLET_SUPPORTED),yes) - $(INSTALL) -U -r requirements_eventlet.txt - $(INSTALL) -U -r requirements_gevent.txt -endif -ifneq ($(CI), true) - $(INSTALL) -U -r requirements_sphinx.txt -endif - $(INSTALL) -U -r requirements.txt - $(PYTHON) setup.py develop - $(INSTALL) kazoo[test] - -clean: - rm -rf $(BUILD_DIRS) - -test: - tox -e$(TOX_VENV) - -html: - cd docs && \ - make html diff --git a/constraints.txt b/constraints.txt deleted file mode 100644 index 58be5adb..00000000 --- a/constraints.txt +++ /dev/null @@ -1,19 +0,0 @@ -# Consistent testing environment. -# requirements.txt -eventlet>=0.17.1 ; implementation_name!='pypy' -gevent>=1.2 ; implementation_name!='pypy' - -# requirements-dev.txt -black==22.10.0 -coverage==6.3.2; python_version=="3.8" -coverage==7.10.7; python_version > "3.8" -flake8==5.0.2 -mypy==1.14.1 -objgraph==3.5.0 -pytest==6.2.5; python_version=="3.8" -pytest==8.4.2; python_version > "3.8" -pytest-cov==3.0.0; python_version=="3.8" -pytest-cov==7.0.0; python_version > "3.8" -pytest-timeout==2.2.0; python_version=="3.8" -pytest-timeout==2.4.0; python_version > "3.8" -pyOpenSSL<26.2.0 diff --git a/docs/requirements.txt b/docs/requirements.txt new file mode 100644 index 00000000..86410a8f --- /dev/null +++ b/docs/requirements.txt @@ -0,0 +1,2 @@ +Sphinx>=1.2.2 +sphinx-autodoc-typehints>=1 diff --git a/pyproject.toml b/pyproject.toml index 869ed27c..1f382f17 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,9 +1,98 @@ [build-system] build-backend = 'setuptools.build_meta' requires = [ - 'setuptools >= 46.4.0', + 'setuptools >= 61.0.0', ] +[project] +name = "kazoo" +dynamic = ["version", "readme"] +description = "Higher Level Zookeeper Client" +requires-python = ">=3.8" +license = {text = "Apache 2.0"} +authors = [ + {name = "Kazoo team", email = "python-zk@googlegroups.com"}, +] +keywords = ["zookeeper", "lock", "leader", "configuration"] +classifiers = [ + "Development Status :: 5 - Production/Stable", + "License :: OSI Approved :: Apache Software License", + "Intended Audience :: Developers", + "Operating System :: OS Independent", + "Programming Language :: Python", + "Programming Language :: Python :: 3", + "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 :: 3.14", + "Programming Language :: Python :: Implementation :: CPython", + "Programming Language :: Python :: Implementation :: PyPy", + "Topic :: Communications", + "Topic :: System :: Distributed Computing", + "Topic :: System :: Networking", +] +dependencies = ["typing-extensions"] + +[project.urls] +Documentation = "https://kazoo.readthedocs.io" +Changelog = "https://github.com/python-zk/kazoo/releases" +Source = "https://github.com/python-zk/kazoo" +"Bug Tracker" = "https://github.com/python-zk/kazoo/issues" + +[project.optional-dependencies] +eventlet = ["eventlet>=0.17.1; implementation_name != 'pypy'"] +gevent = ["gevent>=1.2; implementation_name != 'pypy'"] +sasl = ["pure_sasl>=0.5.1"] + +[dependency-groups] +black = ["black==22.10.0"] +pep8 = ["flake8==5.0.2"] +test-extras = [ + "objgraph==3.5.0", + "pyOpenSSL<26.2.0", + "pyjks", + "unittest-parametrize", +] +pytest = [ + "pytest==7.4.4; python_version == '3.8'", + "pytest==8.4.2; python_version > '3.8'", +] +test = [ + "coverage==6.3.2; python_version == '3.8'", + "coverage==7.10.7; python_version > '3.8'", + {include-group = "pytest"}, + "pytest-cov==3.0.0; python_version == '3.8'", + "pytest-cov==7.0.0; python_version > '3.8'", + "pytest-timeout==2.2.0; python_version == '3.8'", + "pytest-timeout==2.4.0; python_version > '3.8'", + {include-group = "test-extras"}, +] +mypy = [ + "mypy==1.14.1", + {include-group = "test-extras"}, + {include-group = "pytest"}, + "types-gevent", + "types-mock", + "types-objgraph", + "types-pyjks", +] + +[tool.setuptools] +zip-safe = false +include-package-data = true +packages = {find = {}} +license-files = ["LICENSE"] + +[tool.setuptools.package-data] +kazoo = ["py.typed"] + +[tool.setuptools.dynamic] +version = {attr = "kazoo.version.__version__"} +readme = {file = ["README.md", "CHANGES.md"], content-type = "text/markdown"} + [tool.black] line-length = 79 # We need a later version of black for 312-314 diff --git a/setup.cfg b/setup.cfg index 5ef8ffb2..3c2fdf51 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,106 +1,2 @@ -[metadata] -name = kazoo -version = attr: kazoo.version.__version__ -author = Kazoo team -author_email = python-zk@googlegroups.com -url = https://kazoo.readthedocs.io -description = "Higher Level Zookeeper Client" -long_description = file: README.md, CHANGES.md -long_description_content_type = text/markdown -license = Apache 2.0 -license_files = - LICENSE -platform = any -keywords = zookeeper, lock, leader, configuration -classifiers = - Development Status :: 5 - Production/Stable - License :: OSI Approved :: Apache Software License - Intended Audience :: Developers - Operating System :: OS Independent - Programming Language :: Python - Programming Language :: Python :: 3 - 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 :: 3.14 - Programming Language :: Python :: Implementation :: CPython - Programming Language :: Python :: Implementation :: PyPy - Topic :: Communications - Topic :: System :: Distributed Computing - Topic :: System :: Networking -project_urls = - Documentation = https://kazoo.readthedocs.io - Changelog = https://github.com/python-zk/kazoo/releases - Source = https://github.com/python-zk/kazoo - Bug Tracker = https://github.com/python-zk/kazoo/issues - - -[options] -zip_safe = false -include_package_data = true -packages = find: -install_requires = - typing-extensions - -[options.package_data] -kazoo = py.typed - -[aliases] -release = sdist bdist_wheel - [egg_info] tag_build = dev - -[options.extras_require] -dev = - black - flake8 - -# I have to pin this HERE because I can't persuade vscode to -# look in constraints.txt -other = - pyOpenSSL<26.2.0 - typing-extensions - -test = - objgraph - pytest - pytest-cov - pytest-timeout - gevent>=1.2 ; implementation_name!='pypy' - eventlet>=0.17.1 ; implementation_name!='pypy' - pyjks - unittest-parametrize - %(other)s - -eventlet = - eventlet>=0.17.1 - -gevent = - gevent>=1.2 - -sasl = - pure_sasl>=0.5.1 - -docs = - Sphinx>=1.2.2 - sphinx-autodoc-typehints>=1 - -typing = - mypy==1.14.1 - types-gevent - types-mock - types-objgraph - types-pyjks - -alldeps = - %(dev)s - %(eventlet)s - %(gevent)s - %(sasl)s - %(docs)s - %(other)s - %(typing)s diff --git a/tox.ini b/tox.ini index ab62ae26..cafa16e0 100644 --- a/tox.ini +++ b/tox.ini @@ -1,6 +1,6 @@ [tox] -minversion = 4.3.4 requires= + tox>=4.22 virtualenv>=20.7.2 skip_missing_interpreters=True envlist = @@ -13,7 +13,7 @@ isolated_build = true [testenv] wheel = True wheel_build_env = build -install_command = pip install -c{toxinidir}/constraints.txt {opts} {packages} +install_command = pip install {opts} {packages} passenv = CI TOX_* @@ -21,9 +21,9 @@ passenv = ZOOKEEPER_* setenv = pypy3: PYPY=1 -extras = +dependency_groups = test - docs: docs +extras = gevent: gevent eventlet: eventlet sasl: sasl @@ -41,27 +41,27 @@ commands = [testenv:build] -[testenv:pep8] -extras = alldeps +[testenv:docs] +dependency_groups = deps = - flake8 + -r{toxinidir}/docs/requirements.txt +commands = sphinx-build -b html docs {toxworkdir}/docs/html + +[testenv:pep8] +dependency_groups = pep8 usedevelop = True commands = flake8 {posargs} {toxinidir}/kazoo [testenv:black] -extras = -deps = - black +dependency_groups = black usedevelop = True commands = black --check {posargs: {toxinidir}/kazoo {toxinidir}/kazoo} [testenv:mypy] -extras = alldeps -deps = - mypy - types-mock - pyopenssl - pytest - unittest-parametrize +dependency_groups = mypy +extras = + eventlet + gevent + sasl usedevelop = True commands = mypy --config-file {toxinidir}/pyproject.toml {toxinidir}/kazoo