Registry / http-networking / yarg
library0.1.10pypypi✓ verified 22d ago

Yarg is a Python client library designed for programmatically querying the Python Package Index (PyPI). Built on top of the `requests` library, it offers a straightforward interface to retrieve package metadata, including release details, and interact with PyPI's RSS feeds for discovering new and recently updated packages. The current version, 0.1.10, was released in August 2024 primarily for Python 3.12 compatibility, indicating an infrequent release cadence focused on maintenance.

pip install yarg
INSTALL
IMPORT
SIG · YARG
Y
yarg
http-networkingpythonv0.1.10
Install
2.1s avg
Import
414ms
Disk
19MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v0.1.10 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.422s · 21.2MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 2.1s · import 0.406s · 22MB
19MB installed
● package 19MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

yarg
import yarg
The main entry point for all client functionality.
yarg.get
package = yarg.get('package_name')
yarg.newest_packages
new_packages = yarg.newest_packages()
yarg.latest_updated_packages
updated_packages = yarg.latest_updated_packages()
yarg.exceptions.HTTPError
from yarg.exceptions import HTTPError
Can also be accessed directly via `yarg.HTTPError` as of 0.1.1.

This quickstart demonstrates how to fetch a specific package's information using `yarg.get()` and how to retrieve a list of the newest packages published to PyPI using `yarg.newest_packages()`.

import yarg try: package = yarg.get("requests") print(f"Package Name: {package.name}") print(f"Author: {package.author.name} ({package.author.email})") print(f"Latest Version: {package.latest_release.version}") except yarg.exceptions.HTTPError as e: print(f"Error fetching package: {e}") print("\n--- Newest Packages ---") newest = yarg.newest_packages() for p in newest[:3]: print(f"- {p.name} ({p.version})")
Debug
Known issues
gotchaPyPI package names are case-sensitive. `yarg.get()` will return a 404 Not Found error if the casing doesn't match the official PyPI registration.
fix
Always use the exact case of the package name as registered on PyPI (e.g., `yarg.get('requests')` not `yarg.get('Requests')`).
affects: All versions
deprecatedThe PyPI domain transitioned from `pypi.python.org` to `pypi.org`. While `yarg` might handle redirects, older clients or custom `pypi_server` configurations might encounter issues if they hardcode the old domain.
fix
Ensure `yarg` is updated to the latest version (0.1.10) for best compatibility, and avoid hardcoding `pypi.python.org` in `pypi_server` arguments.
affects: <= 0.1.9 might be more susceptible, but generally affects interaction with PyPI infrastructure changes.
gotchaOlder versions (pre-0.1.2) could raise `KeyError` if certain metadata fields like `home_page`, `bugtrack_url`, or `docs_url` were missing from PyPI's response for a package. This was fixed in 0.1.2.
fix
Upgrade to `yarg` version 0.1.2 or newer to ensure robustness against missing metadata fields.
affects: < 0.1.2
gotchaThe `docs` attribute of a `Package` object is typically only populated for packages hosted on `pythonhosted.org`. Also, PyPI itself sometimes returns `docs_url` with an extra slash.
fix
Be aware that `package.docs` might be empty for packages not on `pythonhosted.org`. Handle potential extra slashes in URLs if processing them programmatically.
affects: All versions
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'yarg'
The 'yarg' package has not been installed in your Python environment.
fix
pip install yarg
ImportError: cannot import name 'Client' from 'yarg'
The 'yarg' library does not expose a class named 'Client' directly; the main class for package information is 'Package'.
fix
from yarg import Package
AttributeError: 'Package' object has no attribute 'keywords'
The 'yarg.Package' object does not have a direct 'keywords' attribute; full PyPI metadata is accessible via the internal '_data' attribute.
fix
package_obj._data.get('info', {}).get('keywords', [])
TypeError: Package.__init__ missing 1 required positional argument: 'name'
The 'yarg.Package' constructor requires a package name string as its first argument.
fix
from yarg import Package
package = Package('requests')
Upgrade
Version history
0.1.10latest on PyPI · released Aug 9, 2024
Audit
Dependencies
requestsrequiredYarg is built on top of the requests library for HTTP communication with PyPI.
Agent activity
36 hits · last 30 days
node
26
OpenAI (training)
1
Resources
yarg — pip install yarg · libregistry