Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions dev/update_python_packages.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,9 @@ def install_common_python_packages(python_dist_dir):
"""

if not os.path.exists(python_dist_dir):
print(f"Cannot find Python distribution folder {python_dist_dir}")
print(
f"Missing Python distribution folder {python_dist_dir}. \nCreate folder with requirements.txt to support new Python version."
)
return

with TemporaryDirectory() as temp_dir:
Expand Down Expand Up @@ -304,5 +306,7 @@ def install_qt_packages(python_dist_dir):
f"Python{sys.version_info.major}{sys.version_info.minor}",
)
)
install_common_python_packages(python_dist_dir)
success = install_common_python_packages(python_dist_dir)
if not success:
sys.exit(1)
install_qt_packages(python_dist_dir)
Binary file added dist/Alias/python3.13/2027.1/alias_api_om.pyd
Binary file not shown.
18 changes: 18 additions & 0 deletions dist/Python/Python312/packages/frozen_requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
bidict==0.23.1
certifi==2026.4.22
cffi==2.0.0
charset-normalizer==3.4.7
cryptography==48.0.0
dnspython==2.8.0
eventlet==0.41.0
greenlet==3.5.0
h11==0.16.0
idna==3.13
pycparser==3.0
python-engineio==4.13.1
python-socketio==5.16.1
requests==2.33.1
simple-websocket==1.1.0
urllib3==2.7.0
websocket-client==1.9.0
wsproto==1.3.2
Binary file added dist/Python/Python312/packages/pkgs.zip
Binary file not shown.
15 changes: 15 additions & 0 deletions dist/Python/Python312/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Copyright (c) 2024 Autodesk Inc.
#
# CONFIDENTIAL AND PROPRIETARY
#
# This work is provided "AS IS" and subject to the ShotGrid Pipeline Toolkit
# Source Code License included in this distribution package. See LICENSE.
# By accessing, using, copying or modifying this work you indicate your
# agreement to the ShotGrid Pipeline Toolkit Source Code License. All rights
# not expressly granted therein are reserved by Autodesk Inc.

cryptography
eventlet
python-socketio>=5.14.0
requests
websocket-client
14 changes: 12 additions & 2 deletions python/tk_framework_alias/client/socketio/proxy_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -609,6 +609,11 @@ def _create_object(self):
"""

class_attrs = self._get_attributes()

# Remove __slots__ — proxy classes don't need them, and their presence
# causes ValueError when a class variable shares a name with a slot.
class_attrs.pop("__slots__", None)

return type(self.__class_name, (self.__class__,), class_attrs)


Expand Down Expand Up @@ -773,11 +778,16 @@ def _create_proxy(cls, data):
proxy_module_name = data["__module_name__"]
module = AliasClientObjectProxyWrapper.get_module(proxy_module_name)
if not module:
raise Exception("Module not found")
return None
proxy_type_name = data["__class_name__"]
proxy_type = cls.get_proxy_type(proxy_module_name, proxy_type_name)
if not proxy_type:
lookup_type = getattr(module, proxy_type_name)
lookup_type = getattr(module, proxy_type_name, None)
if lookup_type is None:
# Unknown type (e.g. PyCapsule) — create a bare proxy
proxy_type = type(proxy_type_name, (cls,), {})
cls.store_type(proxy_module_name, proxy_type_name, proxy_type)
return proxy_type(data)
proxy_attributes = lookup_type.__dict__

# Skip any private members, and modify any attributes that conflict
Expand Down
18 changes: 15 additions & 3 deletions python/tk_framework_alias/server/api/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def get_module_path(module_name, alias_version):
return module_path


def get_alias_api_module():
def get_alias_api_module(alias_bin_path=None):
"""
Import the right Alias Python API module according to the criteria:
- the version of Alias
Expand All @@ -68,7 +68,19 @@ def get_alias_api_module():
is_open_model = os.path.basename(sys.executable) != "Alias.exe"
module_name = OPEN_MODEL_API_NAME if is_open_model else OPEN_ALIAS_API_NAME
alias_version = get_alias_version()
module_path = get_module_path(module_name, alias_version)

# First check if Alias ships the Python API module
module_path = None
if alias_bin_path:
alias_api_pyd = f"{module_name}.pyd"
alias_python_module_path = os.path.join(alias_bin_path, alias_api_pyd)
if os.path.exists(alias_python_module_path):
module_path = alias_python_module_path

if not module_path:
# Fallback to the framework's Python API module
module_path = get_module_path(module_name, alias_version)

if not module_path:
return None

Expand Down Expand Up @@ -122,6 +134,6 @@ def get_alias_api_module():
)
alias_dll_path = os.path.dirname(alias_bin_path)
with os.add_dll_directory(alias_dll_path):
alias_api = get_alias_api_module()
alias_api = get_alias_api_module(alias_dll_path)
else:
alias_api = get_alias_api_module()
Original file line number Diff line number Diff line change
Expand Up @@ -109,12 +109,14 @@ def on_connect_error(self, data):

self._log_message(None, f"Client connection failed\n{data}")

def on_disconnect(self, sid):
def on_disconnect(self, sid, reason=None):
"""
A disconnect error event triggered.

:param sid: The session id of the client that triggered the event.
:type sid: str
:param reason: The reason for the disconnect (provided by newer socketio versions).
:type reason: str | None
"""

if self.client_sid is None or sid != self.client_sid:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,12 +140,14 @@ def on_connect_error(self, data):

self._log_message(None, f"Client connection failed\n{data}")

def on_disconnect(self, sid):
def on_disconnect(self, sid, reason=None):
"""
A disconnect error event triggered.

:param sid: The session id of the client that triggered the event.
:type sid: str
:param reason: The reason for the disconnect (provided by newer socketio versions).
:type reason: str | None
"""

if self.client_sid is None or sid != self.client_sid:
Expand Down Expand Up @@ -308,8 +310,13 @@ def on_load_alias_api(
# Check if the cache is up-to-date. If not, create a new cache. Creating
# a new cache is expensive and should only be done if the api or
# extensions have changed
force_rebuild = os.environ.get("TK_ALIAS_REBUILD_API_CACHE", "0") in (
"1",
"true",
)
if (
not os.path.exists(cache_filepath)
force_rebuild
or not os.path.exists(cache_filepath)
or not os.path.exists(cache_module_filepath)
or not filecmp.cmp(api_info["file_path"], cache_module_filepath)
or extensions_updated
Expand Down
Loading