Differences between revisions 29 and 82 (spanning 53 versions)
Revision 29 as of 2006-07-07 10:38:39
Size: 4261
Editor: RichardJones
Comment:
Revision 82 as of 2019-08-23 10:57:11
Size: 5122
Comment: removing legacy PyPI content, updating links
Deletions are marked like this. Additions are marked like this.
Line 1: Line 1:
This page documents the development of the Python Cheese Shop: This page is about development of the [[http://pypi.org|Python Package Index]] (formerly known as Cheeseshop):
Line 3: Line 3:
  http://cheeseshop.python.org  * More Info: CheeseShop
 * PyPI APIs: [[PyPIJSON|JSON]], [[PyPIXmlRpc|XMLRPC]]
Line 5: Line 6:
= Requests for new Trove categories = = Developing the Package Index =
Line 7: Line 8:
Python frameworks with plugins or packages that target the framework
can get their own category. The category should only be added *after*
such packages exist. Complimentary packages can link to each other
from their descriptions, they do not need a category to link them
together; only when packages are provided by different people does a
category need to be created. To ask for a category email
catalog-sig@python.org.
== PyPI.nextgen: ==
Line 15: Line 10:
= XML-RPC Interface = Currently, as of 2019-06-27, PyPI has undergone a complete rewrite from scratch, and as a result much of the information on this page is not up-to-date.
Line 17: Line 12:
The Cheese Shop has an XML-RPC interface which may be used by any 3rd-party application developer. See CheeseShopXmlRpc for details. The development moved from Mercurial (Python) to Git (C, shell). License changed from BSD-3 to Apache 2.0. Project code named 'warehouse' can be downloaded from:
Line 19: Line 14:
= Developing the Cheese Shop =  https://github.com/pypa/warehouse
Line 21: Line 16:
This information is for developers working on the PyPI code. The PyPI (packages index, Cheese Shop web interface) code resides in SVN at: == Testing Your Stuff Against PyPI ==
Line 23: Line 18:
  https://svn.python.org/packages/ (trunk,features,branches)

Developers with access may use this URL:

  svn+ssh://svn.python.org/data/repos/packages/trunk/pypi

Patches and bug reports should be submitted to:

  http://sourceforge.net/tracker/?group_id=66150&atid=513503

Discussion about the Cheese Shop should be had on the Catalog SIG mailing list:

  http://mail.python.org/mailman/listinfo/catalog-sig
If you need to test stuff against PyPI (registration, uploading, API activities) then please [[https://packaging.python.org/guides/using-testpypi/|use the alternative server, test.pypi.org]].
Line 40: Line 23:
 * [http://www.python.org/peps/pep-0345.html PEP for metadata 1.2] -- not finished and needs more catalog-sig discussion)
 * auto-generate download_urls for package uploads
 * command-line tool to query pypi and fetch entries
Meta-to-do: file the issues below that are still unresolved in [[https://github.com/pypa/warehouse/issues|the GitHub issue tracker]], then remove this section. -- SumanaHarihareswara <<DateTime(2019-08-23T06:57:10-0400)>>

 * A dump of download counts.
 * A big structured dump of all package meta-data.
 * A link from package to RTFD.
 * [[http://www.python.org/peps/pep-0345.html|PEP for metadata 1.2]] -- not finished and needs more catalog-sig discussion)
Line 44: Line 30:
 * tooltips for field labels
Line 46: Line 31:
 * auto-compute [http://pycheesecake.org Cheesecake] scores
 * moderated user reviews and ratings
 * "what's related" using classifiers and possibly user-supplied information
 * per-classifier "wiki" content to allow description and discussion around each classifier (perhaps what packages are available and how they relate to one another)
 * screenshot images (with thumbnailing and a "latest screenshot" on the front page?) - or perhaps icons instead of thumbnails for some packages?
Line 50: Line 34:
Something that's been requested, but needs much more thought and analysis to see whether it causes any problems: the ability to treat project names and versions as case-insensitive, while removing extraneous characters (as in pkg_resources.safe_name()) for
purposes both of searching and determining name uniqueness when registering.

Something that's been requested, but needs much more thought and analysis to see whether it causes any problems: the ability to treat project names and versions as case-insensitive, while removing extraneous characters (as in pkg_resources.safe_name()) for purposes both of searching and determining name uniqueness when registering.


=== Done ===


 * command-line tool to query pypi and fetch entries: [[http://pypi.python.org/pypi/yolk|yolk]]
Line 55: Line 46:
 * Edit [http://www.python.org/peps/pep-0243.html PEP 243] to reflect reality. The interface is implemented in the distutils register and upload commands. This code is good enough for documentation, especially because it's the only implementation necessary.
Line 57: Line 47:
== Development Environment Hints ==  * Edit [[http://www.python.org/peps/pep-0243.html|PEP 243]] to reflect reality. The interface is implemented in the distutils register and upload commands. This code is good enough for documentation, especially because it's the only implementation necessary.
 * moderated user reviews and ratings (this would require quite a lot of support from volunteers though)
Line 59: Line 50:
Before restoring database, "pypi" role must exists:
Line 61: Line 51:
{{{
  createuser pypi
}}}
== Proposals ==
Line 65: Line 53:
These are notes so we can remember how to dump / restore the packages database:
Line 67: Line 54:
{{{
  pg_dump -Fc -b packages >packages-20060706.dump
  createdb packages
  pg_restore -O -d packages -Fc packages-20060706.dump
}}}
 * [[http://wiki.python.org/moin/EnhancedPyPI|EnhancedPyPI]] Enhance multiple package index servers support in Distutils.
Line 73: Line 56:
Ask RichardJones if you need a database dump.
Line 75: Line 57:
PageTemplates are obtained from: == Previous PyPI version ==
Line 77: Line 59:
{{{
  svn co svn://svn.zope.org/repos/main/zope.pagetemplate/trunk zope. pagetemplate
  svn co svn://svn.zope.org/repos/main/zope.tal/trunk zope.tal
  svn co svn://svn.zope.org/repos/main/zope.interface/trunk zope.interface
  svn co svn://svn.zope.org/repos/main/zope.i18nmessageid/trunk zope.i18nmessageid
  svn co svn://svn.zope.org/repos/main/zope.tales/trunk zope.tales
}}}
The legacy version of PyPI is the code that was running on http://pypi.python.org for many years, till mid-2018. [[https://lwn.net/Articles/751458/|This LWN article goes into the history.]] The information below should help you get around the code.
Line 85: Line 61:
We also need to install ez_setup and docutils.  .
 The PyPI code was hosted under the Python Packaging Authority project: https://bitbucket.org/pypa/pypi and is now on GItHub: https://github.com/pypa/pypi-legacy
Line 87: Line 64:
Then go ahead and edit pypi.ini and this line in pypi.cgi:  .
 Bug and patch tracker https://github.com/pypa/pypi-legacy/issues
Line 89: Line 67:
{{{
  cfg = config.Config('/tmp/pypi.ini', 'webui')
}}}
 .
 [[http://mail.python.org/mailman/listinfo/distutils-sig|Mailing List]] ([[http://dir.gmane.org/gmane.comp.python.distutils|Gmane]] web interface)
Line 93: Line 70:
if your config.ini isn't in /tmp/pypi.ini. You can leave it as 'config.ini' if it's in the same directory as pypi.py.  .
 API that is used by easy_install http://peak.telecommunity.com/DevCenter/EasyInstall#package-index-api
Line 95: Line 73:
If you wish to test functionality that requires login, then you will need to configure your apache to pass through basic auth. You do this by adding lines '''similar''' to the following to your apache2 conf file:  * [[PyPIOAuth]] - authentication library for Google and Launchpad logins
Line 97: Line 75:
{{{
  RewriteCond %{HTTP:Authorization} ^(.+)$
Line 100: Line 76:
  RewriteRule ^/cgi-bin/pypi.cgi(.*) /Library/WebServer/CGI-Executables/pypi.cgi$1 [e=HTTP_CGI_AUTHORIZATION:%1,t=application/x-httpd-cgi,l]
}}}
== Legacy PyPI architecture and endpoints ==
Line 103: Line 78:
If this doesn't work, then you can use these lines to debug:
Line 105: Line 79:
{{{
  RewriteLog /var/log/httpd/rewrite.log
PyPI is a WSGI application that can be executed standalone using `python pypi.wsgi` command if all requirements are met. `pypi.wsgi` contains usual WSGI wrapper code and delegates request processing to `WebUI.run()` method from `webui.py`. This method just opens DB and handles exceptions, actual request processing is done in `WebUI.inner_run()`. This method analyzes URL endpoint and executes appropriate handler. As of 2011-04, the rules to match endpoints to handlers are the following:
Line 108: Line 81:
  RewriteLogLevel 9
}}}


||/simple ||WebUI.run_simple() ||dump all package names on single html page ||
||/simple/(.+)/ ||WebUI.run_simple() ||dump all links for a package in html list ||
||/serversig/(.+)/ ||.run_simple_sign() ||save as above, but signed by server ||
||/mirrors ||.mirrors() ||display static page with a list of mirrors ||
||/daytime ||.daytime() ||display current server time ||





...


XML-RPC requests are detected by CONTENT_TYPE=`text/xml` variable in CGI environment and processed by `rpc.RequestHandler().__call__()`. List of XML-RPC "endpoints" is available on [[PyPIXmlRpc]] page.



== Legacy PyPI Development Environment Hints ==

Removed (visible in [[https://wiki.python.org/moin/CheeseShopDev?action=recall&rev=81|page history]]) because developing and running legacy PyPI is deprecated. -- SumanaHarihareswara <<DateTime(2019-08-23T06:57:10-0400)>>

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

Developing the Package Index

PyPI.nextgen:

Currently, as of 2019-06-27, PyPI has undergone a complete rewrite from scratch, and as a result much of the information on this page is not up-to-date.

The development moved from Mercurial (Python) to Git (C, shell). License changed from BSD-3 to Apache 2.0. Project code named 'warehouse' can be downloaded from:

Testing Your Stuff Against PyPI

If you need to test stuff against PyPI (registration, uploading, API activities) then please use the alternative server, test.pypi.org.

TO-DO list

Meta-to-do: file the issues below that are still unresolved in the GitHub issue tracker, then remove this section. -- SumanaHarihareswara 2019-08-23 10:57:10

  • A dump of download counts.
  • A big structured dump of all package meta-data.
  • A link from package to RTFD.
  • PEP for metadata 1.2 -- not finished and needs more catalog-sig discussion)

  • documented procedures for "taking over" entries should the original owner of the entry go away (and any required system support)
  • change notification emails
  • per-classifier "wiki" content to allow description and discussion around each classifier (perhaps what packages are available and how they relate to one another)
  • screenshot images (with thumbnailing and a "latest screenshot" on the front page?) - or perhaps icons instead of thumbnails for some packages?

Something that's been requested, but needs much more thought and analysis to see whether it causes any problems: the ability to treat project names and versions as case-insensitive, while removing extraneous characters (as in pkg_resources.safe_name()) for purposes both of searching and determining name uniqueness when registering.

Done

  • command-line tool to query pypi and fetch entries: yolk

Not Going TO-DO

  • Edit PEP 243 to reflect reality. The interface is implemented in the distutils register and upload commands. This code is good enough for documentation, especially because it's the only implementation necessary.

  • moderated user reviews and ratings (this would require quite a lot of support from volunteers though)

Proposals

  • EnhancedPyPI Enhance multiple package index servers support in Distutils.

Previous PyPI version

The legacy version of PyPI is the code that was running on http://pypi.python.org for many years, till mid-2018. This LWN article goes into the history. The information below should help you get around the code.

Legacy PyPI architecture and endpoints

PyPI is a WSGI application that can be executed standalone using python pypi.wsgi command if all requirements are met. pypi.wsgi contains usual WSGI wrapper code and delegates request processing to WebUI.run() method from webui.py. This method just opens DB and handles exceptions, actual request processing is done in WebUI.inner_run(). This method analyzes URL endpoint and executes appropriate handler. As of 2011-04, the rules to match endpoints to handlers are the following:

/simple

WebUI.run_simple()

dump all package names on single html page

/simple/(.+)/

WebUI.run_simple()

dump all links for a package in html list

/serversig/(.+)/

.run_simple_sign()

save as above, but signed by server

/mirrors

.mirrors()

display static page with a list of mirrors

/daytime

.daytime()

display current server time

...

XML-RPC requests are detected by CONTENT_TYPE=text/xml variable in CGI environment and processed by rpc.RequestHandler().__call__(). List of XML-RPC "endpoints" is available on PyPIXmlRpc page.

Legacy PyPI Development Environment Hints

Removed (visible in page history) because developing and running legacy PyPI is deprecated. -- SumanaHarihareswara 2019-08-23 10:57:10

CheeseShopDev (last edited 2019-08-23 10:57:11 by SumanaHarihareswara)

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