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!
Extras
The yp.refresh_saved_pkg_name_stub() will go fetch the current list of pypi names and save them locally (in the package's data folder).
I do this from time to time and push the results. You can find a list (as a text file with one name per line) here: https://raw.githubusercontent.com/thorwhalen/yp/refs/heads/master/yp/data/pkg_list.txt
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file yp-0.0.11.tar.gz.
File metadata
- Download URL: yp-0.0.11.tar.gz
- Upload date:
- Size: 14.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.17
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0fb5e9483ee2357d54aaddeece6368b5b46c39769987b633253c18d2e6d84a7e
|
|
| MD5 |
3ded88f2378bf371c4edd41a21a4c824
|
|
| BLAKE2b-256 |
cf7d58f58cafe33ab2dc1056591ab41e8a3823e37f3ec5e9a659e428b7ba4595
|
File details
Details for the file yp-0.0.11-py3-none-any.whl.
File metadata
- Download URL: yp-0.0.11-py3-none-any.whl
- Upload date:
- Size: 15.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.17
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d6f8c8f7730e7a56d9daca029bd6505dbc0fbdc420c3f732dad87be0100405c3
|
|
| MD5 |
184b48d57c9767ad1e8ad1411f72ca49
|
|
| BLAKE2b-256 |
230fb8cd5169ae1720ff81d0be2b86a28dfe1564476481a4227ccc9964af52fb
|