Skip to content

Conversation

@EmilienM
Copy link
Contributor

Add a new command 'pypi-info' that queries the PyPI JSON API to retrieve
comprehensive package information including:

  • Package name, version, and availability status
  • License information
  • Homepage and repository URLs
  • Distribution type availability (sdist/wheel)

The command supports both latest version queries and specific version
lookups with proper error handling for missing packages/versions.

Example usage:
fromager pypi-info requests
fromager pypi-info "requests==2.32.0"
fromager pypi-info --pypi-base-url https://custom.pypi.org/pypi requests

Example of output:

$ fromager pypi-info requests
23:04:52 INFO Fetching information for requests
Package: requests
Version: 2.32.5
Found on PyPI: Yes
License: Apache-2.0
Homepage: https://requests.readthedocs.io
Repository: https://github.com/psf/requests
Has source distribution (sdist): Yes
Has wheel: Yes
23:04:52 INFO Package information retrieved successfully for requests 2.32.5

Includes comprehensive unit tests (13 test cases) and e2e integration tests
covering all functionality including error conditions and edge cases.

Co-Authored-By: Claude noreply@anthropic.com claude-sonnet-4@20250514
Signed-off-by: Emilien Macchi emacchi@redhat.com

Add a new command 'pypi-info' that queries the PyPI JSON API to retrieve
comprehensive package information including:
- Package name, version, and availability status
- License information
- Homepage and repository URLs
- Distribution type availability (sdist/wheel)

The command supports both latest version queries and specific version
lookups with proper error handling for missing packages/versions.

Example usage:
  fromager pypi-info requests
  fromager pypi-info "requests==2.32.0"
  fromager pypi-info --pypi-base-url https://custom.pypi.org/pypi requests

Example of output:
```
$ fromager pypi-info requests
23:04:52 INFO Fetching information for requests
Package: requests
Version: 2.32.5
Found on PyPI: Yes
License: Apache-2.0
Homepage: https://requests.readthedocs.io
Repository: https://github.com/psf/requests
Has source distribution (sdist): Yes
Has wheel: Yes
23:04:52 INFO Package information retrieved successfully for requests 2.32.5
```

Includes comprehensive unit tests (13 test cases) and e2e integration tests
covering all functionality including error conditions and edge cases.

Co-Authored-By: Claude <noreply@anthropic.com> claude-sonnet-4@20250514
Signed-off-by: Emilien Macchi <emacchi@redhat.com>
Copy link
Collaborator

@tiran tiran left a comment

Choose a reason for hiding this comment

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

I had a similar idea. Let's get together on Monday.

default="https://pypi.org/pypi",
help="Base URL for PyPI JSON API",
)
@click.argument("package_spec", required=True)
Copy link
Collaborator

Choose a reason for hiding this comment

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

How about you make this two arguments: fromager pypi-info torch 2.7.1 with version as an optional argument?

Comment on lines +118 to +123
# License information
license_info = info.get("license") or "Not specified"
# Handle cases where license is empty string or None
if not license_info or license_info.strip() == "":
license_info = "Not specified"
print(f"License: {license_info}")
Copy link
Collaborator

Choose a reason for hiding this comment

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

You need to handle several additional special cases. License information can be in three fields. Try fromager pypi-info fromager and fromager pypi-info cryptography to see two special cases.

print("Homepage: Not specified")

# Check for other relevant URLs
project_urls = info.get("project_urls") or {}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
project_urls = info.get("project_urls") or {}
project_urls = info.get("project_urls", {})

has_sdist = False
has_wheel = False

for url_info in urls:
Copy link
Member

Choose a reason for hiding this comment

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

On recurring problem we have is packages with only prerelease versions, which are not resolved by default. It would be useful to show that sort of detail here when no version is specified.

@EmilienM
Copy link
Contributor Author

EmilienM commented Nov 3, 2025

I'm closing the PR, this was experimental. This work can be restored later.

@EmilienM EmilienM closed this Nov 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci enhancement New feature or request mergify

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants