Skip to content

Conversation

@eduardoChaucaGallegos
Copy link
Contributor

@eduardoChaucaGallegos eduardoChaucaGallegos commented Dec 4, 2025

Description

This pull request introduces Python version compatibility checks into the App Store descriptor logic, ensuring that bundles are only auto-updated to versions compatible with the current Python interpreter. It also adds utility methods for filtering and sorting cached versions and improves error handling and logging throughout the descriptor code.

Python version compatibility enforcement:

  • Added a _check_minimum_python_version method in IODescriptorBase to compare the current Python version with the bundle's minimum_python_version requirement from its manifest. This method is now used to block auto-updates to incompatible versions and to select the highest compatible cached version if the latest is not suitable. [1] [2]

  • Updated get_latest_version in IODescriptorAppStore to check Python compatibility before selecting the latest version, falling back to the newest compatible cached version if necessary, and logging appropriate warnings or info.

Cached version selection and filtering:

  • Introduced helper methods in IODescriptorAppStore for filtering cached versions by label, App Store availability, and Python compatibility, and for sorting versions in descending order. These methods improve the robustness and maintainability of version selection logic.

Imports and code cleanup:

  • Updated imports in io_descriptor/appstore.py and io_descriptor/base.py for consistency and to support new functionality (e.g., importing sys and is_version_newer_or_equal). [1] [2]
  • Minor code style fixes, including argument formatting and variable naming. [1] [2]

…inimum_python_version not met

- Added _check_minimum_python_version() method in base.py
- Updated appstore.py get_latest_version() to check Python compatibility
- If latest version requires newer Python, auto-update is blocked and current version is retained
- Uses tank.util.version.is_version_newer_or_equal() for robust version comparison
… sg_matching_records for filtering, reduce nesting.
@eduardoChaucaGallegos eduardoChaucaGallegos marked this pull request as ready for review December 4, 2025 20:59
@eduardoChaucaGallegos eduardoChaucaGallegos requested a review from a team December 4, 2025 20:59
Copy link
Member

@julien-lang julien-lang left a comment

Choose a reason for hiding this comment

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

I'm surprised to see so much new code in python/tank/descriptor/io_descriptor/appstore.py. We already have some code checking compatibility from app store components right? Like core min version, SG min version, ...

Could you write some tests too please? Like a test showing a component version is not selected because of the current Python version. But then running a higher Python version, the component get picked up

- 3 unit tests for _check_minimum_python_version validation
- 2 end-to-end tests demonstrating version selection with cache fallback
- Tests verify that incompatible versions are detected and older
  compatible versions are used when available
Copy link
Contributor

@carlos-villavicencio-adsk carlos-villavicencio-adsk left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Member

@julien-lang julien-lang left a comment

Choose a reason for hiding this comment

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

Only a minor comment.

But also, should we document this new attribute in the Sphinx doc somewhere?

import sys
import urllib.parse
import urllib.request
from typing import Dict, Iterator, List, Optional, Set, Tuple
Copy link
Member

Choose a reason for hiding this comment

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

I know it's a personal preference. But could you only import typing instead and then call typing.Dict, typing.Iterator, ...

Also t is before u. can we keep alpha order for dependencies?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants