Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
15ad5c5
first version of new way to handle python third parties
eduardoChaucaGallegos Dec 31, 2024
c5de133
test requirements for test
eduardoChaucaGallegos Dec 31, 2024
49c8b01
changes update_python_packages
eduardoChaucaGallegos Jan 16, 2025
7c56bcf
testing python3.7 with old requirements
eduardoChaucaGallegos Jan 27, 2025
a2b9253
test
eduardoChaucaGallegos Jan 28, 2025
8ab95c1
test
eduardoChaucaGallegos Jan 28, 2025
94fee7f
test
eduardoChaucaGallegos Jan 28, 2025
4949fe0
test
eduardoChaucaGallegos Jan 29, 2025
92880d2
possible solution}
eduardoChaucaGallegos Feb 4, 2025
1a5800a
six.py recovered
eduardoChaucaGallegos Feb 4, 2025
04c6435
ruamel_yaml explicit recovered
eduardoChaucaGallegos Feb 4, 2025
2e7a75f
ruamel_yaml explicit recovered
eduardoChaucaGallegos Feb 4, 2025
c013a93
comments fixed and still using six and ruamel_yaml from tank_vendor
eduardoChaucaGallegos Feb 5, 2025
1f68472
black format
eduardoChaucaGallegos Feb 5, 2025
c724756
requirements updated
eduardoChaucaGallegos Feb 5, 2025
db21f6d
requirements format
eduardoChaucaGallegos Feb 5, 2025
e6b3e34
requirements updated
eduardoChaucaGallegos Feb 5, 2025
d001f67
correct distro version for python3.11
eduardoChaucaGallegos Feb 5, 2025
ffea9ba
comments fixed
eduardoChaucaGallegos Feb 6, 2025
161cd66
hound recomendation changed
eduardoChaucaGallegos Feb 6, 2025
1ada3b1
black format
eduardoChaucaGallegos Feb 6, 2025
2f9e1c1
new update for script to update packages and less code on __ini__.py …
eduardoChaucaGallegos Feb 18, 2025
6a97552
code and comments cleaned
eduardoChaucaGallegos Feb 18, 2025
c92a72b
Code review
julien-lang Feb 18, 2025
cadb4b9
readme documentation updated, single import line updated and exceptio…
eduardoChaucaGallegos Feb 20, 2025
1d7c227
blank line
eduardoChaucaGallegos Feb 20, 2025
e9669f4
conflict fixed, branch updated from master and fixes on tank_vendor/_…
eduardoChaucaGallegos Dec 6, 2025
5ee3377
black format
eduardoChaucaGallegos Dec 6, 2025
9f9a6f2
requirements updated
eduardoChaucaGallegos Dec 6, 2025
b531ad9
tank_vendor __init__.py improved
eduardoChaucaGallegos Dec 6, 2025
f46ea03
tank_vendor __init__.py improved
eduardoChaucaGallegos Dec 6, 2025
0d277a1
shotgu_api3 from pip
eduardoChaucaGallegos Dec 6, 2025
080985d
test to fix tests
eduardoChaucaGallegos Dec 6, 2025
c92f375
improvemetn to read certifi
eduardoChaucaGallegos Dec 6, 2025
9a3b6f9
Register shotgun_api3.lib submodules in sys.modules to support nested…
eduardoChaucaGallegos Dec 6, 2025
1a318b1
Refactor tank_vendor to use dynamic package discovery and lazy import…
eduardoChaucaGallegos Dec 10, 2025
500ce3e
RunTimeError added and black fixes
eduardoChaucaGallegos Dec 10, 2025
a5ab5fb
fiexs for integrationsion tests
eduardoChaucaGallegos Dec 10, 2025
b5d8e39
fix(import_handler): Skip ZIP paths in CoreImportHandler to let zipim…
eduardoChaucaGallegos Dec 11, 2025
20a6651
integration test fixed
eduardoChaucaGallegos Dec 11, 2025
e14033b
last pkgs.zip updated
eduardoChaucaGallegos Dec 11, 2025
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
52 changes: 36 additions & 16 deletions developer/README.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,31 @@
# Flow Production Tracking Core API

## How to upgrade pyyaml
## The `requirements` folder

This package is a vendor widely used by `sgtk` to parse configuration files
in YAML format.
The `requirements` folder contains subdirectories for different Python versions (e.g., `3.7`, `3.9`, `3.10`, and `3.11`). Each subdirectory includes the following files:

This package is shipped in source format, that means that only `*.py` are
included in `python/tank_vendor/yaml`.
- **`requirements.txt`**: Specifies the dependencies for the corresponding Python version. This file is primarily used to document which packages are required for the application.
- **`frozen_requirements.txt`**: A frozen version of the dependencies, capturing exact package versions installed, including sub-dependencies, to ensure consistent and reproducible environments.
- **`pkgs.zip`**: A zip file containing the bundled packages for the corresponding Python version.

If you need to upgrade this package you can use the script `upgrade_pyyaml.py`.
### How bundled packages are used

```shell
cd tk-core/developer
python upgrade_pyyaml.py
```
The `__init__.py` file in the `tank_vendor` folder dynamically references and loads packages from the appropriate `pkgs.zip` file in the `requirements` folder.

This approach centralizes the management of dependencies, ensuring that packages are versioned and bundled consistently across different Python versions.

### Updating and creating bundled packages

The `update_python_packages.py` script automates the creation and maintenance of the `pkgs.zip` file.

#### Workflow:

1. Update the `requirements.txt` file for the desired Python version.
2. Run the `update_python_packages.py` script to:
- Install the specified dependencies in a temporary directory.
- Create or update the `pkgs.zip` file with the required packages.
- Generate the `frozen_requirements.txt` file for consistency.
3. Validate that the `pkgs.zip` file contains all necessary packages and matches the updated requirements.

## How to upgrade ruamel.yaml

Expand All @@ -29,11 +41,19 @@ pip install ruamel.yaml -t path/to/tank_vendor
Then, let's remove all undesired directories and files, just leave the `ruamel` directory.
We can automate this task later.

## The requirements.txt file
### Maintaining dependencies

When adding new dependencies or updating existing ones:
1. Update the `requirements.txt` file for the corresponding Python version.
2. Regenerate the `pkgs.zip` and `frozen_requirements.txt` files using `update_python_packages.py`.
3. Ensure the `pkgs.zip` file includes all necessary packages and modules.

### Automated CVE checks

The `frozen_requirements.txt` files enable automated checks for vulnerabilities (CVEs) in the bundled packages. These files capture the exact versions of dependencies included in the `pkgs.zip` files, ensuring the application remains secure by providing visibility into potential vulnerabilities.

### Notes

The file `developer/requirements.txt` is not used to install any packages,
however exists so that automated checks for CVEs in dependencies will know about
bundled packages in `python/tank_vendor`.
The dynamic loading mechanism in `tank_vendor/__init__.py` ensures that bundled packages are accessed seamlessly from the `pkgs.zip` files, reducing duplication and simplifying dependency updates.

For this reason, it's important to add any newly bundled packages to this file,
and to keep the file up to date if the bundled version of a module changes.
Careful attention to package structure and appropriate import mechanisms will help avoid runtime issues and ensure smooth integration of new dependencies.
99 changes: 0 additions & 99 deletions developer/upgrade_pyyaml.py

This file was deleted.

7 changes: 7 additions & 0 deletions python/tank/bootstrap/import_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,13 @@ def find_spec(self, module_fullname, package_path=None, target=None):

module_name = module_path_parts.pop()

# Check if the package path is inside a ZIP file.
# If so, SourceFileLoader cannot handle it - we need to let the
# ZIP import handler (like zipimport or TankVendorMetaFinder) handle it.
# This is common for tank_vendor packages that come from pkgs.zip.
if package_path[0] and ".zip" in package_path[0]:
return None
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
return None
return


try:
# find the module spec
if os.path.isdir(os.path.join(package_path[0], module_name)):
Expand Down
Loading
Loading