Skip to content

Commit b00099f

Browse files
authored
[SYNPY-1553] Update to support python 3.13 (#1171)
* drop cgi package and update to support python 3.13
1 parent ddf28d9 commit b00099f

File tree

5 files changed

+15
-13
lines changed

5 files changed

+15
-13
lines changed

.github/workflows/build.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ jobs:
3535
- uses: actions/checkout@v4
3636
- uses: actions/setup-python@v5
3737
with:
38-
python-version: '3.12'
38+
python-version: '3.13'
3939
- uses: pre-commit/[email protected]
4040

4141

@@ -49,7 +49,7 @@ jobs:
4949

5050
# if changing the below change the run-integration-tests versions and the check-deploy versions
5151
# Make sure that we are running the integration tests on the first and last versions of the matrix
52-
python: ['3.9', '3.10', '3.11', '3.12']
52+
python: ['3.9', '3.10', '3.11', '3.12', '3.13']
5353

5454
runs-on: ${{ matrix.os }}
5555

@@ -101,7 +101,7 @@ jobs:
101101
pytest -sv --cov-append --cov=. --cov-report xml tests/unit
102102
- name: Check for Secret availability
103103
id: secret-check
104-
if: ${{ contains(fromJSON('["3.9"]'), matrix.python) || contains(fromJSON('["3.12"]'), matrix.python) }}
104+
if: ${{ contains(fromJSON('["3.9"]'), matrix.python) || contains(fromJSON('["3.13"]'), matrix.python) }}
105105
# perform secret check & put boolean result as an output
106106
shell: bash
107107
run: |
@@ -160,7 +160,7 @@ jobs:
160160
shell: bash
161161

162162
# keep versions consistent with the first and last from the strategy matrix
163-
if: ${{ (contains(fromJSON('["3.9"]'), matrix.python) || contains(fromJSON('["3.12"]'), matrix.python)) && steps.secret-check.outputs.secrets_available == 'true'}}
163+
if: ${{ (contains(fromJSON('["3.9"]'), matrix.python) || contains(fromJSON('["3.13"]'), matrix.python)) && steps.secret-check.outputs.secrets_available == 'true'}}
164164
run: |
165165
# decrypt the encrypted test synapse configuration
166166
openssl aes-256-cbc -K ${{ secrets.encrypted_d17283647768_key }} -iv ${{ secrets.encrypted_d17283647768_iv }} -in test.synapseConfig.enc -out test.synapseConfig -d
@@ -207,7 +207,7 @@ jobs:
207207
- name: Upload coverage report
208208
id: upload_coverage_report
209209
uses: actions/upload-artifact@v4
210-
if: ${{ contains(fromJSON('["3.12"]'), matrix.python) && contains(fromJSON('["ubuntu-20.04"]'), matrix.os)}}
210+
if: ${{ contains(fromJSON('["3.13"]'), matrix.python) && contains(fromJSON('["ubuntu-20.04"]'), matrix.os)}}
211211
with:
212212
name: coverage-report
213213
path: coverage.xml
@@ -402,7 +402,7 @@ jobs:
402402
os: [ubuntu-20.04, macos-13, windows-2022]
403403

404404
# python versions should be consistent with the strategy matrix and the runs-integration-tests versions
405-
python: ['3.9', '3.10', '3.11', '3.12']
405+
python: ['3.9', '3.10', '3.11', '3.12', '3.13']
406406

407407
runs-on: ${{ matrix.os }}
408408

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ copied to forks).
9393
#### Installing the Python Client in a virtual environment with pipenv
9494
Perform the following one-time steps to set up your local environment.
9595
96-
1. This package uses Python, if you have not already, please install [pyenv](https://github.com/pyenv/pyenv#installation) to manage your Python versions. Versions supported by this package are all versions >=3.9 and <=3.12. If you do not install `pyenv` make sure that Python and `pip` are installed correctly and have been added to your PATH by running `python3 --version` and `pip3 --version`. If your installation was successful, your terminal will return the versions of Python and `pip` that you installed. **Note**: If you have `pyenv` it will install a specific version of Python for you.
96+
1. This package uses Python, if you have not already, please install [pyenv](https://github.com/pyenv/pyenv#installation) to manage your Python versions. Versions supported by this package are all versions >=3.9 and <=3.13. If you do not install `pyenv` make sure that Python and `pip` are installed correctly and have been added to your PATH by running `python3 --version` and `pip3 --version`. If your installation was successful, your terminal will return the versions of Python and `pip` that you installed. **Note**: If you have `pyenv` it will install a specific version of Python for you.
9797
9898
2. Install `pipenv` by running `pip install pipenv`.
9999
- If you already have `pipenv` installed, ensure that the version is >=2023.9.8 to avoid compatibility issues.

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ Python Synapse Client
22
=====================
33

44
Branch | Build Status
5-
--------|-------------
5+
--------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
66
develop | [![Build Status develop branch](https://github.com/Sage-Bionetworks/synapsePythonClient/workflows/build/badge.svg?branch=develop)](https://github.com/Sage-Bionetworks/synapsePythonClient/actions?query=branch%3Adevelop)
77
master | [![Build Status master branch](https://github.com/Sage-Bionetworks/synapsePythonClient/workflows/build/badge.svg?branch=master)](https://github.com/Sage-Bionetworks/synapsePythonClient/actions?query=branch%3Amaster)
88

@@ -36,7 +36,7 @@ or by sending an email to [[email protected]](mailto:python
3636
Installation
3737
------------
3838

39-
The Python Synapse client has been tested on versions 3.9, 3.10, 3.11 and 3.12 on Mac OS X, Ubuntu Linux and Windows.
39+
The Python Synapse client has been tested on versions 3.9, 3.10, 3.11, 3.12 and 3.13 on Mac OS X, Ubuntu Linux and Windows.
4040

4141
**Starting from Synapse Python client version 3.0, Synapse Python client requires Python >= 3.9**
4242

setup.cfg

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ classifiers =
2727
Programming Language :: Python :: 3.10
2828
Programming Language :: Python :: 3.11
2929
Programming Language :: Python :: 3.12
30+
Programming Language :: Python :: 3.13
3031
Operating System :: MacOS
3132
Operating System :: Microsoft :: Windows
3233
Operating System :: Unix
@@ -42,7 +43,7 @@ classifiers =
4243
zip_safe = False
4344
include_package_data = True
4445
packages = find:
45-
python_requires = >=3.9, <3.13
46+
python_requires = >=3.9, <3.14
4647
install_requires =
4748
# "requests>=2.22.0,<2.30.0; python_version<'3.10'",
4849
requests>=2.22.0,<3.0

synapseclient/core/utils.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
"""
44

55
import base64
6-
import cgi
76
import collections.abc
87
import datetime
98
import errno
@@ -26,6 +25,7 @@
2625
import warnings
2726
import zipfile
2827
from dataclasses import asdict, is_dataclass
28+
from email.message import Message
2929
from typing import TYPE_CHECKING, TypeVar
3030

3131
import requests
@@ -173,8 +173,9 @@ def extract_filename(content_disposition_header, default_filename=None):
173173

174174
if not content_disposition_header:
175175
return default_filename
176-
value, params = cgi.parse_header(content_disposition_header)
177-
return params.get("filename", default_filename)
176+
message = Message()
177+
message.add_header("content-disposition", content_disposition_header)
178+
return message.get_filename(failobj=default_filename)
178179

179180

180181
def extract_user_name(profile):

0 commit comments

Comments
 (0)