Skip to content

Commit 36ce152

Browse files
julien-langCopilot
andauthored
SG-42549 Refactor requirements management (#344)
* SG-42118 Consolidate per-version requirements into a single file - Replace resources/python/requirements/{version}/requirements.txt (5 files) with a single resources/python/requirements.txt using PEP 508 env markers - All version-specific pinning preserved via python_version conditions - Package versions are unchanged from master - Update update_requirements.py to use the new single path - Add .github/dependabot.yml scoping pip scanning to src/ and bin/ only, excluding requirements.txt (template file, not installed directly) * SG-42118 Improve requirements.txt documentation and CVE annotations * SG-42118 Add azure-pipelines/requirements.txt and update CI dependency references * SG-42118 Exhaustive CVE history annotations in requirements.txt * SG-42118 Add CVE-2020-35678 (autobahn) and CVE-2020-25659 (cryptography) annotations * SG-42118 Fix operator and marker for sub-level dependencies --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent f266e49 commit 36ce152

11 files changed

Lines changed: 155 additions & 132 deletions

File tree

.snyk

Lines changed: 0 additions & 16 deletions
This file was deleted.

.travis.yml.disabled

Lines changed: 0 additions & 15 deletions
This file was deleted.

azure-pipelines.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,11 @@ jobs:
3535
- name: tk-framework-desktopclient
3636
- name: tk-shotgun
3737
extra_test_dependencies:
38-
# Required when binary dependencies are not bundled
39-
- attrs==22.2.0 # Fix version. Otherwise tk-ci-tools will install latest
40-
- Twisted==22.10.0 # Last version supporting Python 3.7
41-
- websocket-client==1.6.1 # Last version supporting Python 3.7
38+
# CI installs dependencies from the dedicated Azure Pipelines
39+
# requirements file, which must be kept in sync with the unified
40+
# runtime requirements so CI-installed versions match what pkgs.zip
41+
# bundles, preventing sys.modules version conflicts.
42+
- --requirement=azure-pipelines/requirements.txt
4243
post_tests_steps:
4344
- task: Bash@3
4445
displayName: Run interpreter integration tests

azure-pipelines/requirements.txt

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Test-environment dependencies for Azure Pipelines CI.
2+
# These supplement the pre-built pkgs.zip bundle and are not shipped with the
3+
# product.
4+
#
5+
# Note: attrs and Twisted versions must be kept in sync with
6+
# resources/python/requirements.txt.
7+
8+
#-------------------------------------------------------------------------------
9+
# attrs
10+
# Pinned to prevent tk-ci-tools from upgrading to a newer version automatically.
11+
attrs==22.2.0
12+
13+
#-------------------------------------------------------------------------------
14+
# Twisted
15+
# Must match the version bundled in pkgs.zip/src/ for each Python version.
16+
# A version mismatch causes a sys.modules conflict at runtime (see SG-42304).
17+
Twisted==22.10.0 ; python_version < "3.9"
18+
Twisted==24.10.0 ; python_version >= "3.9" and python_version < "3.13"
19+
Twisted~=24.11.0 ; python_version >= "3.13"
20+
21+
#-------------------------------------------------------------------------------
22+
# websocket-client
23+
# Test-only dependency (not bundled in pkgs.zip).
24+
websocket-client==1.6.1 ; python_version < "3.9" # Last version supporting Python 3.7
25+
websocket-client~=1.9.0 ; python_version >= "3.9"

resources/python/requirements.txt

Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
# Targeted Python versions:
2+
# - 3.7 (legacy)
3+
# - 3.9 (VFX CY2022)
4+
# - 3.10 (VFX CY2023)
5+
# - 3.11 (VFX CY2024)
6+
# - 3.13 (VFX CY2026)
7+
#
8+
# When updating a dependency, follow the process described in README.md.
9+
# CI handles regeneration automatically.
10+
# Note: Twisted and attrs are also pinned in azure-pipelines/requirements.txt
11+
# and must be kept in sync with the versions here.
12+
13+
# ============================================================================ #
14+
# Direct dependencies
15+
# Version constraints balance code compatibility and CVE requirements.
16+
#
17+
18+
#-------------------------------------------------------------------------------
19+
# autobahn
20+
# CVE-2020-35678 - fixed in 20.12.3
21+
autobahn==22.12.1 ; python_version < "3.13"
22+
autobahn~=24.4.2 ; python_version >= "3.13"
23+
24+
#-------------------------------------------------------------------------------
25+
# pyOpenSSL
26+
pyopenssl==25.0.0 ; python_version < "3.13"
27+
pyopenssl~=25.0.0 ; python_version >= "3.13"
28+
29+
#-------------------------------------------------------------------------------
30+
# Twisted
31+
# CVE-2022-21712 - fixed in 22.1
32+
# CVE-2022-24801 - fixed in 22.1
33+
# CVE-2024-41671 & CVE-2024-41810 - fixed in 24.10.0 - N/A for Python 3.7
34+
twisted==22.10.0 ; python_version < "3.9" # Last version supporting 3.7
35+
twisted==24.10.0 ; python_version >= "3.9" and python_version < "3.13"
36+
twisted~=24.11.0 ; python_version >= "3.13"
37+
38+
# ============================================================================ #
39+
# Selected sub-level dependencies
40+
# CVE-driven: minimum versions (>= x.y.z).
41+
# Other reasons (e.g. compatibility, bundling): pinned to a specific version.
42+
#
43+
44+
#-------------------------------------------------------------------------------
45+
# attrs
46+
# Required by:
47+
# → service-identity
48+
# ↳ Twisted
49+
# Do not upgrade! The CI pipeline installs attrs==22.2.0 as a system-level test
50+
# dependency (see azure-pipelines/requirements.txt). pytest also imports attrs
51+
# early, caching it in sys.modules. From attrs 23.2.0,
52+
# `attrs/__init__.py` imports `Converter` from `attr`. If the bundled version is
53+
# newer than the cached one, that import fails with:
54+
# ImportError: cannot import name 'Converter' from 'attr'
55+
# Twisted 24.x and autobahn 24.x only require attrs>=22.2.0, so this is safe.
56+
attrs==22.2.0
57+
58+
#-------------------------------------------------------------------------------
59+
# certifi
60+
# Required by:
61+
# → pyOpenSSL
62+
# ↳ Twisted
63+
# Pinned to match the version bundled with FPT Desktop
64+
certifi==2026.1.4
65+
66+
#-------------------------------------------------------------------------------
67+
# cffi
68+
# Required by:
69+
# → cryptography → autobahn
70+
# ↳ pyOpenSSL
71+
# ↳ service-identity
72+
cffi>=1.15.1 ; python_version < "3.13"
73+
cffi>=1.17.1 ; python_version >= "3.13"
74+
75+
#-------------------------------------------------------------------------------
76+
# cryptography
77+
# Required by:
78+
# → autobahn
79+
# ↳ pyOpenSSL
80+
# ↳ service-identity
81+
# CVE-2023-2650 - fixed in 41.0.0
82+
# CVE-2023-4807 - fixed in 41.0.5
83+
# CVE-2023-5678 - fixed in 41.0.7
84+
# CVE-2023-49083 - fixed in 41.0.7
85+
# CVE-2024-2511 - fixed in 43.0.1
86+
# CVE-2024-4603 - fixed in 43.0.1
87+
# CVE-2024-6119 - fixed in 43.0.1
88+
# CVE-2024-12797 - fixed in 44.0.1
89+
cryptography>=44.0.1
90+
91+
#-------------------------------------------------------------------------------
92+
# hyperlink
93+
# Required by:
94+
# → autobahn
95+
# ↳ Twisted
96+
hyperlink>=21.0.0
97+
98+
#-------------------------------------------------------------------------------
99+
# idna
100+
# Required by:
101+
# → hyperlink → autobahn
102+
# ↳ Twisted
103+
# CVE-2024-3651 - fixed in 3.7
104+
idna>=3.7 ; python_version < "3.13"
105+
idna>=3.8 ; python_version >= "3.13"
106+
107+
#-------------------------------------------------------------------------------
108+
# service-identity
109+
# Required by:
110+
# → Twisted
111+
service-identity>=21.1.0 ; python_version < "3.13"
112+
service-identity>=24.2.0 ; python_version >= "3.13"
113+
114+
#-------------------------------------------------------------------------------
115+
# six
116+
# Required by: service-identity
117+
# service-identity 24.x (Python 3.13+) no longer requires six
118+
six==1.16.0 ; python_version < "3.13"
119+
120+
#-------------------------------------------------------------------------------
121+
# zope.interface
122+
# Required by: Twisted
123+
zope.interface>=5.5.2 ; python_version < "3.13"
124+
zope.interface>=7.1.0 ; python_version >= "3.13"

resources/python/requirements/3.10/requirements.txt

Lines changed: 0 additions & 16 deletions
This file was deleted.

resources/python/requirements/3.11/requirements.txt

Lines changed: 0 additions & 16 deletions
This file was deleted.

resources/python/requirements/3.13/requirements.txt

Lines changed: 0 additions & 30 deletions
This file was deleted.

resources/python/requirements/3.7/requirements.txt

Lines changed: 0 additions & 16 deletions
This file was deleted.

resources/python/requirements/3.9/requirements.txt

Lines changed: 0 additions & 16 deletions
This file was deleted.

0 commit comments

Comments
 (0)