<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>mFabrik - mobile sites, apps, HTML5 and CMS software development &#187; setuptools</title>
	<atom:link href="http://blog.mfabrik.com/tag/setuptools/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.mfabrik.com</link>
	<description>Freedom delivered.</description>
	<lastBuildDate>Wed, 03 Aug 2011 09:47:41 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Run your Python application using PyPy &#8211; it&#8217;s fast!</title>
		<link>http://blog.mfabrik.com/2011/03/26/run-your-python-application-using-pypy-its-fast/</link>
		<comments>http://blog.mfabrik.com/2011/03/26/run-your-python-application-using-pypy-its-fast/#comments</comments>
		<pubDate>Sat, 26 Mar 2011 18:14:18 +0000</pubDate>
		<dc:creator>Mikko Ohtamaa</dc:creator>
				<category><![CDATA[python]]></category>
		<category><![CDATA[technology]]></category>
		<category><![CDATA[compiler]]></category>
		<category><![CDATA[distribute]]></category>
		<category><![CDATA[easy_install]]></category>
		<category><![CDATA[jit]]></category>
		<category><![CDATA[multiprocessing]]></category>
		<category><![CDATA[osx]]></category>
		<category><![CDATA[plac]]></category>
		<category><![CDATA[pypy]]></category>
		<category><![CDATA[setuptools]]></category>

		<guid isPermaLink="false">http://blog.mfabrik.com/?p=1153</guid>
		<description><![CDATA[Try your Python application with PyPy, the new hot Python JIT compiler Your program will run faster&#8230; &#8230; faster&#8230; and ..faster! Here are quick instructions for using PyPy on OSX. You should be able to apply these instructions to other UNIX systems as well. Install PyPy by getting binary tarball. wget http://pypy.org/download/pypy-1.4.1-osx64.tar.bz2 tar -xjf pypy-1.4.1-osx64.tar.bz [...]]]></description>
			<content:encoded><![CDATA[<p>Try your Python application with <a href="http://pypy.org/">PyPy</a>, the new hot Python JIT compiler</p>
<ul>
<li>Your program will run faster&#8230;</li>
<li>&#8230; faster&#8230;</li>
<li>and ..faster!</li>
</ul>
<p>Here are quick instructions for using PyPy on OSX. You should be able to apply these instructions to other UNIX systems as well.</p>
<p><a href="http://pypy.org/download.html">Install PyPy by getting binary tarball</a>.</p>
<pre>wget http://pypy.org/download/pypy-1.4.1-osx64.tar.bz2
tar -xjf pypy-1.4.1-osx64.tar.bz</pre>
<p>Install Distribute / easy_install command (setuptools fork) in order to install third party libraries.</p>
<pre>cd pypy-1.4.1-osx64
wget http://python-distribute.org/distribute_setup.py
bin/pypy distribute_setup.py</pre>
<p>Install libraries &#8211; <em>easy_install</em> seems to run just fine on PyPy as long as you don&#8217;t try to install Python native extensions</p>
<pre>bin/easy_install plac # command line parser
bin/easy_install iso8601 # date format parser</pre>
<p>Then run your application</p>
<pre>~/code/pypy-1.4.1-osx64/bin/pypy exceptionanalysis.py     -s=2010-01-01T00:00:00 /Users/moo/xxx/log/client1.log</pre>
<p>In my case the application was a simple log analyzer based on Python generators (code will be posted later). It reads a text file and tries to interpret it. The script utilizes only one CPU core and thus is very CPU bound. The speed comparison results are</p>
<ul>
<li>With Python 2.4: Completed in 111.08 seconds</li>
<li>With PyPy: Completed in 30.39 seconds</li>
</ul>
<p><strong>That&#8217;s almost 4x speed-up!</strong></p>
<p>Things did not work with PyPy</p>
<ul>
<li>import multiprocessing &#8211; was not hard dependency, needed to comment out in plac_ext</li>
</ul>
<p>Here is the traceback if anyone can help:</p>
<pre>Traceback (most recent call last):
 File "app_main.py", line 53, in run_toplevel
 File "exceptionanalysis.py", line 20, in &lt;module&gt;
 import plac
 File "/Users/moo/code/pypy-1.4.1-osx64/site-packages/plac-0.8.0-py2.5.egg/plac.py", line 35, in &lt;module&gt;
 from plac_ext import Interpreter, import_main, ReadlineInput, stdout, runp, Monitor
 File "/Users/moo/code/pypy-1.4.1-osx64/site-packages/plac-0.8.0-py2.5.egg/plac_ext.py", line 7, in &lt;module&gt;
 import itertools, traceback, multiprocessing, signal, threading
 File "/Users/moo/code/pypy-1.4.1-osx64/site-packages/multiprocessing-2.6.2.1-py2.5-macosx-10.6-i386.egg/multiprocessing/__init__.py", line 87, in &lt;module&gt;
 import _multiprocessing
 File "/Users/moo/code/pypy-1.4.1-osx64/site-packages/multiprocessing-2.6.2.1-py2.5-macosx-10.6-i386.egg/multiprocessing/_multiprocessing.py", line 7, in &lt;module&gt;
 __bootstrap__()
 File "/Users/moo/code/pypy-1.4.1-osx64/site-packages/multiprocessing-2.6.2.1-py2.5-macosx-10.6-i386.egg/multiprocessing/_multiprocessing.py", line 6, in __bootstrap__
 imp.load_dynamic(__name__,__file__)
AttributeError: 'module' object has no attribute 'load_dynamic'</pre>
<p class="signature">
<a href="http://mfabrik.com/@@zoho-contact-form"><img valign="middle"  src="http://blog.mfabrik.com/wp-content/uploads/mfabrik-24.png"></a> <a href="http://mfabrik.com/@@zoho-contact-form">Get developers</a> <a href="http://feeds.feedburner.com/mFabrikWebAndMobileDevelopment" rel="alternate" type="application/rss+xml"><img valign="middle" src="http://www.feedburner.com/fb/images/pub/feed-icon16x16.png" alt="" style="vertical-align:middle;border:0"/></a> <a href="http://feeds.feedburner.com/mFabrikWebAndMobileDevelopment" rel="alternate" type="application/rss+xml">Subscribe mFabrik blog in a reader</a> <a href="http://twitter.com/mfabrik"> <img valign="middle"  src="http://blog.mfabrik.com/wp-content/uploads/twitter-24.png"></a> <a href="http://twitter.com/moo9000">Follow me on Twitter</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.mfabrik.com/2011/03/26/run-your-python-application-using-pypy-its-fast/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Installing MySQL-python connector on OSX</title>
		<link>http://blog.mfabrik.com/2011/03/02/installing-mysql-python-connector-on-osx/</link>
		<comments>http://blog.mfabrik.com/2011/03/02/installing-mysql-python-connector-on-osx/#comments</comments>
		<pubDate>Wed, 02 Mar 2011 19:22:29 +0000</pubDate>
		<dc:creator>Mikko Ohtamaa</dc:creator>
				<category><![CDATA[python]]></category>
		<category><![CDATA[technology]]></category>
		<category><![CDATA[buildout]]></category>
		<category><![CDATA[distribute]]></category>
		<category><![CDATA[easy_install]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[osx]]></category>
		<category><![CDATA[setuptools]]></category>

		<guid isPermaLink="false">http://blog.mfabrik.com/?p=1042</guid>
		<description><![CDATA[Preconditions You are using MySQL installation from mysql.com (and not e.g. from Macports) You want to install MySQL-python egg using easy_install or buildout You&#8217;ll get an error Getting distribution for 'MySQL-python'. install_dir /Users/moo/project/eggs/tmp8-j13e sh: mysql_config: command not found Traceback (most recent call last): File "&#60;string&#62;", line 1, in ? File "/Users/moo/code/collective.buildout.python/python-2.4/lib/python2.4/site-packages/distribute-0.6.14-py2.4.egg/setuptools/command/easy_install.py", line 1855, in main [...]]]></description>
			<content:encoded><![CDATA[<p>Preconditions</p>
<ul>
<li>You are using MySQL installation from mysql.com (and not e.g. from Macports)</li>
<li>You want to install <a href="http://pypi.python.org/pypi/MySQL-python/">MySQL-python egg</a> using easy_install or buildout</li>
</ul>
<p>You&#8217;ll get an error</p>
<pre>Getting distribution for 'MySQL-python'.
install_dir /Users/moo/project/eggs/tmp8-j13e
sh: mysql_config: command not found
Traceback (most recent call last):
 File "&lt;string&gt;", line 1, in ?
 File "/Users/moo/code/collective.buildout.python/python-2.4/lib/python2.4/site-packages/distribute-0.6.14-py2.4.egg/setuptools/command/easy_install.py", line 1855, in main
 with_ei_usage(lambda:
 File "/Users/moo/code/collective.buildout.python/python-2.4/lib/python2.4/site-packages/distribute-0.6.14-py2.4.egg/setuptools/command/easy_install.py", line 1836, in with_ei_usage
 return f()  
...

 31, in &lt;lambda&gt;
 {'__file__':setup_script, '__name__':'__main__'}
 File "setup.py", line 15, in ?
 File "/var/folders/O8/O8pt7q52F7Oi+P3O0pNqq++++TI/-Tmp-/easy_install-g5cvxl/MySQL-python-1.2.3/setup_posix.py", line 43, in get_config
 File "/var/folders/O8/O8pt7q52F7Oi+P3O0pNqq++++TI/-Tmp-/easy_install-g5cvxl/MySQL-python-1.2.3/setup_posix.py", line 24, in mysql_config
EnvironmentError: mysql_config not found
An error occured when trying to install MySQL-python 1.2.3.Look above this message for any errors thatwere output by easy_install.
While:
 Installing instance.
 Getting distribution for 'MySQL-python'.
Error: Couldn't install: MySQL-python 1.2.3</pre>
<p>The reason is that MySQL installer puts MySQL under /usr/local and does not expose MySQL utilites directly to path. MySQL-python expects to find utility <em>mysql_config</em> to configure compile time paths when building native bindings using GCC.</p>
<p>Workaround:</p>
<pre>sudo -i
cd /usr/bin
ln -s /usr/local/mysql-5.1.46-osx10.5-x86_64/bin/mysql_config .</pre>
<p>Then rerun installer.</p>
<p>Though it is a bit harsh solution to modify system folder, it gets the thing done in simple manner.
<p class="signature">
<a href="http://mfabrik.com/@@zoho-contact-form"><img valign="middle"  src="http://blog.mfabrik.com/wp-content/uploads/mfabrik-24.png"></a> <a href="http://mfabrik.com/@@zoho-contact-form">Get developers</a> <a href="http://feeds.feedburner.com/mFabrikWebAndMobileDevelopment" rel="alternate" type="application/rss+xml"><img valign="middle" src="http://www.feedburner.com/fb/images/pub/feed-icon16x16.png" alt="" style="vertical-align:middle;border:0"/></a> <a href="http://feeds.feedburner.com/mFabrikWebAndMobileDevelopment" rel="alternate" type="application/rss+xml">Subscribe mFabrik blog in a reader</a> <a href="http://twitter.com/mfabrik"> <img valign="middle"  src="http://blog.mfabrik.com/wp-content/uploads/twitter-24.png"></a> <a href="http://twitter.com/moo9000">Follow me on Twitter</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.mfabrik.com/2011/03/02/installing-mysql-python-connector-on-osx/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Subversion global-ignores and .egg-info in Python/Plone development</title>
		<link>http://blog.mfabrik.com/2009/10/03/subversion-global-ignores-and-egg-info-in-pythonplone-development/</link>
		<comments>http://blog.mfabrik.com/2009/10/03/subversion-global-ignores-and-egg-info-in-pythonplone-development/#comments</comments>
		<pubDate>Sat, 03 Oct 2009 12:47:04 +0000</pubDate>
		<dc:creator>Mikko Ohtamaa</dc:creator>
				<category><![CDATA[plone]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[technology]]></category>
		<category><![CDATA[egg-info]]></category>
		<category><![CDATA[global-ignores]]></category>
		<category><![CDATA[ignores]]></category>
		<category><![CDATA[setuptools]]></category>
		<category><![CDATA[subversion]]></category>
		<category><![CDATA[svn]]></category>
		<category><![CDATA[version control]]></category>

		<guid isPermaLink="false">http://blog.twinapex.fi/?p=286</guid>
		<description><![CDATA[Subversion does a good job by ignoring most of build/temporary/unwanted files by default. However, there is one exception still existing at least in Subversion 1.6: Python egg folders. All folders whose name ends up with .egg-info should not committed or considered in version controlling actions. your.package.name.egg-info folder is generated inside your Python egg source folder [...]]]></description>
			<content:encoded><![CDATA[<p>Subversion does a good job by ignoring most of build/temporary/unwanted files by default.</p>
<p>However, there is one exception still existing at least in Subversion 1.6: Python egg folders. All folders whose name ends up with <strong>.egg-info</strong> should not committed or considered in version controlling actions. your.package.name.egg-info folder is generated inside your Python egg source folder when you run setup.py / setuptools.</p>
<p>If you are working with Python source code eggs, add the following line to your ~/.subversion/config</p>
<pre>global-ignores = *.o *.lo *.la #*# .*.rej *.rej .*~ *~ .#* .DS_Store *.egg-info *.pyc *.pyo .project .pydevproject</pre>
<p>Otherwise development tools like <a href="http://pypi.python.org/pypi/mr.developer/">Mr. Developer</a> might get confused.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.mfabrik.com/2009/10/03/subversion-global-ignores-and-egg-info-in-pythonplone-development/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Setup.py sdist not including all files</title>
		<link>http://blog.mfabrik.com/2009/07/24/setup-py-sdist-not-including-all-files/</link>
		<comments>http://blog.mfabrik.com/2009/07/24/setup-py-sdist-not-including-all-files/#comments</comments>
		<pubDate>Fri, 24 Jul 2009 09:56:44 +0000</pubDate>
		<dc:creator>Mikko Ohtamaa</dc:creator>
				<category><![CDATA[plone]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[technology]]></category>
		<category><![CDATA[distribute]]></category>
		<category><![CDATA[files]]></category>
		<category><![CDATA[manifest]]></category>
		<category><![CDATA[package]]></category>
		<category><![CDATA[setuptools]]></category>

		<guid isPermaLink="false">http://blog.twinapex.fi/?p=230</guid>
		<description><![CDATA[Setuptools has many silent failure modes. One of them is failure to include all files in sdist release (well not exactly a failure, you could RTFM, but the default behavior is unexpected). This post will serve as a google-yourself-answer for this problem, until we get new, shinier, Distribute solving all of our problems. I b0rked [...]]]></description>
			<content:encoded><![CDATA[<p>Setuptools has many silent failure modes. One of them is failure to include all files in sdist release (well not exactly a failure, you could RTFM, but the default behavior is unexpected). This post will serve as a google-yourself-answer for this problem, until we get new, shinier, <a href="http://bitbucket.org/tarek/distribute/src/tip/README.txt">Distribute</a> solving all of our problems.</p>
<p>I b0rked the release for <a href="http://plone.org/products/twinapex-theme/">plonetheme.twinapex</a>. Version 1.0 package didn&#8217;t include media assets and ZCML configuration files. Luckily Python community reacted quickly and I got advised how to fix it.</p>
<p>By default, setuptools include only *.py files. You need to explicitly declare support for other filetypes in MANIFEST.in file.</p>
<p>Example MANIFEST.in (plonetheme, built in PyDev):</p>
<pre>recursive-include plonetheme *
recursive-include docs *
global-exclude *pyc
global-exclude .project
global-exclude .pydevproject</pre>
<p><strong>About the author Mikko Ohtamaa</strong></p>
<ul>
<li><a href="http://www.linkedin.com/in/ohtis  ">LinkedIn</a></li>
<li><a href="http://twitter.com/moo9000">Twitter</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://blog.mfabrik.com/2009/07/24/setup-py-sdist-not-including-all-files/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Mysterious buildout error &#8211; missing docs/HISTORY.txt file</title>
		<link>http://blog.mfabrik.com/2008/10/01/mysterious-buildout-error-missing-docshistorytxt-file/</link>
		<comments>http://blog.mfabrik.com/2008/10/01/mysterious-buildout-error-missing-docshistorytxt-file/#comments</comments>
		<pubDate>Wed, 01 Oct 2008 15:55:03 +0000</pubDate>
		<dc:creator>Mikko Ohtamaa</dc:creator>
				<category><![CDATA[Plone (old)]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[buildout]]></category>
		<category><![CDATA[develop]]></category>
		<category><![CDATA[easy_install]]></category>
		<category><![CDATA[egg]]></category>
		<category><![CDATA[setuptools]]></category>
		<category><![CDATA[site packages]]></category>
		<category><![CDATA[source code]]></category>

		<guid isPermaLink="false">http://blog.redinnovation.com/?p=128</guid>
		<description><![CDATA[I was getting the following error with Plone buildout &#8230; Develop: '/home/moo/workspace/collective.easytemplate' Traceback (most recent call last): File "/tmp/tmp_G8621", line 11, in ? File "/usr/lib/python2.4/site-packages/setuptools/command/easy_install.py", line 655, in install_eggs return self.build_and_install(setup_script, setup_base) File "/usr/lib/python2.4/site-packages/setuptools/command/easy_install.py", line 931, in build_and_install self.run_setup(setup_script, setup_base, args) File "/usr/lib/python2.4/site-packages/setuptools/command/easy_install.py", line 919, in run_setup run_setup(setup_script, args) File "/usr/lib/python2.4/site-packages/setuptools/sandbox.py", line 26, in run_setup [...]]]></description>
			<content:encoded><![CDATA[<p>I was getting the following error with Plone buildout</p>
<p>&#8230;</p>
<pre>Develop: '/home/moo/workspace/collective.easytemplate'
Traceback (most recent call last):
  File "/tmp/tmp_G8621", line 11, in ?
  File "/usr/lib/python2.4/site-packages/setuptools/command/easy_install.py", line 655, in install_eggs
    return self.build_and_install(setup_script, setup_base)
  File "/usr/lib/python2.4/site-packages/setuptools/command/easy_install.py", line 931, in build_and_install
    self.run_setup(setup_script, setup_base, args)
  File "/usr/lib/python2.4/site-packages/setuptools/command/easy_install.py", line 919, in run_setup
    run_setup(setup_script, args)
  File "/usr/lib/python2.4/site-packages/setuptools/sandbox.py", line 26, in run_setup
    DirectorySandbox(setup_dir).run(
  File "/usr/lib/python2.4/site-packages/setuptools/sandbox.py", line 63, in run
    return func()
  File "/usr/lib/python2.4/site-packages/setuptools/sandbox.py", line 29, in &lt;lambda&gt;
    {'__file__':setup_script, '__name__':'__main__'}
  File "setup.py", line 9, in ?
    return open(os.path.join(os.path.dirname(__file__), *rnames)).read()
  File "/usr/lib/python2.4/site-packages/setuptools/sandbox.py", line 166, in _open
    return _open(path,mode,*args,**kw)
IOError: [Errno 2] No such file or directory: 'docs/HISTORY.txt'
An internal error occured due to a bug in either zc.buildout or in a
recipe being used:
Traceback (most recent call last):
  File "/home/moo/workspace/Plone-3.1/eggs/zc.buildout-1.1.1-py2.4.egg/zc/buildout/buildout.py", line 1477, in main
    getattr(buildout, command)(args)
  File "/home/moo/workspace/Plone-3.1/eggs/zc.buildout-1.1.1-py2.4.egg/zc/buildout/buildout.py", line 324, in install
    installed_develop_eggs = self._develop()
  File "/home/moo/workspace/Plone-3.1/eggs/zc.buildout-1.1.1-py2.4.egg/zc/buildout/buildout.py", line 556, in _develop
    zc.buildout.easy_install.develop(setup, dest)
  File "/home/moo/workspace/Plone-3.1/eggs/zc.buildout-1.1.1-py2.4.egg/zc/buildout/easy_install.py", line 868, in develop
    assert os.spawnl(os.P_WAIT, executable, _safe_arg (executable), *args) == 0
AssertionError</pre>
<p>My product had docs folder. HISTORY.txt was there properly. This made me scratch my head for a while.</p>
<p>Buildout calls easy_install as an external process. If easy_install eggs have dependencies in their setup.py easy_install tries to download and install these eggs.</p>
<p><strong>There is no reported progress what eggs are installed in easy_install process created from buildout. </strong>Looks like buildout verbosity (-v) switch does not reach easy_install.</p>
<p>So the problem was not in my product, but in its dependency. However the debug output did not reveal that we were dealing with a dependency. Is there easy means to solve this kind of problems? I bluntly put debug prints inside my server wide setuptools Python files to known which was the faulty dependency.</p>
<p>It turned out that easy_install was trying to execute setup.py against a downloaded source distribution (.tar.gz). I had the same egg as a local source code copy. The source code contains docs folder, the egg doesn&#8217;t.</p>
<p>The solution was to change buildout.cfg develop directive to be the same as the flattened dependency order of the eggs (dependencies come top). This way setup.py was evaluated correctly against the source code folder.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.mfabrik.com/2008/10/01/mysterious-buildout-error-missing-docshistorytxt-file/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>

