Skip to content

Commit

Permalink
Merge pull request #173 from slimta/drop-py2
Browse files Browse the repository at this point in the history
Drop support for Python 2
  • Loading branch information
icgood authored Feb 2, 2022
2 parents 768c349 + 5c349fa commit ecfb6d2
Show file tree
Hide file tree
Showing 76 changed files with 209 additions and 1,229 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
14 changes: 13 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,18 @@

# Change Log

## 4.1 - _Unreleased_
## 5.0 - Change Logs have moved to [Releases][18]

## 4.2 - 2021-02-14

- New `handle_tls2(ssl_socket)` validator on [`SmtpValidators`][16].
- Switch to [`select.poll()`][17] for DNS lookups.

## 4.1 - 2020-10-29

### Added

- [**Extension Consolidation**][15].
- New [`create_listeners`][10] function for creating IP sockets on both IPv4
and IPv6, if available.
- New `mixin` functions in the [`proxyproto`][12] classes.
Expand Down Expand Up @@ -152,6 +160,10 @@
[12]: http://slimta.org/en/latest/api/slimta.util.proxyproto.html
[13]: http://slimta.org/en/latest/api/slimta.relay.smtp.static.html#slimta.relay.smtp.static.StaticLmtpRelay
[14]: http://slimta.org/en/latest/api/slimta.relay.pipe.html
[15]: https://www.slimta.org/blog/2020-10-30.html
[16]: https://www.slimta.org/api/slimta.edge.smtp.html#slimta.edge.smtp.SmtpValidators
[17]: https://docs.python.org/3/library/select.html#select.poll
[18]: https://github.com/slimta/python-slimta/releases
[3.0]: https://github.com/slimta/python-slimta/issues?q=milestone%3A3.0
[3.1]: https://github.com/slimta/python-slimta/issues?q=milestone%3A3.1
[3.2]: https://github.com/slimta/python-slimta/issues?q=milestone%3A3.2
Expand Down
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,12 @@ can incorporate any protocol or policy, custom or built-in. An MTA built with
Python's great community.

The `python-slimta` project is released under the [MIT License][4]. It is
tested for Python 2.7+ or 3.6+.
tested for Python 3.6+.

[![build](https://github.com/slimta/python-slimta/actions/workflows/python-package.yml/badge.svg)](https://github.com/slimta/python-slimta/actions/workflows/python-package.yml)
[![PyPI](https://img.shields.io/pypi/v/python-slimta.svg)](https://pypi.python.org/pypi/python-slimta)
[![PyPI](https://img.shields.io/pypi/pyversions/python-slimta.svg)](https://pypi.python.org/pypi/python-slimta)
[![PyPI](https://img.shields.io/pypi/l/python-slimta.svg)](https://pypi.python.org/pypi/python-slimta)
[![Flattr](http://api.flattr.com/button/flattr-badge-large.png)](https://flattr.com/submit/auto?user_id=icgood&url=https%3A%2F%2Fgithub.com%2Fslimta%2Fpython-slimta&title=python-slimta&language=python&tags=github&category=software)


Getting Started
Expand Down
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 ecfb6d2

Please sign in to comment.