simpypi

view README.txt @ 81:c61d0fe16509

add links
author Jeff Hammel <jhammel@mozilla.com>
date Mon Mar 05 09:24:47 2012 -0800 (14 months ago)
parents 0f3603a3d37d
children
line source
1 simpypi
2 =======
4 Simple python package index
6 How simpypi works
7 -----------------
9 The heart of simpypi is ``simpypi.wsgi.SimPyPI``, a simple
10 `WSGI <http://www.python.org/dev/peps/pep-0333/>`_ web app that
11 accepts a uploaded
12 `python package <http://guide.python-distribute.org/introduction.html>`_
13 distribution and places it according to its name and version metadata
14 appropriate to the
15 `simple index protocol <http://guide.python-distribute.org/contributing.html#the-simple-index-protocol>`_ .
17 For security, ``SimPyPI`` returns straight
18 `HTTP 400 <http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html>`_ s
19 for invalid requests. This could probably be improved.
21 ``SimPyPI`` itself does not serve this directory. The directory
22 should be served by a fileserver that will generate directory indices
23 (as apprpropriate to
24 http://guide.python-distribute.org/contributing.html#the-simple-index-protocol
25 ) such as Apache or
26 `FileServer <http://pypi.python.org/pypi/FileServer>`_ .
27 ``simpypi.factory.factory`` does provide a factory to make a WSGI app
28 that wraps ``FileServer`` in middleware and serves the simple index
29 under ``/index/`` and the ``SimPyPI`` app at ``/``. Additionally, a
30 ``simpypi`` command line program is provided that front-ends this.
32 Currently ``simpypi`` only works on source distributions (that is,
33 packages made with ``python setup.py sdist``).
35 Example
36 -------
38 I installed an instance of ``simpypi`` at http://k0s.org:8080 for
39 demonstration purposes with a package index at http://k0s.org:8080/index/ .
40 For testing purposes, I made a script,
41 `upload_mobase.py <http://k0s.org/mozilla/hg/simpypi/file/tip/tests/upload_mozbase.py>`_
42 that uploads the
43 `mozbase <https://github.com/mozilla/mozbase>`_ packages to
44 ``simpypi``. So the
45 `index <http://k0s.org:8080/index/>`_ is now populated with them.
47 You can upload packages with
48 `curl <http://www.cs.sunysb.edu/documentation/curl/>`_ ::
50 > wget http://pypi.python.org/packages/source/P/PyYAML/PyYAML-3.10.tar.gz
51 > curl -F 'package=@PyYAML-3.10.tar.gz' http://k0s.org:8080/
53 You can ``easy_install`` mozbase from http://k0s.org:8080/index/ .
54 If a package's dependencies can be found from the ``simpypi`` package
55 index, they will also be installed from the index::
57 > virtualenv.py tmp
58 New python executable in tmp/bin/python
59 Installing setuptools............done.
60 Installing pip...............done.
61 > cd tmp/
62 (tmp)│easy_install -i http://k0s.org:8080/index/ mozrunner
63 Searching for mozrunner
64 Reading http://k0s.org:8080/index/mozrunner/
65 Best match: mozrunner 5.1
66 Downloading http://k0s.org:8080/index/mozrunner/mozrunner-5.1.tar.gz
67 Processing mozrunner-5.1.tar.gz
68 Running mozrunner-5.1/setup.py -q bdist_egg --dist-dir
69 /tmp/easy_install-gqerOV/mozrunner-5.1/egg-dist-tmp-Qyx3Cr
70 Adding mozrunner 5.1 to easy-install.pth file
71 Installing mozrunner script to /home/jhammel/tmp/bin
72 Installed
73 /home/jhammel/tmp/lib/python2.7/site-packages/mozrunner-5.1-py2.7.egg
74 Processing dependencies for mozrunner
75 Searching for mozprofile>=0.1
76 Reading http://k0s.org:8080/index/mozprofile/
77 Best match: mozprofile 0.1
78 Downloading http://k0s.org:8080/index/mozprofile/mozprofile-0.1.tar.gz
79 Processing mozprofile-0.1.tar.gz
80 Running mozprofile-0.1/setup.py -q bdist_egg --dist-dir
81 /tmp/easy_install-4Im6x0/mozprofile-0.1/egg-dist-tmp-9Jp5TR
82 Adding mozprofile 0.1 to easy-install.pth file
83 Installing mozprofile script to /home/jhammel/tmp/bin
84 Installed
85 /home/jhammel/tmp/lib/python2.7/site-packages/mozprofile-0.1-py2.7.egg
86 Searching for mozprocess
87 Reading http://k0s.org:8080/index/mozprocess/
88 Best match: mozprocess 0.1b2
89 Downloading
90 http://k0s.org:8080/index/mozprocess/mozprocess-0.1b2.tar.gz
91 Processing mozprocess-0.1b2.tar.gz
92 Running mozprocess-0.1b2/setup.py -q bdist_egg --dist-dir
93 /tmp/easy_install-KU6AiF/mozprocess-0.1b2/egg-dist-tmp-4j5CMP
94 Adding mozprocess 0.1b2 to easy-install.pth file
95 Installed
96 /home/jhammel/tmp/lib/python2.7/site-packages/mozprocess-0.1b2-py2.7.egg
97 Searching for mozinfo
98 Reading http://k0s.org:8080/index/mozinfo/
99 Best match: mozinfo 0.3.3
100 Downloading http://k0s.org:8080/index/mozinfo/mozinfo-0.3.3.tar.gz
101 Processing mozinfo-0.3.3.tar.gz
102 Running mozinfo-0.3.3/setup.py -q bdist_egg --dist-dir
103 /tmp/easy_install-JaKeaz/mozinfo-0.3.3/egg-dist-tmp-xWojez
104 Adding mozinfo 0.3.3 to easy-install.pth file
105 Installing mozinfo script to /home/jhammel/tmp/bin
106 Installed
107 /home/jhammel/tmp/lib/python2.7/site-packages/mozinfo-0.3.3-py2.7.egg
108 Searching for ManifestDestiny>=0.5.4
109 Reading http://k0s.org:8080/index/ManifestDestiny/
110 Best match: ManifestDestiny 0.5.4
111 Downloading
112 http://k0s.org:8080/index/ManifestDestiny/ManifestDestiny-0.5.4.tar.gz
113 Processing ManifestDestiny-0.5.4.tar.gz
114 Running ManifestDestiny-0.5.4/setup.py -q bdist_egg --dist-dir
115 /tmp/easy_install-2blF3S/ManifestDestiny-0.5.4/egg-dist-tmp-R3KZde
116 Adding ManifestDestiny 0.5.4 to easy-install.pth file
117 Installing manifestparser script to /home/jhammel/tmp/bin
118 Installed
119 /home/jhammel/tmp/lib/python2.7/site-packages/ManifestDestiny-0.5.4-py2.7.egg
120 Finished processing dependencies for mozrunner
122 Note that all of the packages come from the k0s.org installation and
123 not from http://pypi.python.org/ .
126 Running the Tests
127 -----------------
129 The
130 `tests directory <http://k0s.org/mozilla/hg/simpypi/file/tip/tests>`_
131 contains
132 `doctests <http://docs.python.org/library/doctest.html>`_ and
133 the test-runner,
134 `test.py <http://k0s.org/mozilla/hg/simpypi/file/tip/tests/test.py>`_ .
135 These tests illustrate basic functionality and protect from
136 regressions if they are run before code is committed.
137 ``tests-require.txt`` contains dependencies that should be installed
138 to run the tests.
139 `Paste <http://pythonpaste.org/>`_
140 `TestApp <http://pythonpaste.org/testing-applications.html>`_ ,
141 though this could be transitioned to
142 `WebTest <http://webtest.pythonpaste.org/en/latest/index.html>`_ .
143 `virtualenv <http://www.virtualenv.org/>`_
144 is used for isolating python environments.
146 To run the tests, do::
148 python test.py
150 TODO
151 ----
153 While simpypi is pretty simple, just because it is only 100 lines of
154 code doesn't mean that it is the *right* 100 lines of code. The
155 following issues could be addressed:
157 * the temporary package should be dealt with entirely in memory,
158 ideally. Currently we write to a file and move it.
160 * ``simpypi`` use ``pkginfo.sdist`` to read the data from a source
161 distribution. Instead, the uploaded package should probably be
162 unpacked and ``python setup.py sdist`` run and the resulting
163 package put in the appropriate place. This will allow archives
164 without ``PKG-INFO``
165 (e.g. http://hg.mozilla.org/build/talos/archive/tip.tar.gz )
166 to be uploaded as well as at least partially correct for the fact
167 that currently ``simpypi`` only works for uploaded source
168 distributions.
170 * ``simpypi`` does not accept packages upload in the usual python
171 way, e.g. ``python setup.py sdist upload -r http://url.of/simpypi`` .
172 It should.
174 Parallel Solutions
175 ------------------
177 * https://github.com/SurveyMonkey/CheesePrism
179 Reference
180 ---------
182 * http://k0s.org/portfolio/pypi.html
183 * http://guide.python-distribute.org/contributing.html#the-simple-index-protocol
184 * http://www.python.org/~jeremy/weblog/030924.html
185 * https://bugzilla.mozilla.org/show_bug.cgi?id=701506
187 --
189 http://k0s.org/mozilla/hg/simpypi