Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(engsys) fix: Gracefully handle invalid python_requires when finding mininum dependency version #37317

Merged

Conversation

kdestin
Copy link
Member

@kdestin kdestin commented Sep 12, 2024

Description

python_requires must follow the format defined in: https://packaging.python.org/en/latest/specifications/version-specifiers/#id5

In the event that a package version specifies a python_requires that does not match that spec, execution of filter_packages_for_compatibility terminates with an InvalidSpecifier exception. This is called during the mindependency step in our CI, so that exception causes the testing step to fail: example run

This PR gracefully handles invalid python_requires, logging the exception and ignoring the version that has the invalid python version specifier.

This PR should have no impact on any existing SDKs in the repository, since any SDK with this issue would like have already been blocked it.

Note: An alternative solution could have been to attempt to correct the version specifier (e.g. '>= 3.5.*' is invalid, but it'd be trivial to correct it to '>=3.5'). But such a correction in the more general case may invite a complexity that costs more than it's worth.

Related to #37268

Unblocks #37201

_

All SDK Contribution checklist:

  • The pull request does not introduce [breaking changes]
  • CHANGELOG is updated for new features, bug fixes or other significant changes.
  • I have read the contribution guidelines.

General Guidelines and Best Practices

  • Title of the pull request is clear and informative.
  • There are a small number of commits, each of which have an informative message. This means that previously merged commits do not appear in the history of the PR. For more information on cleaning up the commits in your PR, see this page.

Testing Guidelines

  • Pull request includes test coverage for the included changes.

    python_requires must follow the specification defined in:
        https://packaging.python.org/en/latest/specifications/version-specifiers/#id5

    In the event that a package version specifies a `python_requires`
    that does not match that spec, execution terminates with
    an InvalidSpecifier exception.

    This commit makes it so that we catch and log the exception,
    ignoring the version that has the invalid python version specifier.

    An alternative solution could have been to attempt to correct
    the version specifier (e.g. '>= 3.5.*' is invalid, but it'd be
    trivial to correct it to '>=3.5'). But that would potentially invite
    a complexity that costs more than it's worth.
@needuv needuv enabled auto-merge (squash) September 12, 2024 16:58
@needuv needuv merged commit a31e507 into Azure:main Sep 12, 2024
23 checks passed
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.

3 participants