Enforce Conda pyproject.toml metadata in verifywhl#45012
Open
JennyPng wants to merge 10 commits intoAzure:mainfrom
Open
Enforce Conda pyproject.toml metadata in verifywhl#45012JennyPng wants to merge 10 commits intoAzure:mainfrom
JennyPng wants to merge 10 commits intoAzure:mainfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This pull request enforces that Python packages with stable releases on PyPI must include a [tool.azure-sdk-conda] section in their pyproject.toml file. This automation supports the Conda release process by ensuring service teams specify whether packages should be released individually or bundled.
Changes:
- Adds validation to check for Conda metadata in packages with stable PyPI versions
- Fixes logging calls to use the correct logger instance
- Removes unused import statement
Comment on lines
115
to
139
| def verify_conda_section( | ||
| package_dir: str, package_name: str, parsed_pkg: ParsedSetup, pypi_versions: List[str] | ||
| ) -> bool: | ||
| """Verify that packages with stable versions on PyPI have [tool.azure-sdk-conda] section in pyproject.toml.""" | ||
| if not has_stable_version_on_pypi(package_name, pypi_versions=pypi_versions): | ||
| logger.info(f"Package {package_name} has no stable version on PyPI, skipping conda section check") | ||
| return True | ||
|
|
||
| pyproject_path = os.path.join(package_dir, "pyproject.toml") | ||
| if not os.path.exists(pyproject_path): | ||
| logger.error(f"Package {package_name} has a stable version on PyPI but is missing pyproject.toml") | ||
| return False | ||
|
|
||
| config = parsed_pkg.get_conda_config() | ||
| if not config: | ||
| logger.error( | ||
| f"Package {package_name} has a stable version on PyPI but is missing " | ||
| "[tool.azure-sdk-conda] section in pyproject.toml. This section is required to " | ||
| "specify if the package should be released individually or bundled to Conda." | ||
| ) | ||
| return False | ||
| elif "in_bundle" not in config: | ||
| logger.error(f"[tool.azure-sdk-conda] section in pyproject.toml is missing required field `in_bundle`.") | ||
| return False | ||
| return True |
There was a problem hiding this comment.
New conda-metadata validation logic (verify_conda_section) doesn’t appear to have automated test coverage in the azure-sdk-tools test suite. Adding tests for: (1) stable vs prerelease gating, (2) missing [tool.azure-sdk-conda], and (3) missing in_bundle would help prevent regressions, especially since this is enforcing a new release policy.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
closes #44883
(data plane) packages with stable releases are required to have a Conda tool section in their pyproject.toml to specify if packages are to be released individually or as part of a bundle
service teams should be responsible for specifying this information
existing stable packages have already been batch updated