Skip to content

Commit

Permalink
chore: migrate to setup.cfg (#666)
Browse files Browse the repository at this point in the history
closes #644 #662 #663
  • Loading branch information
ceache committed Sep 30, 2022
1 parent 9bb8499 commit 5f7ae48
Show file tree
Hide file tree
Showing 14 changed files with 141 additions and 137 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Expand Up @@ -32,3 +32,5 @@ zookeeper/
.tox
/.settings
/.metadata

!.gitignore
19 changes: 14 additions & 5 deletions MANIFEST.in
@@ -1,12 +1,21 @@
global-exclude *pyc *pyo __pycache__
# Git files
exclude .gitignore
# CI/CD files
exclude .travis.yml.bak
exclude .clog.toml
prune .github

exclude Makefile
exclude run_failure.py

include CHANGES.md
include CONTRIBUTING.md
include README.md
include LICENSE
include MANIFEST.in
exclude .gitignore
exclude .travis.yml
exclude Makefile
exclude run_failure.py

include tox.ini

recursive-include kazoo *
recursive-include docs *
global-exclude *pyc *pyo
5 changes: 3 additions & 2 deletions constraints.txt
@@ -1,9 +1,10 @@
# Consistent testing environment.
coverage==6.3.2
flake8==3.7.9
mock==3.0.5
objgraph==3.4.1
pytest==4.6.9
pytest-cov==2.8.1
pytest-cov~=2.12
pytest~=4.6

# Documentation building.
Jinja2==2.7.3
Expand Down
12 changes: 3 additions & 9 deletions kazoo/tests/test_selectors_select.py
Expand Up @@ -8,7 +8,7 @@
import socket
import sys
import unittest
from test import support

from kazoo.handlers.utils import selector_select

select = selector_select
Expand Down Expand Up @@ -56,18 +56,12 @@ def test_select(self):
cmd = 'for i in 0 1 2 3 4 5 6 7 8 9; do echo testing...; sleep 1; done'
p = os.popen(cmd, 'r')
for tout in (0, 1, 2, 4, 8, 16) + (None,) * 10:
if support.verbose:
print('timeout =', tout)
rfd, wfd, xfd = select([p], [], [], tout)
if (rfd, wfd, xfd) == ([], [], []):
continue
if (rfd, wfd, xfd) == ([p], [], []):
line = p.readline()
if support.verbose:
print(repr(line))
if not line:
if support.verbose:
print('EOF')
break
continue
self.fail('Unexpected return values from select():', rfd, wfd, xfd)
Expand All @@ -87,5 +81,5 @@ def fileno(self):
self.assertEqual(select([], a, []), ([], a[:5], []))


def tearDownModule():
support.reap_children()
if __name__ == '__main__':
unittest.main()
6 changes: 6 additions & 0 deletions pyproject.toml
@@ -0,0 +1,6 @@
[build-system]
build-backend = 'setuptools.build_meta'
requires = [
'setuptools >= 46.4.0',
'wheel'
]
2 changes: 0 additions & 2 deletions requirements.txt

This file was deleted.

1 change: 0 additions & 1 deletion requirements_eventlet.txt

This file was deleted.

1 change: 0 additions & 1 deletion requirements_gevent.txt

This file was deleted.

1 change: 0 additions & 1 deletion requirements_sasl.txt

This file was deleted.

4 changes: 0 additions & 4 deletions requirements_sphinx.txt

This file was deleted.

6 changes: 0 additions & 6 deletions requirements_test.txt

This file was deleted.

94 changes: 87 additions & 7 deletions setup.cfg
@@ -1,15 +1,95 @@
[aliases]
clean_egg_info = egg_info -Db ''
release = clean_egg_info sdist bdist_wheel
[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_file = 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.7
Programming Language :: Python :: 3.8
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

[bdist_wheel]
universal = 1

[options]
zip_safe = false
include_package_data = true
packages = find:
install_requires =
six
selectors2>=2.0.2 ; python_version < "3.4.0"

[aliases]
release = sdist bdist_wheel

[egg_info]
tag_build = dev

[metadata]
license_file = LICENSE
[bdist_wheel]
universal = true

[options.extras_require]
dev =
flake8

test =
mock
objgraph
pytest
pytest-cov
gevent>=1.2 ; implementation_name!='pypy'
eventlet>=0.17.1 ; implementation_name!='pypy'

eventlet =
eventlet>=0.17.1

gevent =
gevent>=1.2

sasl =
pure_sasl>=0.5.1

docs =
Sphinx>=1.2.2

alldeps =
%(dev)s
%(eventlet)s
%(gevent)s
%(sasl)s
%(docs)s

[tool:pytest]
addopts = -ra -v

[flake8]
builtins = _
exclude =
.git,
__pycache__,
.venv/,venv/,
.tox/,
build/,dist/,*egg,
docs/conf.py,
zookeeper/
83 changes: 2 additions & 81 deletions setup.py
@@ -1,82 +1,3 @@
import os
import re
from setuptools import setup, find_packages
import sys
import setuptools

here = os.path.abspath(os.path.dirname(__file__))
with open(os.path.join(here, 'README.md')) as f:
README = f.read()
with open(os.path.join(here, 'CHANGES.md')) as f:
CHANGES = f.read()
version = ''
with open(os.path.join(here, 'kazoo', 'version.py')) as f:
version = re.search(r'^__version__\s*=\s*[\'"]([^\'"]*)[\'"]',
f.read(), re.MULTILINE).group(1)

PYPY = getattr(sys, 'pypy_version_info', False) and True or False

install_requires = ['six', 'selectors2>=2.0.2; python_version < "3.4.0"']

tests_require = install_requires + [
'mock',
'pytest',
'pytest-cov',
'flake8',
'objgraph',
]

if not PYPY:
tests_require += [
'gevent>=1.2',
'eventlet>=0.17.1',
]

on_rtd = os.environ.get('READTHEDOCS', None) == 'True'
if on_rtd:
install_requires += [
'gevent>=1.2',
'eventlet>=0.17.1',
'pure-sasl',
]

setup(
name='kazoo',
version=version,
description='Higher Level Zookeeper Client',
long_description=README + '\n\n' + CHANGES,
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 :: 2",
"Programming Language :: Python :: 2.7",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.4",
"Programming Language :: Python :: 3.5",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: Implementation :: CPython",
"Programming Language :: Python :: Implementation :: PyPy",
"Topic :: Communications",
"Topic :: System :: Distributed Computing",
"Topic :: System :: Networking",
],
keywords='zookeeper lock leader configuration',
author="Kazoo team",
author_email="python-zk@googlegroups.com",
url="https://kazoo.readthedocs.io",
license="Apache 2.0",
packages=find_packages(),
test_suite="kazoo.tests",
include_package_data=True,
zip_safe=False,
install_requires=install_requires,
tests_require=tests_require,
extras_require={
'test': tests_require,
'sasl': ['pure-sasl==0.5.1'],
},
long_description_content_type="text/markdown",
)
setuptools.setup()
42 changes: 24 additions & 18 deletions tox.ini
@@ -1,44 +1,50 @@
[tox]
minversion = 3.7
skipsdist = True
minversion = 3.24.1
requires=
virtualenv>=20.7.2
tox-wheel>=0.6.0
skip_missing_interpreters=True
envlist =
pep8,
{py37,py38,py39,pypy3}
{gevent,eventlet,sasl,docs},
pypy3
isolated_build = true

[testenv]
usedevelop = True
install_command = pip install {opts} {packages}
wheel = True
wheel_build_env = build
install_command = pip install -c{toxinidir}/constraints.txt {opts} {packages}
passenv =
CI
TOX_*
CI_*
ZOOKEEPER_*
setenv =
VIRTUAL_ENV={envdir}
pypy3: PYPY=1
extras =
test
docs: docs
gevent: gevent
eventlet: eventlet
sasl: sasl
deps =
-c{toxinidir}/constraints.txt
-r{toxinidir}/requirements.txt
-r{toxinidir}/requirements_test.txt
docs: -r{toxinidir}/requirements_sphinx.txt
gevent: -r{toxinidir}/requirements_gevent.txt
eventlet: -r{toxinidir}/requirements_eventlet.txt
sasl: -r{toxinidir}/requirements_sasl.txt
sasl: kerberos
codecov: codecov
commands =
sasl: {toxinidir}/init_krb5.sh {envtmpdir}/kerberos \
/{toxinidir}/ensure-zookeeper-env.sh \
pytest {posargs: -ra -v --cov-report=xml --cov=kazoo kazoo/tests}


[testenv:build]

[testenv:codecov]
commands = - codecov -e TOX_VENV,ZOOKEEPER_VERSION

[testenv:pep8]
commands = flake8 {posargs}

extra = alldeps
deps =
flake8==3.7.9
usedevelop = True
commands = flake8 {posargs} {toxinidir}/kazoo

[flake8]
builtins = _
exclude = .venv,.tox,dist,doc,*egg,.git,build,tools,local,docs,zookeeper

0 comments on commit 5f7ae48

Please sign in to comment.