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
muslpy 3.10–3.95 runs
installs and imports cleanly · install 0.0s · import 0.422s · 21.2MB
glibcpy 3.10–3.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.fixAlways 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.fixEnsure `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.fixUpgrade 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.fixBe 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.
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'.
fixfrom 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.
fixpackage_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.
fixfrom 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.