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

Standardize Package Release Fetching Format and Implement JSON API for Python #11630

Merged
merged 29 commits into from
Feb 24, 2025

Conversation

kbukum1
Copy link
Contributor

@kbukum1 kbukum1 commented Feb 19, 2025

What are you trying to accomplish?

This PR standardizes the format for package release fetching by introducing a common structure (PackageRelease, PackageLanguage, PackageDetails) that ensures consistency across ecosystems. This standardized format will be applicable to other package managers in the future.

As the first step, it applies this standardized fetching format to Python, implementing JSON API fetching as the primary method while keeping HTML fallback support for backward compatibility.

The JSON API fetching is behind a feature flag to ensure a controlled rollout and allow for further validation before full adoption.

Switching to JSON API fetching provides the following benefits:

  1. Efficiency – JSON API fetching is faster and more structured compared to HTML parsing.
  2. More metadata – JSON API provides release dates, which were not available in the HTML-based approach.
    • Release dates are crucial for the upcoming cooldown feature, which will rely on this metadata to determine update timing.

What does this PR do?

  • Standardizes package release fetching format, introducing PackageRelease, PackageLanguage, and PackageDetails as common data structures.
  • Implements JSON API fetching ({url}/pypi) behind a feature flag, allowing for controlled testing and gradual rollout.
  • Includes release dates in package metadata, supporting future cooldown logic.
  • Maintains HTML-based fallback fetching to support cases where the JSON API is unavailable or the feature flag is disabled.
  • Ensures consistency, maintainability, and extensibility for future ecosystem integrations.

Anything you want to highlight for special attention from reviewers?

  • Ensure that the new standardized fetching format (PackageRelease, PackageLanguage, PackageDetails) is correctly applied to Python.
  • Confirm that JSON API fetching works correctly when the feature flag is enabled.
  • Verify that fallback to HTML parsing works as expected when JSON API is unavailable or the feature flag is disabled.
  • Check that release date metadata is correctly included and will be usable for cooldown logic.
  • Validate that existing package fetching behavior remains unchanged functionally when the feature flag is off.

How will you know you've accomplished your goal?

  • Python package fetching uses the standardized format (PackageRelease, PackageLanguage, PackageDetails).
  • JSON API fetching provides release dates, improving metadata quality and enabling cooldown logic.
  • When the feature flag is disabled, the system falls back to HTML fetching, ensuring no functional regressions.
  • Performance improves due to more efficient JSON API fetching compared to HTML parsing.
  • Standardization makes it easier to extend package release fetching to other ecosystems.
  • All test cases pass, validating that both JSON and HTML metadata fetching work reliably.

Checklist

  • I have run the complete test suite to ensure all tests and linters pass.
  • I have thoroughly tested my code changes to ensure they work as expected, including additional test cases for new functionality.
  • I have written clear and descriptive commit messages.
  • I have provided a detailed description of the changes in the pull request, including the problem it addresses, how it fixes the problem, and any relevant details about the implementation.
  • I have ensured that the code is well-documented and easy to understand.

@kbukum1 kbukum1 force-pushed the kamil/standardize_package_details_fetching branch from 57d5e34 to 1af2e14 Compare February 20, 2025 18:10
@kbukum1 kbukum1 force-pushed the kamil/standardize_package_details_fetching branch from 28d081f to 3917c68 Compare February 21, 2025 00:04
@kbukum1 kbukum1 force-pushed the kamil/standardize_package_details_fetching branch from 4ca6428 to 1ec0c11 Compare February 23, 2025 01:31
@kbukum1 kbukum1 marked this pull request as ready for review February 24, 2025 18:43
@kbukum1 kbukum1 requested a review from a team as a code owner February 24, 2025 18:43
@kbukum1 kbukum1 changed the title Standardize Package Details Fetching and Integrate Python Details Fetcher Standardize Package Release Fetching and Apply to Python Details Fetcher Feb 24, 2025
@kbukum1 kbukum1 changed the title Standardize Package Release Fetching and Apply to Python Details Fetcher Standardize Package Release Fetching and Implement JSON API for Python Feb 24, 2025
@kbukum1 kbukum1 changed the title Standardize Package Release Fetching and Implement JSON API for Python Standardize Package Release Fetching Format and Implement JSON API for Python Feb 24, 2025
Copy link
Member

@randhircs randhircs left a comment

Choose a reason for hiding this comment

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

I approve it, Tests cases are updated and I assume we have added all the test cases in terms of validating/verifying json response date.

@kbukum1 kbukum1 merged commit 1c73877 into main Feb 24, 2025
90 of 122 checks passed
@kbukum1 kbukum1 deleted the kamil/standardize_package_details_fetching branch February 24, 2025 22:44
dmitris pushed a commit to dmitris/dependabot-core that referenced this pull request Feb 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants