Skip to main content

A mapping view to pypi projects

Project description

yp

A mapping view to pypi projects

To install: pip install yp

See also: pipoke, for more pypi interaction tools.

Example Usage

Get a mapping of all of pypi projects.

>>> from yp import Pypi
>>> p = Pypi()

The keys of this mapping are the project names. There are lots!

>>> len(p)  # doctest: +SKIP
405120
>>> 'numpy' in p and 'dol' in p
True
>>> 'no_way_this_is_a_package' in p
False

The values of the mapping are the corresponding project's info, which is a nested dict of good stuff.

>>> info = p['numpy']
>>> list(info)
['info', 'last_serial', 'releases', 'urls', 'vulnerabilities']

Tip: To only get the info you want, you'll

The project info is obtained, live, making requests to the https://pypi.python.org/pypi/{pkg_name}/json API, but the list of all project names is actually taken from a local file. You should update that file regularly (but not TOO regularly!) to be in sync with pypi.org. To do so, do this:

>>> Pypi.refresh_cached_package_names()  # doctest: +SKIP

If, on the other hand, you don't want all projects of Pypi to be the collection you're working with, you can specify what user they should belong to:

>>> p = Pypi(user='thorwhalen1')
>>> len(p)  # doctest: +SKIP
131

You can also explicitly give Pypi a collection of projects you want to work with:

>>> p = Pypi(proj_names={'numpy', 'pandas', 'dol'})
>>> len(p)
3

You can do a lot more by simply using the tools of dol to change the mapping you want to work with in all kinds of ways!

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

yp-0.0.7.tar.gz (9.7 kB view details)

Uploaded Source

Built Distribution

yp-0.0.7-py3-none-any.whl (10.8 kB view details)

Uploaded Python 3

File details

Details for the file yp-0.0.7.tar.gz.

File metadata

  • Download URL: yp-0.0.7.tar.gz
  • Upload date:
  • Size: 9.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.13

File hashes

Hashes for yp-0.0.7.tar.gz
Algorithm Hash digest
SHA256 09955b77ea3467429831e44176c4293c4e4a12a753889eb88c5d031928c50e93
MD5 9f2175104055a9c58066247c885eb86a
BLAKE2b-256 5ffe075774c5be751c46e57fbdc32d22938568d87eda5d5b9bf3b7f9a0d69aa4

See more details on using hashes here.

File details

Details for the file yp-0.0.7-py3-none-any.whl.

File metadata

  • Download URL: yp-0.0.7-py3-none-any.whl
  • Upload date:
  • Size: 10.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.13

File hashes

Hashes for yp-0.0.7-py3-none-any.whl
Algorithm Hash digest
SHA256 0b22b9219ff3799b84f5d74fe003d9987bddd38d2b8a2fb4c7d1de518cb7230d
MD5 20fce92820c01829e6e88e84146c9610
BLAKE2b-256 2bbeffd3c0598ad28f4484d927b7c7035c68d00947a049f6921f6ac198cb1551

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page