You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
I am trying to maintain a local copy of package metadata. That means calling the JSON API for any new or changed packages. But there's no JSON API to find what has changed, so I have to use the XMLRPC API.
The changed_packages and updated_releases APIs documented here don't seem to exist. So I use the list_packages_with_serial API to get information on when packages changed, and select out the records that I need.
However, it appears that list_packages_with_serial returns packages that don't have a JSON record:
Looking at the changelog, it looks like the gnu package was deleted. OK, maybe if I use list_packages I can get just the current packages. I'll still need the list_packages_with_serial data, so it's an extra call, but maybe it will help. Nope, no such luck.
>>> all = pypi.list_packages()
>>> 'gnu' in all
True
The simple API also thinks gnu exists, although there are no links for it. The serial number on the simple page matches the XMLRPC value:
So how can I get a list of all packages which can be successfully queried using the JSON API? If the various APIs gave consistent results, my current approach would work. But given the inconsistencies, the lack of a JSON API is difficult to work around. It's actually difficult to even define what my code should be doing - is a project that exists in the simple index but not in the JSON API a valid project? Pip can will recognise it and can try to install it, but there's no PyPI page for it.
There's also mention of an RSS API, but that doesn't seem to include a way to specify the date from which you want to see what's changed.
Expected behavior
The JSON, simple and XMLRPC APIs give consistent results.
To Reproduce
See above - the XMLRPC calls return the package gnu but it's not in the JSON API.
My Platform
I'm not sure what is relevant here. I'm on Windows 10, with a simple network connection to PyPI through my ISP. I'm testing the APIs using adhoc Python code in Python 3.9 (my actual code is a more complex script, but the above snippets demonstrate the problem in isolation).
Additional context
Is there a better way that I should be using to (in effect) maintain a mirror of the PyPI metadata, without needing to make an excessive number of calls to the PyPI server? I've considered parsing the changelog data, but the undocumented and relatively free-form nature of the "action" field makes this seem even more fragile than my current approach.
I'm aware of the work on documenting and improving the JSON API happening at pypa/packaging-problems#367 but the first stage of that seems more about reorganising the existing API, and not adding new functionality (and worryingly, there seems to be an implication that the XMLRPC API can be deprecated in favour of the JSON API, which clearly isn't the case while there's no "list all packages" and "list all changes since " APIs.
The text was updated successfully, but these errors were encountered:
Describe the bug
I am trying to maintain a local copy of package metadata. That means calling the JSON API for any new or changed packages. But there's no JSON API to find what has changed, so I have to use the XMLRPC API.
The
changed_packages
andupdated_releases
APIs documented here don't seem to exist. So I use thelist_packages_with_serial
API to get information on when packages changed, and select out the records that I need.However, it appears that
list_packages_with_serial
returns packages that don't have a JSON record:Looking at the changelog, it looks like the
gnu
package was deleted. OK, maybe if I uselist_packages
I can get just the current packages. I'll still need thelist_packages_with_serial
data, so it's an extra call, but maybe it will help. Nope, no such luck.The simple API also thinks
gnu
exists, although there are no links for it. The serial number on the simple page matches the XMLRPC value:So how can I get a list of all packages which can be successfully queried using the JSON API? If the various APIs gave consistent results, my current approach would work. But given the inconsistencies, the lack of a JSON API is difficult to work around. It's actually difficult to even define what my code should be doing - is a project that exists in the simple index but not in the JSON API a valid project? Pip can will recognise it and can try to install it, but there's no PyPI page for it.
There's also mention of an RSS API, but that doesn't seem to include a way to specify the date from which you want to see what's changed.
Expected behavior
The JSON, simple and XMLRPC APIs give consistent results.
To Reproduce
See above - the XMLRPC calls return the package
gnu
but it's not in the JSON API.My Platform
I'm not sure what is relevant here. I'm on Windows 10, with a simple network connection to PyPI through my ISP. I'm testing the APIs using adhoc Python code in Python 3.9 (my actual code is a more complex script, but the above snippets demonstrate the problem in isolation).
Additional context
Is there a better way that I should be using to (in effect) maintain a mirror of the PyPI metadata, without needing to make an excessive number of calls to the PyPI server? I've considered parsing the changelog data, but the undocumented and relatively free-form nature of the "action" field makes this seem even more fragile than my current approach.
I'm aware of the work on documenting and improving the JSON API happening at pypa/packaging-problems#367 but the first stage of that seems more about reorganising the existing API, and not adding new functionality (and worryingly, there seems to be an implication that the XMLRPC API can be deprecated in favour of the JSON API, which clearly isn't the case while there's no "list all packages" and "list all changes since " APIs.
The text was updated successfully, but these errors were encountered: