mirror of
https://github.com/kennethreitz/dive-into-python3.git
synced 2026-06-05 23:10:17 +00:00
links to PyMOTW
This commit is contained in:
@@ -626,6 +626,8 @@ NameError: name '__import__' is not defined</samp></pre>
|
||||
<h2 id=furtherreading>Further Reading</h2>
|
||||
|
||||
<ul>
|
||||
<li><a href=http://docs.python.org/3.1/library/itertools.html><code>itertools</code> module</a>
|
||||
<li><a href=http://www.doughellmann.com/PyMOTW/itertools/><code>itertools</code> — Iterator functions for efficient looping</a>
|
||||
<li><a href=http://blip.tv/file/1947373/>Watch Raymond Hettinger’s “Easy AI with Python” talk</a> at PyCon 2009
|
||||
<li><a href=http://code.activestate.com/recipes/576615/>Recipe 576615: Alphametics solver</a>, Raymond Hettinger’s original alphametics solver for Python 2
|
||||
<li><a href=http://code.activestate.com/recipes/users/178123/>More of Raymond Hettinger’s recipes</a> in the ActiveState Code repository
|
||||
|
||||
@@ -344,8 +344,13 @@ body{counter-reset:h1 3}
|
||||
<h2 id=furtherreading>Further Reading</h2>
|
||||
<ul>
|
||||
<li><a href=http://docs.python.org/3.1/library/os.html><code>os</code> module</a>
|
||||
<li><a href=http://www.doughellmann.com/PyMOTW/os/><code>os</code> — Portable access to operating system specific features</a>
|
||||
<li><a href=http://docs.python.org/3.1/library/os.path.html><code>os.path</code> module</a>
|
||||
<li><a href=http://www.doughellmann.com/PyMOTW/ospath/><code>os.path</code> — Platform-independent manipulation of file names</a>
|
||||
<li><a href=http://docs.python.org/3.1/library/glob.html><coe>glob</code> module</a>
|
||||
<li><a href=http://www.doughellmann.com/PyMOTW/glob/><code>glob</code> — Filename pattern matching</a>
|
||||
<li><a href=http://docs.python.org/3.1/library/time.html><code>time</code> module</a>
|
||||
<li><a href=http://www.doughellmann.com/PyMOTW/time/><code>time</code> — Functions for manipulating clock time</a>
|
||||
<li><a href=http://docs.python.org/3.1/tutorial/datastructures.html#list-comprehensions>List comprehensions</a>
|
||||
<li><a href=http://docs.python.org/3.1/tutorial/datastructures.html#nested-list-comprehensions>Nested list comprehensions</a>
|
||||
<li><a href=http://docs.python.org/3.1/tutorial/datastructures.html#looping-techniques>Looping techniques</a>
|
||||
|
||||
@@ -28,7 +28,9 @@ body{counter-reset:h1 15}
|
||||
|
||||
<ul>
|
||||
<li><a href=http://docs.python.org/3.1/library/threading.html><code>threading</code> module</a>
|
||||
<li><a href=http://www.doughellmann.com/PyMOTW/threading/><code>threading</code> — Manage concurrent threads</a>
|
||||
<li><a href=http://docs.python.org/3.1/library/multiprocessing.html><code>multiprocessing</code> module</a>
|
||||
<li><a href=http://www.doughellmann.com/PyMOTW/multiprocessing/><code>multiprocessing</code> — Manage processes like threads</a>
|
||||
<li><a href=http://jessenoller.com/2009/02/01/python-threads-and-the-global-interpreter-lock/>Python threads and the Global Interpreter Lock</a>
|
||||
<li><a href=http://blip.tv/file/2232410>Watch David Beazley’s “Inside the Python <abbr>GIL</abbr>” talk at PyCon 2009</a>
|
||||
</ul>
|
||||
|
||||
+6
-5
@@ -34,7 +34,7 @@ from distutils.core import setup
|
||||
setup(
|
||||
name = "chardet",
|
||||
packages = ["chardet"],
|
||||
version = "1.0.1",
|
||||
version = "1.0.2",
|
||||
description = "Universal encoding detector",
|
||||
author = "Mark Pilgrim",
|
||||
author_email = "mark@diveintomark.org",
|
||||
@@ -121,7 +121,7 @@ This version requires Python 3 or later; a Python 2 version is available separat
|
||||
<li>If your Python software is a single <code>.py</code> file, you should put it in the root directory along with your “read me” file and your setup script. But <code>httplib2</code> is not a single <code>.py</code> file; it’s <a href=case-study-porting-chardet-to-python-3.html#multifile-modules>a multi-file module</a>. But that’s OK! Just put the <code>httplib2</code> directory in the root directory, so you have an <code>__init__.py</code> file within an <code>httplib2/</code> directory within the <code>httplib2/</code> root directory. That’s not a problem; in fact, it will simplify your packaging process.
|
||||
</ol>
|
||||
|
||||
<p>The <code>chardet</code> directory looks slightly different. Like <code>httplib2</code>, it’s <a href=case-study-porting-chardet-to-python-3.html#multifile-modules>a multi-file module</a>, so there’s a <code>chardet/</code> directory within the <code>chardet/</code> root directory. In addition to the <code>README.txt</code> file, <code>chardet</code> has <abbr>HTML</abbr>-formatted documentation in the <code>docs/</code> directory. The <code>docs/</code> directory contains several <code>.html</code> files and an <code>images/</code> subdirectory, which contains several <code>.png</code> and <code>.gif</code> files. (This will be important later.) Also, in keeping with the convention for <abbr>(L)GPL</abbr>-licensed software, it has a separate file called <code>COPYING.txt</code> which contains the complete text of the <abbr>LGPL</abbr>.
|
||||
<p>The <code>chardet</code> directory looks slightly different. Like <code>httplib2</code>, it’s <a href=case-study-porting-chardet-to-python-3.html#multifile-modules>a multi-file module</a>, so there’s a <code>chardet/</code> directory within the <code>chardet/</code> root directory. In addition to the <code>README.txt</code> file, <code>chardet</code> has <abbr>HTML</abbr>-formatted documentation in the <code>docs/</code> directory. The <code>docs/</code> directory contains several <code>.html</code> and <code>.css</code> files and an <code>images/</code> subdirectory, which contains several <code>.png</code> and <code>.gif</code> files. (This will be important later.) Also, in keeping with the convention for <abbr>(L)GPL</abbr>-licensed software, it has a separate file called <code>COPYING.txt</code> which contains the complete text of the <abbr>LGPL</abbr>.
|
||||
|
||||
<pre class=nd><code>
|
||||
chardet/
|
||||
@@ -283,11 +283,11 @@ Topic :: Software Development :: Libraries :: Python Modules</code></pre>
|
||||
|
||||
<p>This is the entire manifest file for the <code>chardet</code> project:
|
||||
|
||||
<pre class=nd><code><a>include COPYING.txt <span class=u>①</span></a>
|
||||
<a>recursive-include docs *.html *.png *.gif <span class=u>②</span></a></code></pre>
|
||||
<pre class=nd><code><a>include COPYING.txt <span class=u>①</span></a>
|
||||
<a>recursive-include docs *.html *.css *.png *.gif <span class=u>②</span></a></code></pre>
|
||||
<ol>
|
||||
<li>The first line is self-explanatory: include the <code>COPYING.txt</code> file from the project’s root directory.
|
||||
<li>The second line is a bit more complicated. The <code>recursive-include</code> command takes a directory name and one or more filenames. The filenames aren’t limited to specific files; they can include wildcards. This line means “See that <code>docs/</code> directory in the project’s root directory? Look in there (recursively) for <code>.html</code>, <code>.png</code>, and <code>.gif</code> files. I want all of them in my release package.”
|
||||
<li>The second line is a bit more complicated. The <code>recursive-include</code> command takes a directory name and one or more filenames. The filenames aren’t limited to specific files; they can include wildcards. This line means “See that <code>docs/</code> directory in the project’s root directory? Look in there (recursively) for <code>.html</code>, <code>.css</code>, <code>.png</code>, and <code>.gif</code> files. I want all of them in my release package.”
|
||||
</ol>
|
||||
|
||||
<p>All manifest commands preserve the directory structure that you set up in your project directory. That <code>recursive-include</code> command is not going to put a bunch of <code>.html</code> and <code>.png</code> files in the root directory of the release package. It’s going to maintain the existing <code>docs/</code> directory structure, but only include those files inside that directory that match the given wildcards. (I didn’t mention it earlier, but the <code>chardet</code> documentation is actually written in <abbr>XML</abbr> and converted to <abbr>HTML</abbr> by a separate script. I don’t want to include the <abbr>XML</abbr> files in the release package, just the <abbr>HTML</abbr> and the images.)
|
||||
@@ -320,6 +320,7 @@ warning: check: missing required meta-data: version</samp></pre>
|
||||
<p>Distutils supports building multiple types of release packages. At a minimum, you should build a “source distribution” that contains your source code, your Distutils setup script, your “read me” file, and whatever <a href=#manifest>additional files you want to include</a>. To build a source distribution, pass the <code>sdist</code> command to your Distutils setup script.
|
||||
|
||||
<pre class=screen>
|
||||
FIXME again
|
||||
<samp class=p>c:\Users\pilgrim\chardet> </samp><kbd><mark>c:\python31\python.exe setup.py sdist</mark></kbd>
|
||||
<samp>running sdist
|
||||
running check
|
||||
|
||||
+8
-1
@@ -26,8 +26,15 @@ body{counter-reset:h1 13}
|
||||
|
||||
<h2 id=furtherreading>Further Reading</h2>
|
||||
|
||||
<blockquote class=note>
|
||||
<p><span class=u>☞</span>Many articles about the <code>pickle</code> module make references to <code>cPickle</code>. In Python 2, there were two implementations of the <code>pickle</code> module, one written in pure Python and another written in C (but still callable from Python). In Python 3, <a href=porting-code-to-python-3-with-2to3.html#othermodules>these two modules have been consolidated</a>, so you should always just <code>import pickle</code>. You may find these articles useful, but you should ignore the now-obsolete information about <code>cPickle</code>.
|
||||
</blockquote>
|
||||
|
||||
<ul>
|
||||
<li>FIXME
|
||||
<li><a href=http://wiki.python.org/moin/UsingPickle>Using <code>pickle</code></a>
|
||||
<li><a href=http://www.doughellmann.com/PyMOTW/pickle/><code>pickle</code> and <code>cPickle</code> — Python object serialization</a>
|
||||
<li><a href=http://www.ibm.com/developerworks/library/l-pypers.html>Python persistence management</a>
|
||||
<li><a href=http://www.doughellmann.com/PyMOTW/json/><code>json</code> — JavaScript Object Notation Serializer</a>
|
||||
</ul>
|
||||
|
||||
<p class=v><a rel=prev href=xml.html title='back to “XML”'><span class=u>☜</span></a> <a rel=next href=http-web-services.html title='onward to “HTTP Web Services”'><span class=u>☞</span></a>
|
||||
|
||||
Reference in New Issue
Block a user