Skip to content

Commit f2ebd54

Browse files
committed
Drop support for Celery < 5, Python < 3.6.
1 parent caa81de commit f2ebd54

File tree

3 files changed

+5
-37
lines changed

3 files changed

+5
-37
lines changed

celery_batches/__init__.py

+1-20
Original file line numberDiff line numberDiff line change
@@ -92,10 +92,8 @@ def wot_api_real(urls):
9292
current_app.backend.mark_as_done(request.id, response)
9393
9494
"""
95-
from __future__ import absolute_import, unicode_literals
96-
9795
from itertools import count
98-
import sys
96+
from queue import Empty, Queue
9997

10098
from celery import signals, states
10199
from celery._state import _task_stack
@@ -107,20 +105,6 @@ def wot_api_real(urls):
107105

108106
from kombu.utils.uuid import uuid
109107

110-
# Celery 5 dropped support for five, handle those manually.
111-
PY3 = sys.version_info[0] >= 3
112-
113-
if PY3:
114-
from queue import Empty, Queue
115-
116-
# Py3 does not have buffer, only use this for isa checks.
117-
class buffer_t(object):
118-
"""Python 3 does not have a buffer type."""
119-
120-
else:
121-
from Queue import Queue, Empty
122-
buffer_t = buffer # noqa
123-
124108

125109
__all__ = ['Batches']
126110

@@ -271,15 +255,12 @@ def Strategy(self, task, app, consumer):
271255
timer = consumer.timer
272256
put_buffer = self._buffer.put
273257
flush_buffer = self._do_flush
274-
body_can_be_buffer = consumer.pool.body_can_be_buffer
275258

276259
def task_message_handler(message, body, ack, reject, callbacks, **kw):
277260
if body is None:
278261
body, headers, decoded, utc = (
279262
message.body, message.headers, False, True,
280263
)
281-
if not body_can_be_buffer:
282-
body = bytes(body) if isinstance(body, buffer_t) else body
283264
else:
284265
body, headers, decoded, utc = proto1_to_proto2(message, body)
285266

setup.py

+3-4
Original file line numberDiff line numberDiff line change
@@ -23,17 +23,16 @@ def long_description():
2323
url='https://github.com/percipient/celery-batches',
2424
license='BSD',
2525
platforms=['any'],
26-
install_requires=['celery>=4.0,<5.1'],
26+
install_requires=['celery>=5.0,<5.1'],
27+
python_requires=">=3.6,",
2728
classifiers=[
2829
'Development Status :: 3 - Alpha',
2930
'License :: OSI Approved :: BSD License',
3031
'Topic :: System :: Distributed Computing',
3132
'Topic :: Software Development :: Object Brokering',
3233
'Programming Language :: Python',
33-
'Programming Language :: Python :: 2',
34-
'Programming Language :: Python :: 2.7',
34+
'Programming Language :: Python :: 3 :: Only',
3535
'Programming Language :: Python :: 3',
36-
'Programming Language :: Python :: 3.5',
3736
'Programming Language :: Python :: 3.6',
3837
'Programming Language :: Python :: 3.7',
3938
'Programming Language :: Python :: 3.8',

tox.ini

+1-13
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,11 @@
11
[tox]
22
envlist =
3-
{2.7,pypy,3.5,3.6,pypy3}-celery{40,41,42}
4-
# Celery 4.3 adds support for Python 3.7 and higher.
5-
{pypy3,3.7,3.8}-celery{43,44,50,master}
3+
{pypy3,3.6,3.7,3.8}-celery{50,master}
64
flake8
75

86
[testenv]
97
deps=
108
-r{toxinidir}/requirements/test.txt
11-
celery40: celery>=4.0,<4.1
12-
# Kombu 4.2.0 is incompatible with Celery 4.0.x. It is compatible with
13-
# Celery 4.1.1 and 4.2.x.
14-
celery40: kombu<4.2
15-
celery41: celery>=4.1,<4.2
16-
celery42: celery>=4.2,<4.3
17-
celery43: celery>=4.3,<4.4
18-
celery44: celery>=4.4,<4.5
199
celery50: celery>=5.0,<5.1
2010
celerymaster: https://codeload.github.com/celery/celery/zip/master
2111

@@ -26,11 +16,9 @@ commands =
2616
coverage run -m pytest
2717
coverage html
2818
basepython =
29-
2.7: python2.7
3019
3.6: python3.6
3120
3.7: python3.7
3221
3.8: python3.8
33-
pypy: pypy
3422
pypy3: pypy3
3523
flake8: python3.6
3624
usedevelop = True

0 commit comments

Comments
 (0)