API - Package Lookup

Query Interface

yarg.get(package_name, pypi_server='https://pypi.python.org/pypi/')

Constructs a request to the PyPI server and returns a yarg.package.Package.

Parameters:
  • package_name – case sensitive name of the package on the PyPI server.
  • pypi_server

    (option) URL to the PyPI server.

    >>> import yarg
    >>> package = yarg.get('yarg')
    <Package yarg>
    

Package Object

class yarg.package.Package(pypi_dict)[source]

A PyPI package.

Parameters:pypi_dict – A dictionary retrieved from the PyPI server.
name[source]
>>> package = yarg.get('yarg')
>>> package.name
u'yarg'
pypi_url[source]
>>> package = yarg.get('yarg')
>>> package.url
u'https://pypi.python.org/pypi/yarg'
summary[source]
>>> package = yarg.get('yarg')
>>> package.summary
u'Some random summary stuff'
description[source]
>>> package = yarg.get('yarg')
>>> package.description
u'A super long description, usually uploaded from the README'
homepage[source]
>>> package = yarg.get('yarg')
>>> package.homepage
u'https://kura.io/yarg/'
bugtracker[source]
>>> package = yarg.get('yarg')
>>> package.bugtracker
u'https://github.com/kura/yarg/issues'
docs[source]
>>> package = yarg.get('yarg')
>>> package.docs
u'https://yarg.readthedocs.org/en/latest'
author[source]
>>> package = yarg.get('yarg')
>>> package.author
Author(name=u'Kura', email=u'kura@kura.io')
maintainer[source]
>>> package = yarg.get('yarg')
>>> package.maintainer
Maintainer(name=u'Kura', email=u'kura@kura.io')
license[source]
>>> package = yarg.get('yarg')
>>> package.license
u'MIT'
license_from_classifiers[source]
>>> package = yarg.get('yarg')
>>> package.license_from_classifiers
u'MIT License'
downloads[source]
>>> package = yarg.get('yarg')
>>> package.downloads
Downloads(day=50100, week=367941, month=1601938)  # I wish
classifiers[source]
>>> package = yarg.get('yarg')
>>> package.classifiers
[u'License :: OSI Approved :: MIT License',
 u'Programming Language :: Python :: 2.7',
 u'Programming Language :: Python :: 3.4']
python_versions[source]

Returns a list of Python version strings that the package has listed in yarg.Release.classifiers.

>>> package = yarg.get('yarg')
>>> package.python_versions
[u'2.6', u'2.7', u'3.3', u'3.4']
python_implementations[source]

Returns a list of Python implementation strings that the package has listed in yarg.Release.classifiers.

>>> package = yarg.get('yarg')
>>> package.python_implementations
[u'CPython', u'PyPy']
latest_release_id[source]
>>> package = yarg.get('yarg')
>>> package.latest_release_id
u'0.1.0'
latest_release[source]

A list of yarg.release.Release objects for each file in the latest release.

>>> package = yarg.get('yarg')
>>> package.latest_release
[<Release 0.1.0>, <Release 0.1.0>]
has_wheel[source]

Returns True if one of the yarg.release.Release objects in the latest set of release files is wheel format. Returns False if not.

>>> package = yarg.get('yarg')
>>> package.has_wheel
True
has_egg[source]

Returns True if one of the yarg.release.Release objects in the latest set of release files is egg format. Returns False if not.

>>> package = yarg.get('yarg')
>>> package.has_egg
False
has_source[source]

Returns True if one of the yarg.release.Release objects in the latest set of release files is source format. Returns False if not.

>>> package = yarg.get('yarg')
>>> package.has_source
True
release_ids[source]
>>> package = yarg.get('yarg')
>>> package.release_ids
[u'0.0.1', u'0.0.5', u'0.1.0']
release(release_id)[source]

A list of yarg.release.Release objects for each file in a release.

Parameters:release_id

A pypi release id.

>>> package = yarg.get('yarg')
>>> last_release = yarg.releases[-1]
>>> package.release(last_release)
[<Release 0.1.0>, <Release 0.1.0>]

Release Object

class yarg.release.Release(release_id, pypi_dict)[source]

A release file from PyPI.

Parameters:
  • release_id – A release id.
  • pypi_dict – A dictionary of a release file.
release_id[source]
>>> package = yarg.get('yarg')
>>> v = "0.1.0"
>>> r = package.release(v)
>>> r[0].release_id
u'0.1.0'
uploaded[source]
>>> package = yarg.get('yarg')
>>> v = "0.1.0"
>>> r = package.release(v)
>>> r.uploaded
datetime.datime(2014, 8, 7, 21, 26, 19)
python_version[source]
>>> package = yarg.get('yarg')
>>> v = "0.1.0"
>>> r = package.release(v)
>>> r.python_version
u'2.7'
url[source]
>>> package = yarg.get('yarg')
>>> v = "0.1.0"
>>> r = package.release(v)
>>> r.url
u'https://pypi.python.org/packages/2.7/y/yarg/yarg...'
md5_digest[source]
>>> package = yarg.get('yarg')
>>> v = "0.1.0"
>>> r = package.release(v)
>>> r.md5_digest
u'bec88e1c1765ca6177360e8f37b44c5c'
filename[source]
>>> package = yarg.get('yarg')
>>> v = "0.1.0"
>>> r = package.release(v)
>>> r.filename
u'yarg-0.1.0-py27-none-any.whl'
size[source]
>>> package = yarg.get('yarg')
>>> v = "0.1.0"
>>> r = package.release(v)
>>> r.size
52941
package_type[source]
>>> package = yarg.get('yarg')
>>> v = "0.1.0"
>>> r = package.release(v)
>>> r.package_type
u'wheel'
has_sig[source]
>>> package = yarg.get('yarg')
>>> v = "0.1.0"
>>> r = package.release(v)
>>> r.has_sig
True

Exceptions and Errors

class yarg.exceptions.HTTPError(*args, **kwargs)[source]

A catchall HTTPError exception to handle HTTP errors when using yarg.get().

This exception is also loaded at yarg.HTTPError for ease of access.

Member:status_code
errno

exception errno

filename

exception filename

strerror

exception strerror

Fork me on GitHub

Table Of Contents

Related Topics

This Page