Skip to content

Commit d77ecc3

Browse files
committed
feat!: update bounds to match security updates
This does mean that python 2.7 support is dropped. As well as python 3.7 and bellow. However, they were dropped before this. These changes fully reflect that in the setup.py file
1 parent 6828852 commit d77ecc3

File tree

11 files changed

+35
-94
lines changed

11 files changed

+35
-94
lines changed

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ We welcome direct contributions to the sendgrid-python code base. Thank you!
2424

2525
#### Prerequisites
2626

27-
- Python version 2.7, 3.5, 3.6, 3.7, or 3.8
27+
- Python version 3.8+
2828
- [python_http_client](https://github.com/sendgrid/python-http-client)
2929
- [cryptography](https://github.com/pyca/cryptography)
3030
- [pyenv](https://github.com/yyuu/pyenv)

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
.PHONY: venv install test-install test test-integ test-docker clean nopyc
22

33
venv: clean
4-
@python --version || (echo "Python is not installed, please install Python 2 or Python 3"; exit 1);
4+
@python --version || (echo "Python is not installed, please install Python 3"; exit 1);
55
pip install virtualenv
66
virtualenv --python=python venv
77

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ Please browse the rest of this README for further detail.
3737

3838
## Prerequisites
3939

40-
- Python version 2.7+
40+
- Python version 3.8+
4141
- The SendGrid service, starting at the [free level](https://sendgrid.com/free?source=sendgrid-python)
4242

4343
## Setup Environment Variables

README.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ Installation
4343
Prerequisites
4444
-------------
4545

46-
- Python version 2.7 and 3.5+
46+
- Python version 3.8+
4747
- For email, you will need a Twilio SendGrid account, starting at the `free level`_
4848
- For SMS messages, you will need a free `Twilio account`_
4949

TROUBLESHOOTING.md

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -37,17 +37,6 @@ In the first case, SENDGRID_API_KEY is in reference to the name of the environme
3737

3838
HTTP exceptions are defined in the [`python_http_client` package](https://github.com/sendgrid/python-http-client/blob/HEAD/python_http_client/exceptions.py).
3939

40-
To read the error message returned by SendGrid's API in Python 2.X:
41-
42-
```python
43-
from python_http_client.exceptions import HTTPError
44-
45-
try:
46-
response = sg.client.mail.send.post(request_body=mail.get())
47-
except HTTPError as e:
48-
print e.to_dict
49-
```
50-
5140
To read the error message returned by Twilio SendGrid's API in Python 3.X:
5241

5342
```python

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@ Flask==3.1.0
22
PyYAML>=4.2b1
33
python-http-client>=3.2.1
44
six==1.17.0
5-
cryptography>=45.0.6
5+
cryptography>=44.0.1
66
more-itertools==5.0.0

setup.py

Lines changed: 25 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,54 +1,48 @@
11
import io
22
import os
3-
from setuptools import setup, find_packages
43

4+
from setuptools import find_packages, setup
55

66
__version__ = None
7-
with open('sendgrid/version.py') as f:
7+
with open("sendgrid/version.py") as f:
88
exec(f.read())
99

10+
1011
def getRequires():
1112
deps = [
12-
'python_http_client>=3.2.1',
13-
'cryptography>=45.0.6',
14-
"werkzeug>=0.11.15,<1.0.0 ; python_version < '3.0'",
15-
"werkzeug>=0.15.0,<2.0.0 ; python_version >= '3.0' and python_version < '3.7'",
16-
"werkzeug>=0.15.0,<2.3.0 ; python_version >= '3.0' and python_version < '3.8'", # version 2.3.0 dropped support for Python 3.7
17-
"werkzeug>=0.16.0,<3.1.0 ; python_version >= '3.0' and python_version < '3.9'", # version 3.1.0 dropped support for Python 3.8
18-
"werkzeug>=1.0.0 ; python_version >= '3.9'",
19-
"werkzeug>=2.2.0 ; python_version >= '3.11'",
20-
"werkzeug>=2.3.5 ; python_version >= '3.12'"
13+
"python_http_client>=3.2.1",
14+
"cryptography>=44.0.1",
15+
"werkzeug==3.0.6 ; python_version == '3.8'", # version 3.1.0 dropped support for Python 3.8
16+
"werkzeug>=3.0.6 ; python_version >= '3.9'",
17+
"werkzeug>=3.0.6 ; python_version >= '3.11'",
18+
"werkzeug>=3.0.6 ; python_version >= '3.12'",
2119
]
2220
return deps
2321

2422

2523
dir_path = os.path.abspath(os.path.dirname(__file__))
26-
readme = io.open(os.path.join(dir_path, 'README.rst'), encoding='utf-8').read()
24+
readme = io.open(os.path.join(dir_path, "README.rst"), encoding="utf-8").read()
2725

2826
setup(
29-
name='sendgrid',
27+
name="sendgrid",
3028
version=str(__version__),
31-
author='Elmer Thomas, Yamil Asusta',
32-
author_email='[email protected]',
33-
url='https://github.com/sendgrid/sendgrid-python/',
29+
author="Elmer Thomas, Yamil Asusta",
30+
author_email="[email protected]",
31+
url="https://github.com/sendgrid/sendgrid-python/",
3432
packages=find_packages(exclude=["temp*.py", "test"]),
3533
include_package_data=True,
36-
license='MIT',
37-
description='Twilio SendGrid library for Python',
34+
license="MIT",
35+
description="Twilio SendGrid library for Python",
3836
long_description=readme,
3937
install_requires=getRequires(),
40-
python_requires='>=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*',
38+
python_requires=">=3.8",
4139
classifiers=[
42-
'Programming Language :: Python :: 2.7',
43-
'Programming Language :: Python :: 3',
44-
'Programming Language :: Python :: 3.5',
45-
'Programming Language :: Python :: 3.6',
46-
'Programming Language :: Python :: 3.7',
47-
'Programming Language :: Python :: 3.8',
48-
'Programming Language :: Python :: 3.9',
49-
'Programming Language :: Python :: 3.10',
50-
'Programming Language :: Python :: 3.11',
51-
'Programming Language :: Python :: 3.12',
52-
'Programming Language :: Python :: 3.13',
53-
]
40+
"Programming Language :: Python :: 3",
41+
"Programming Language :: Python :: 3.8",
42+
"Programming Language :: Python :: 3.9",
43+
"Programming Language :: Python :: 3.10",
44+
"Programming Language :: Python :: 3.11",
45+
"Programming Language :: Python :: 3.12",
46+
"Programming Language :: Python :: 3.13",
47+
],
5448
)

tox.ini

Lines changed: 1 addition & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# and then run "tox" from this directory.
55

66
[tox]
7-
envlist = py27, py34, py35, py36, py37, py38, py39, py310, py311, py312, py313
7+
envlist = py38, py39, py310, py311, py312, py313
88

99
[testenv]
1010
commands = coverage erase
@@ -14,32 +14,6 @@ deps = -rrequirements.txt
1414
coverage
1515

1616

17-
[testenv:py27]
18-
commands = {[testenv]commands}
19-
deps = {[testenv]deps}
20-
mock
21-
basepython = python2.7
22-
23-
[testenv:py34]
24-
commands = {[testenv]commands}
25-
deps = {[testenv]deps}
26-
basepython = python3.4
27-
28-
[testenv:py35]
29-
commands = {[testenv]commands}
30-
deps = {[testenv]deps}
31-
basepython = python3.5
32-
33-
[testenv:py36]
34-
commands = {[testenv]commands}
35-
deps = {[testenv]deps}
36-
basepython = python3.6
37-
38-
[testenv:py37]
39-
commands = {[testenv]commands}
40-
deps = {[testenv]deps}
41-
basepython = python3.7
42-
4317
[testenv:py38]
4418
commands = {[testenv]commands}
4519
deps = {[testenv]deps}

use_cases/aws.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ The neat thing is that CodeStar provides all of this in a pre-configured package
99
Once this tutorial is complete, you'll have a basic web service for sending email that can be invoked via a link to your newly created API endpoint.
1010

1111
### Prerequisites
12-
Python 2.7 and 3.4 or 3.5 are supported by the sendgrid Python library, however, I was able to utilize 3.6 with no issue.
1312

1413
Before starting this tutorial, you will need to have access to an AWS account in which you are allowed to provision resources. This tutorial also assumes you've already created a Twilio SendGrid account with free-tier access. Finally, it is highly recommended you utilize [virtualenv](https://virtualenv.pypa.io/en/stable/).
1514

@@ -77,7 +76,7 @@ Resources:
7776
Type: AWS::Serverless::Function
7877
Properties:
7978
Handler: index.handler
80-
Runtime: python3.6
79+
Runtime: python3.9
8180
Role:
8281
Fn::ImportValue:
8382
!Join ['-', [!Ref 'ProjectId', !Ref 'AWS::Region', 'LambdaTrustRole']]

use_cases/legacy_templates.md

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,7 @@ I hope you are having a great day in -city- :)
4040
import sendgrid
4141
import os
4242
from sendgrid.helpers.mail import Email, Content, Substitution, Mail
43-
try:
44-
# Python 3
45-
import urllib.request as urllib
46-
except ImportError:
47-
# Python 2
48-
import urllib2 as urllib
43+
import urllib.request as urllib
4944

5045
sg = sendgrid.SendGridAPIClient(os.environ.get('SENDGRID_API_KEY'))
5146
from_email = Email("[email protected]")
@@ -71,12 +66,7 @@ print(response.headers)
7166
```python
7267
import sendgrid
7368
import os
74-
try:
75-
# Python 3
76-
import urllib.request as urllib
77-
except ImportError:
78-
# Python 2
79-
import urllib2 as urllib
69+
import urllib.request as urllib
8070

8171
sg = sendgrid.SendGridAPIClient(os.environ.get('SENDGRID_API_KEY'))
8272
data = {

0 commit comments

Comments
 (0)