Skip to content

Commit a5c32bc

Browse files
julien-langCopilot
andauthored
SG-41624 Add support for Python 3.13 (#433)
--------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent 13be391 commit a5c32bc

8 files changed

Lines changed: 13 additions & 28 deletions

File tree

README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
[![Supported VFX Platform: 2022 - 2025](https://img.shields.io/badge/VFX_Platform-2022_|_2023_|_2024_|_2025-blue)](http://www.vfxplatform.com/ "Supported VFX Platform")
2-
[![Supported Python versions: 3.9 - 3.11](https://img.shields.io/badge/Python-3.9_|_3.10_|_3.11-blue?logo=python&logoColor=f5f5f5)](https://www.python.org/ "Supported Python versions")
1+
[![Supported Python versions: 3.9, 3.10, 3.11, 3.13](https://img.shields.io/badge/Python-3.9_|_3.10_|_3.11_|_3.13-blue?logo=python&logoColor=f5f5f5)](https://www.python.org/ "Supported Python versions")
32
[![Reference Documentation](http://img.shields.io/badge/Reference-documentation-blue.svg?logo=wikibooks&logoColor=f5f5f5)](http://developer.shotgridsoftware.com/python-api)
43

54
[![Build Status](https://dev.azure.com/shotgun-ecosystem/Python%20API/_apis/build/status/shotgunsoftware.python-api?branchName=master)](https://dev.azure.com/shotgun-ecosystem/Python%20API/_build/latest?definitionId=108&branchName=master)

azure-pipelines.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ parameters:
6565
- '3.9'
6666
- '3.10'
6767
- '3.11'
68+
- '3.13'
6869

6970
- name: os_versions
7071
type: object

docs/installation.rst

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@ Minimum Requirements
1616
Python versions
1717
===============
1818

19-
The Python API library supports the following Python versions: `3.9 - 3.11`. We recommend using Python 3.11.
19+
The Python API library supports the following Python versions: `3.9`, `3.10`,
20+
`3.11`, and `3.13`.
21+
We recommend using Python 3.13.
2022

2123
.. important::
2224
Python versions older than 3.9 are no longer supported as of March 2025 and compatibility will be discontinued after
@@ -68,4 +70,4 @@ If you're using pip with `requirements.txt`, add the following line::
6870
Installing with ``setup.py``
6971
****************************
7072

71-
From a local copy of the repository, you can run ``python setup.py install`` to copy the package inside your python ``site-packages``. Note that while ``setuptools`` will complain about syntax errors when installing the library, the library is fully functional. However, it ships with both Python 2 and Python 3 copies of ``httplib2``, which will generate syntax errors when byte-compiling the Python modules.
73+
From a local copy of the repository, you can run ``python setup.py install`` to copy the package inside your python ``site-packages``. Note that while ``setuptools`` will complain about syntax errors when installing the library, the library is fully functional.

setup.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
"Programming Language :: Python :: 3.10",
4242
"Programming Language :: Python :: 3.11",
4343
"Programming Language :: Python :: 3.12",
44+
"Programming Language :: Python :: 3.13",
4445
"Operating System :: OS Independent",
4546
],
4647
)

shotgun_api3/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
warnings.warn(
3737
"Python versions older than 3.9 are no longer supported as of March "
3838
"2025 and compatibility will be discontinued after March 2026. "
39-
"Please update to Python 3.11 or any other supported version.",
39+
"Please update to Python 3.13 or any other supported version.",
4040
DeprecationWarning,
4141
stacklevel=2,
4242
)

shotgun_api3/lib/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Some third-party modules are bundled with `python-api` inside lib.
66

77
### httplib2
88

9-
`httplib2` is used to make http connections to the Flow Production Tracking server. We bundle both python2 and python3 compatible versions since httplib2 chose to maintain parallel versions of the module for python 2 and 3 compatibility.
9+
`httplib2` is used to make http connections to the Flow Production Tracking server.
1010

1111
The version of `httplib2` bundled should be updated manually, however its version is included in the unused `shotgun_api3/lib/requirements.txt` to allow Github's automated CVE notifications to work.
1212

shotgun_api3/shotgun.py

Lines changed: 4 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
3030
"""
3131

32-
from __future__ import annotations # Requried for 3.7
32+
from __future__ import annotations # Required for compatibility with Python 3.7
3333

3434
import base64
3535
import copy
@@ -3162,29 +3162,17 @@ def authenticate_human_user(
31623162
self.config.auth_token = auth_token
31633163

31643164
try:
3165-
data = self.find_one(
3165+
return self.find_one(
31663166
"HumanUser",
31673167
[["sg_status_list", "is", "act"], ["login", "is", user_login]],
31683168
["id", "login"],
31693169
"",
31703170
"all",
31713171
)
3172-
# Set back to default - There finally and except cannot be used together in python2.4
3173-
self.config.user_login = original_login
3174-
self.config.user_password = original_password
3175-
self.config.auth_token = original_auth_token
3176-
return data
3177-
except Fault:
3178-
# Set back to default - There finally and except cannot be used together in python2.4
3179-
self.config.user_login = original_login
3180-
self.config.user_password = original_password
3181-
self.config.auth_token = original_auth_token
3182-
except Exception:
3183-
# Set back to default - There finally and except cannot be used together in python2.4
3172+
finally:
31843173
self.config.user_login = original_login
31853174
self.config.user_password = original_password
31863175
self.config.auth_token = original_auth_token
3187-
raise
31883176

31893177
def update_project_last_accessed(
31903178
self, project: Dict[str, Any], user: Optional[Dict[str, Any]] = None
@@ -4191,10 +4179,7 @@ def _inbound_visitor(value):
41914179
if isinstance(value, str):
41924180
if len(value) == 20 and self._DATE_TIME_PATTERN.match(value):
41934181
try:
4194-
# strptime was not on datetime in python2.4
4195-
value = datetime.datetime(
4196-
*time.strptime(value, "%Y-%m-%dT%H:%M:%SZ")[:6]
4197-
)
4182+
value = datetime.datetime.strptime(value, "%Y-%m-%dT%H:%M:%SZ")
41984183
except ValueError:
41994184
return value
42004185
if _change_tz:

tests/ci_requirements.txt

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,6 @@
1010

1111
coverage
1212
coveralls==1.1
13-
# Don't restrict flake8 version, since we install this in CI against Python 2.6,
14-
# where flake8 has discontinued support for newer releases. On Python 2.7 and
15-
# Python 3.7, linting has been performed with flake8 3.7.8
1613
flake8
1714
nose==1.3.7
1815
nose-exclude==0.5.0

0 commit comments

Comments
 (0)