Differences between revisions 3 and 11 (spanning 8 versions)
Revision 3 as of 2011-08-22 06:21:47
Size: 390
Editor: RichardJones
Comment:
Revision 11 as of 2014-04-17 10:21:38
Size: 1805
Editor: techtonik
Comment:
Deletions are marked like this. Additions are marked like this.
Line 1: Line 1:
[[CheeseShopDev|PyPI]] APIs: '''JSON''', [[PyPIXmlRpc|XMLRPC]].

This page is about development of [[http://pypi.python.org|Python Package Index]] (formerly known as Cheeseshop):

 * info: CheeseShop
 * apis: [[PyPIJSON|JSON]], [[PyPIXmlRpc|XMLRPC]]

= Developing the Package Index =

Line 3: Line 13:
  http://pypi.python.org/pypi/package_name/json
 .
 `http://pypi.python.org/pypi/<package_name>/json`



This retrieves information about the latest stable release (using [[http://www.python.org/dev/peps/pep-0386/|PEP 386]] ordering, falling back on older distutils ordering where packages are not PEP 386 compliant.) If you wish to retrieve information about a specific release you may use


 .
 `http://pypi.python.org/pypi/<package_name>/<version>/json`



You can use this to automatically generate a link to the latest release of your package with (assuming use of jQuery):





{{{
<span id="release_info" class="note">Download:
  <a href="http://pypi.python.org/pypi/roundup">latest</a></span>
<script type="text/javascript">
 $.getJSON('http://pypi.python.org/pypi/roundup/json?callback=?', function(data) {
     h = 'Download: ' + data.info.version;
     for (var i=0, url; url=data.urls[i]; ++i) {
       h += '<br><a href="' + url.url + '">' + url.filename + '</a>';
     }
     $('#release_info').html(h);
 });
</script>
}}}
Line 6: Line 49:

Line 11: Line 56:


See the [[http://pypi.python.org/pypi/sphinxcontrib-cheeseshop|sphinxcontrib-cheeseshop project]] documentation for more information.

PyPI APIs: JSON, XMLRPC.

This page is about development of Python Package Index (formerly known as Cheeseshop):

Developing the Package Index

You can access JSON information about packages by using the URL format

  • http://pypi.python.org/pypi/<package_name>/json

This retrieves information about the latest stable release (using PEP 386 ordering, falling back on older distutils ordering where packages are not PEP 386 compliant.) If you wish to retrieve information about a specific release you may use

  • http://pypi.python.org/pypi/<package_name>/<version>/json

You can use this to automatically generate a link to the latest release of your package with (assuming use of jQuery):

<span id="release_info" class="note">Download:
  <a href="http://pypi.python.org/pypi/roundup">latest</a></span>
<script type="text/javascript">
 $.getJSON('http://pypi.python.org/pypi/roundup/json?callback=?', function(data) {
     h = 'Download: ' + data.info.version;
     for (var i=0, url; url=data.urls[i]; ++i) {
       h += '<br><a href="' + url.url + '">' + url.filename + '</a>';
     }
     $('#release_info').html(h);
 });
</script>

Sphinx has support for putting an up-to-date Download link in your website using that JSON with one simple directive, for example (for the "roundup" package):

.. pypi-release:: Roundup
   :prefix: Download
   :class: note

See the sphinxcontrib-cheeseshop project documentation for more information.

PyPIJSON (last edited 2020-08-31 15:40:46 by JoshCooley)

Unable to edit the page? See the FrontPage for instructions.