Skip to content

Commit

Permalink
Drop support for Python 2
Browse files Browse the repository at this point in the history
  • Loading branch information
icgood committed Feb 2, 2022
1 parent 768c349 commit e54fdd6
Show file tree
Hide file tree
Showing 74 changed files with 195 additions and 1,226 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 13,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: [2.7, 3.6, 3.7, 3.8, 3.9]
python-version: ['3.6', '3.7', '3.8', '3.9']

steps:
- uses: actions/checkout@v2
Expand All @@ -28,9 28,9 @@ jobs:
- name: Lint with flake8
run: |
flake8 slimta
- name: Type checking with pytype
- name: Type checking with pyright
run: |
pytype -k
pyright slimta
- name: Test with pytest
run: |
py.test --cov=slimta
4 changes: 2 additions & 2 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -1,7 1,7 @@
pytest >= 4
pytest-cov
pytype
mox3
pyright
pymox
testfixtures
flake8
twine
Expand Down
4 changes: 4 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 7,10 @@ filterwarnings =
ignore::DeprecationWarning
ignore::PendingDeprecationWarning

[flake8]
per-file-ignores =
test/*: E501

[coverage:report]
exclude_lines =
declare_namespace
Expand Down
12 changes: 4 additions & 8 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 28,7 @@
license = f.read()

setup(name='python-slimta',
version='4.2.1',
version='5.0.0',
author='Ian Good',
author_email='[email protected]',
description='Lightweight, asynchronous SMTP libraries.',
Expand All @@ -40,12 40,9 @@
packages=find_packages(),
namespace_packages=['slimta'],
install_requires=['gevent >= 1.1rc',
'pysasl >= 0.4.0, < 0.5',
'pycares < 3.0.0; python_version < "3.0"',
'pycares >= 1; python_version >= "3.0"'],
extras_require={'spf': ['pyspf', 'py3dns; python_version >= "3.0"',
'pydns; python_version < "3.0"',
'ipaddr; python_version < "3.0"'],
'pysasl >= 0.5.0',
'pycares >= 1'],
extras_require={'spf': ['pyspf', 'py3dns'],
'redis': ['redis'],
'aws': ['boto'],
'disk': ['pyaio >= 0.4; platform_system == "Linux"']},
Expand All @@ -55,7 52,6 @@
'Intended Audience :: Information Technology',
'License :: OSI Approved :: MIT License',
'Programming Language :: Python',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
Expand Down
11 changes: 3 additions & 8 deletions slimta/cloudstorage/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 22,6 @@
"""Package containing a module for the different cloud service providers along
with any necessary helper modules.
.. _Cloud Files: http://www.rackspace.com/cloud/files/
.. _Cloud Queues: http://www.rackspace.com/cloud/queues/
.. _S3: http://aws.amazon.com/s3/
.. _SQS: http://aws.amazon.com/sqs/
Expand All @@ -49,21 47,18 @@ class CloudStorageError(QueueError):
class CloudStorage(QueueStorage):
"""This class implements a :class:`~slimta.queue.QueueStorage` backend that
uses cloud services to store messages. It coordinates the storage of
messages and metadata (using `Cloud Files`_ or `S3`_) with the optional
message queue mechanisms (using `Cloud Queues`_ or `SQS`_) that can alert
other *slimta* processes that a new message is available in the object
store.
messages and metadata (using `S3`_) with the optional message queue
mechanisms (using `SQS`_) that can alert other *slimta* processes that a
new message is available in the object store.
:param object_store: The object used as the backend for storing message
contents and metadata in the cloud. Currently this can
be an instance of
:class:`~rackspace.RackspaceCloudFiles` or
:class:`~aws.SimpleStorageService`.
:param message_queue: The optional object used
as the backend for alerting other processes that a
new message is in the object store. Currently this
can be an instance of
:class:`~rackspace.RackspaceCloudQueues` or
:class:`~aws.SimpleQueueService`.
"""
Expand Down
7 changes: 3 additions & 4 deletions slimta/cloudstorage/aws.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 62,7 @@

import uuid
import json

from six.moves import cPickle
import pickle

import gevent
from boto.s3.key import Key
Expand Down Expand Up @@ -105,7 104,7 @@ def _get_key(self, id):
def write_message(self, envelope, timestamp):
key = self.Key(self.bucket)
key.key = self.prefix str(uuid.uuid4())
envelope_raw = cPickle.dumps(envelope, cPickle.HIGHEST_PROTOCOL)
envelope_raw = pickle.dumps(envelope, pickle.HIGHEST_PROTOCOL)
with gevent.Timeout(self.timeout):
key.set_metadata('timestamp', json.dumps(timestamp))
key.set_metadata('attempts', '')
Expand Down Expand Up @@ -137,7 136,7 @@ def get_message(self, id):
timestamp_raw = key.get_metadata('timestamp')
attempts_raw = key.get_metadata('attempts')
delivered_raw = key.get_metadata('delivered_indexes')
envelope = cPickle.loads(envelope_raw)
envelope = pickle.loads(envelope_raw)
meta = {'timestamp': json.loads(timestamp_raw)}
if attempts_raw:
meta['attempts'] = json.loads(attempts_raw)
Expand Down
Loading

0 comments on commit e54fdd6

Please sign in to comment.