Skip to content

Commit 9aa7e33

Browse files
authored
CI & deps: add Python 3.11–3.13, support urllib3 <3 (incl. v2) (#72)
1 parent cc951b2 commit 9aa7e33

File tree

10 files changed

+170
-93
lines changed

10 files changed

+170
-93
lines changed

.github/workflows/publish.yml

Lines changed: 30 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,23 +5,46 @@ on:
55
types: [published]
66

77
jobs:
8-
deploy:
9-
runs-on: ubuntu-20.04
8+
build:
9+
runs-on: ubuntu-22.04
1010
strategy:
11-
matrix:
12-
python: [3.7, 3.8, 3.9, '3.10']
11+
matrix:
12+
python: [3.7, 3.8, 3.9, '3.10', '3.11', '3.12']
13+
urllib3-line: ["lt2", "ge2"]
14+
exclude:
15+
- python: "3.7"
16+
urllib3-line: "ge2"
17+
- python: "3.8"
18+
urllib3-line: "ge2"
1319
steps:
14-
- uses: actions/checkout@v1
15-
- name: Set up Python
16-
uses: actions/setup-python@v1
20+
- uses: actions/checkout@v5
21+
- name: Setup Python
22+
uses: actions/setup-python@v5
1723
with:
1824
python-version: ${{ matrix.python }}
25+
- name: Install deps
26+
run: |
27+
pip install -r requirements/requirements.txt
28+
if [ "${{ matrix.urllib3-line }}" = "lt2" ]; then
29+
pip install "urllib3<2"
30+
else
31+
pip install "urllib3!=2.0.0,<3"
32+
fi
33+
pip install -e .
1934
- name: Install Tox and any other packages
2035
run: |
2136
python -m pip install --upgrade pip
2237
pip install -r requirements/test.txt
2338
- name: Run Tox
2439
run: tox -e py
40+
release:
41+
runs-on: ubuntu-22.04
42+
steps:
43+
- uses: actions/checkout@v5
44+
- name: Setup Python
45+
uses: actions/setup-python@v5
46+
with:
47+
python-version: 3.12
2548
- name: Install build dependencies
2649
run: |
2750
pip install setuptools wheel twine

.github/workflows/test.yml

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,32 @@ on: [push, pull_request]
44

55
jobs:
66
build:
7-
runs-on: ubuntu-20.04
7+
runs-on: ubuntu-22.04
88
strategy:
9+
fail-fast: false
910
matrix:
10-
python: [3.7, 3.8, 3.9, '3.10']
11+
python: [3.7, 3.8, 3.9, '3.10', '3.11', '3.12', '3.13']
12+
urllib3-line: ["lt2", "ge2"]
13+
exclude:
14+
- python: "3.7"
15+
urllib3-line: "ge2"
16+
- python: "3.8"
17+
urllib3-line: "ge2"
1118
steps:
12-
- uses: actions/checkout@v1
19+
- uses: actions/checkout@v5
1320
- name: Setup Python
14-
uses: actions/setup-python@v1
21+
uses: actions/setup-python@v5
1522
with:
1623
python-version: ${{ matrix.python }}
17-
- name: Install Tox and any other packages
18-
run: pip install -r requirements/test.txt
24+
- name: Install deps
25+
run: |
26+
pip install -r requirements/test.txt
27+
if [ "${{ matrix.urllib3-line }}" = "lt2" ]; then
28+
pip install "urllib3<2"
29+
else
30+
pip install "urllib3!=2.0.0,<3"
31+
fi
32+
pip install -e .
1933
- name: Run Tox
2034
run: tox -e py
2135
- name: Upload Coverage to codecov

requirements/requirements.txt

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1-
requests>=2.22.0
2-
requests_toolbelt==0.10.1
3-
urllib3==1.26.*
1+
requests_toolbelt>=1.0.0
2+
3+
urllib3<3; python_version >= "3.9"
4+
urllib3!=2.0.0,<3; python_version < "3.9"
5+
6+
requests>=2.32.2; python_version >= "3.9"
7+
requests>=2.22.0,<2.32; python_version >= "3.7" and python_version < "3.9"
8+
requests>=2.22.0,<2.28; python_version < "3.7"

requirements/test.txt

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,23 @@
1-
requests>=2.22.0
2-
black==19.10b0
3-
coverage==4.5.4
4-
tox==3.14.2
5-
responses==0.17.0
6-
requests_toolbelt==0.10.1
7-
urllib3==1.26.*
1+
requests_toolbelt>=1.0.0
2+
urllib3<3; python_version >= "3.9"
3+
urllib3!=2.0.0,<3; python_version < "3.9"
4+
5+
requests>=2.32.2; python_version >= "3.9"
6+
requests>=2.22.0,<2.32; python_version >= "3.7" and python_version < "3.9"
7+
requests>=2.22.0,<2.28; python_version < "3.7"
8+
9+
coverage>=7.6.0; python_version >= "3.13"
10+
coverage>=7.5.0; python_version >= "3.9" and python_version < "3.13"
11+
coverage>=5.0,<7.0; python_version >= "3.7" and python_version < "3.9"
12+
coverage==4.5.4; python_version < "3.7"
13+
14+
responses>=0.25.0; python_version >= "3.8"
15+
responses>=0.18.0,<0.25; python_version >= "3.7" and python_version < "3.8"
16+
responses<0.18.0; python_version < "3.7"
17+
18+
black>=24.8.0; python_version >= "3.8"
19+
black==19.10b0; python_version < "3.8"
20+
21+
tox>=4; python_version >= "3.13"
22+
tox==3.14.2; python_version < "3.13"
23+

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
setuptools.setup(
1010
name="imagekitio",
11-
version="4.1.0",
11+
version="4.2.0",
1212
description="Python wrapper for the ImageKit API",
1313
long_description=long_description,
1414
long_description_content_type="text/markdown",

tests/test_custom_metadata_fields_ops.py

Lines changed: 24 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ def test_get_custom_metadata_fields_succeeds(self):
6262
responses.add(
6363
responses.GET,
6464
url,
65+
content_type="application/json",
6566
body="""[{
6667
"id": "62a9d5f6db485107347bb7f2",
6768
"name": "test10",
@@ -115,7 +116,7 @@ def test_get_custom_metadata_fields_succeeds(self):
115116
],
116117
"httpStatusCode": 200,
117118
"headers": {
118-
"Content-Type": "text/plain",
119+
"Content-Type": "application/json",
119120
"Accept-Encoding": "gzip, deflate",
120121
"Authorization": "Basic ZmFrZTEyMjo=",
121122
},
@@ -303,7 +304,7 @@ def test_delete_custom_metadata_fields_succeeds(self):
303304
URL.API_BASE_URL = "http://test.com"
304305
url = "{}/v1/customMetadataFields/{}".format(URL.API_BASE_URL, self.field_id)
305306
headers = create_headers_for_test()
306-
responses.add(responses.DELETE, url, status=204, headers=headers, body="{}")
307+
responses.add(responses.DELETE, url, status=204, headers=headers)
307308
resp = self.client.delete_custom_metadata_field(self.field_id)
308309

309310
mock_response_metadata = {
@@ -385,13 +386,14 @@ def test_create_custom_metadata_fields_succeeds_with_type_number(self):
385386
"""
386387
URL.API_BASE_URL = "http://test.com"
387388
url = "{}/v1/customMetadataFields".format(URL.API_BASE_URL)
388-
headers = {"Content-Type": "application/json"}
389+
headers = {}
389390
headers.update(create_headers_for_test())
390391
responses.add(
391392
responses.POST,
392393
url,
393394
status=201,
394395
headers=headers,
396+
content_type="application/json",
395397
body="""{
396398
"id": "62dfc03b1b02a58936efca37",
397399
"name": "test",
@@ -422,7 +424,7 @@ def test_create_custom_metadata_fields_succeeds_with_type_number(self):
422424
},
423425
"httpStatusCode": 201,
424426
"headers": {
425-
"Content-Type": "text/plain, application/json",
427+
"Content-Type": "application/json",
426428
"Accept-Encoding": "gzip, deflate",
427429
"Authorization": "Basic ZmFrZTEyMjo=",
428430
},
@@ -457,13 +459,14 @@ def test_create_custom_metadata_fields_succeeds_with_type_textarea(self):
457459
"""
458460
URL.API_BASE_URL = "http://test.com"
459461
url = "{}/v1/customMetadataFields".format(URL.API_BASE_URL)
460-
headers = {"Content-Type": "application/json"}
462+
headers = {}
461463
headers.update(create_headers_for_test())
462464
responses.add(
463465
responses.POST,
464466
url,
465467
status=201,
466468
headers=headers,
469+
content_type="application/json",
467470
body="""{
468471
"id": "62e0d7ae1b02a589360dc1fd",
469472
"name": "test",
@@ -493,7 +496,7 @@ def test_create_custom_metadata_fields_succeeds_with_type_textarea(self):
493496

494497
mock_response_metadata = {
495498
"headers": {
496-
"Content-Type": "text/plain, application/json",
499+
"Content-Type": "application/json",
497500
"Accept-Encoding": "gzip, deflate",
498501
"Authorization": "Basic ZmFrZTEyMjo=",
499502
},
@@ -543,13 +546,14 @@ def test_create_custom_metadata_fields_succeeds_with_type_date(self):
543546
"""
544547
URL.API_BASE_URL = "http://test.com"
545548
url = "{}/v1/customMetadataFields".format(URL.API_BASE_URL)
546-
headers = {"Content-Type": "application/json"}
549+
headers = {}
547550
headers.update(create_headers_for_test())
548551
responses.add(
549552
responses.POST,
550553
url,
551554
status=201,
552555
headers=headers,
556+
content_type="application/json",
553557
body="""{
554558
"id": "62dfc9f41b02a58936f0d284",
555559
"name": "test-date",
@@ -575,7 +579,7 @@ def test_create_custom_metadata_fields_succeeds_with_type_date(self):
575579

576580
mock_response_metadata = {
577581
"headers": {
578-
"Content-Type": "text/plain, application/json",
582+
"Content-Type": "application/json",
579583
"Accept-Encoding": "gzip, deflate",
580584
"Authorization": "Basic ZmFrZTEyMjo=",
581585
},
@@ -621,13 +625,14 @@ def test_create_custom_metadata_fields_succeeds_with_type_boolean(self):
621625
"""
622626
URL.API_BASE_URL = "http://test.com"
623627
url = "{}/v1/customMetadataFields".format(URL.API_BASE_URL)
624-
headers = {"Content-Type": "application/json"}
628+
headers = {}
625629
headers.update(create_headers_for_test())
626630
responses.add(
627631
responses.POST,
628632
url,
629633
status=201,
630634
headers=headers,
635+
content_type="application/json",
631636
body="""{
632637
"id": "62dfcb801b02a58936f0fc39",
633638
"name": "test-boolean",
@@ -653,7 +658,7 @@ def test_create_custom_metadata_fields_succeeds_with_type_boolean(self):
653658

654659
mock_response_metadata = {
655660
"headers": {
656-
"Content-Type": "text/plain, application/json",
661+
"Content-Type": "application/json",
657662
"Accept-Encoding": "gzip, deflate",
658663
"Authorization": "Basic ZmFrZTEyMjo=",
659664
},
@@ -699,13 +704,14 @@ def test_create_custom_metadata_fields_succeeds_with_type_single_select(self):
699704
"""
700705
URL.API_BASE_URL = "http://test.com"
701706
url = "{}/v1/customMetadataFields".format(URL.API_BASE_URL)
702-
headers = {"Content-Type": "application/json"}
707+
headers = {}
703708
headers.update(create_headers_for_test())
704709
responses.add(
705710
responses.POST,
706711
url,
707712
status=201,
708713
headers=headers,
714+
content_type="application/json",
709715
body="""{
710716
"id": "62dfcdb21b02a58936f14c97",
711717
"name": "test",
@@ -729,7 +735,7 @@ def test_create_custom_metadata_fields_succeeds_with_type_single_select(self):
729735

730736
mock_response_metadata = {
731737
"headers": {
732-
"Content-Type": "text/plain, application/json",
738+
"Content-Type": "application/json",
733739
"Accept-Encoding": "gzip, deflate",
734740
"Authorization": "Basic ZmFrZTEyMjo=",
735741
},
@@ -775,13 +781,14 @@ def test_create_custom_metadata_fields_succeeds_with_type_multi_select(self):
775781
"""
776782
URL.API_BASE_URL = "http://test.com"
777783
url = "{}/v1/customMetadataFields".format(URL.API_BASE_URL)
778-
headers = {"Content-Type": "application/json"}
784+
headers = {}
779785
headers.update(create_headers_for_test())
780786
responses.add(
781787
responses.POST,
782788
url,
783789
status=201,
784790
headers=headers,
791+
content_type="application/json",
785792
body="""{
786793
"id": "62dfcf001b02a58936f17808",
787794
"name": "test",
@@ -809,7 +816,7 @@ def test_create_custom_metadata_fields_succeeds_with_type_multi_select(self):
809816

810817
mock_response_metadata = {
811818
"headers": {
812-
"Content-Type": "text/plain, application/json",
819+
"Content-Type": "application/json",
813820
"Accept-Encoding": "gzip, deflate",
814821
"Authorization": "Basic ZmFrZTEyMjo=",
815822
},
@@ -857,12 +864,13 @@ def test_update_custom_metadata_fields_succeeds(self):
857864
"""
858865
URL.API_BASE_URL = "http://test.com"
859866
url = "{}/v1/customMetadataFields/{}".format(URL.API_BASE_URL, self.field_id)
860-
headers = {"Content-Type": "application/json"}
867+
headers = {}
861868
headers.update(create_headers_for_test())
862869
responses.add(
863870
responses.PATCH,
864871
url,
865872
headers=headers,
873+
content_type="application/json",
866874
body="""{
867875
"id": "62a9d5f6db485107347bb7f2",
868876
"name": "test",
@@ -892,7 +900,7 @@ def test_update_custom_metadata_fields_succeeds(self):
892900
},
893901
"httpStatusCode": 200,
894902
"headers": {
895-
"Content-Type": "text/plain, application/json",
903+
"Content-Type": "application/json",
896904
"Accept-Encoding": "gzip, deflate",
897905
"Authorization": "Basic ZmFrZTEyMjo=",
898906
},

0 commit comments

Comments
 (0)