Sean Gillies (Posts about packaging)https://sgillies.net/tags/packaging.atom2024-02-04T23:44:41ZSean GilliesNikolaFiona, Rasterio, Shapely binary wheels for OS Xhttps://sgillies.net/2015/01/24/fiona-rasterio-shapely-binary-wheels-for-os-x.html2015-01-24T00:00:00-07:002015-01-24T00:00:00-07:00Sean Gillies<p>Numpy and SciPy binaries for OS X have been up on PyPI for a few months and
I've recently figured out how to do the same for <a class="reference external" href="https://github.com/Toblerity/Fiona">Fiona</a>, <a class="reference external" href="https://github.com/mapbox/rasterio">Rasterio</a>, and <a class="reference external" href="https://github.com/Toblerity/Shapely">Shapely</a>.
As the SciPy developers do, I've used <a class="reference external" href="https://github.com/matthew-brett/delocate">delocate-wheel</a> to (see its README):</p>
<blockquote>
<ul class="simple">
<li><p>find dynamic libraries imported from python extensions</p></li>
<li><p>copy needed dynamic libraries to directory within package</p></li>
<li><p>update OSX install_names and rpath to cause code to load from copies of libraries</p></li>
</ul>
</blockquote>
<p>The new Fiona and Rasterio binaries are beefy (14MB) because they include the
non-standard libraries that enable format translation, cartographic projection,
and computational geometry operations:</p>
<div class="code"><pre class="code console"><a id="rest_code_d7a2cb64fecf4de29b8734a0bdc33650-1" name="rest_code_d7a2cb64fecf4de29b8734a0bdc33650-1" href="https://sgillies.net/2015/01/24/fiona-rasterio-shapely-binary-wheels-for-os-x.html#rest_code_d7a2cb64fecf4de29b8734a0bdc33650-1"></a><span class="gp">$ </span>delocate-listdeps ~/code/frs-wheel-builds/dist/rasterio-0.17.1-cp27-none-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl
<a id="rest_code_d7a2cb64fecf4de29b8734a0bdc33650-2" name="rest_code_d7a2cb64fecf4de29b8734a0bdc33650-2" href="https://sgillies.net/2015/01/24/fiona-rasterio-shapely-binary-wheels-for-os-x.html#rest_code_d7a2cb64fecf4de29b8734a0bdc33650-2"></a><span class="go">@loader_path/.dylibs/libgdal.1.dylib</span>
<a id="rest_code_d7a2cb64fecf4de29b8734a0bdc33650-3" name="rest_code_d7a2cb64fecf4de29b8734a0bdc33650-3" href="https://sgillies.net/2015/01/24/fiona-rasterio-shapely-binary-wheels-for-os-x.html#rest_code_d7a2cb64fecf4de29b8734a0bdc33650-3"></a><span class="go">@loader_path/libgeos-3.4.2.dylib</span>
<a id="rest_code_d7a2cb64fecf4de29b8734a0bdc33650-4" name="rest_code_d7a2cb64fecf4de29b8734a0bdc33650-4" href="https://sgillies.net/2015/01/24/fiona-rasterio-shapely-binary-wheels-for-os-x.html#rest_code_d7a2cb64fecf4de29b8734a0bdc33650-4"></a><span class="go">@loader_path/libgeos_c.1.dylib</span>
<a id="rest_code_d7a2cb64fecf4de29b8734a0bdc33650-5" name="rest_code_d7a2cb64fecf4de29b8734a0bdc33650-5" href="https://sgillies.net/2015/01/24/fiona-rasterio-shapely-binary-wheels-for-os-x.html#rest_code_d7a2cb64fecf4de29b8734a0bdc33650-5"></a><span class="go">@loader_path/libjasper.1.0.0.dylib</span>
<a id="rest_code_d7a2cb64fecf4de29b8734a0bdc33650-6" name="rest_code_d7a2cb64fecf4de29b8734a0bdc33650-6" href="https://sgillies.net/2015/01/24/fiona-rasterio-shapely-binary-wheels-for-os-x.html#rest_code_d7a2cb64fecf4de29b8734a0bdc33650-6"></a><span class="go">@loader_path/libjson-c.2.dylib</span>
<a id="rest_code_d7a2cb64fecf4de29b8734a0bdc33650-7" name="rest_code_d7a2cb64fecf4de29b8734a0bdc33650-7" href="https://sgillies.net/2015/01/24/fiona-rasterio-shapely-binary-wheels-for-os-x.html#rest_code_d7a2cb64fecf4de29b8734a0bdc33650-7"></a><span class="go">@loader_path/libproj.0.dylib</span>
</pre></div>
<p>For the small price of a larger download, Mac users now get batteries-included
binaries that work immediately. No XCode required. Just <code class="docutils literal">pip install
rasterio</code> and start using it.</p>
<p>The new binaries are built on 10.9 using Python 2.7.9 and 3.4.2 downloaded from
python.org. These Pythons were compiled using the 10.6 SDK for both i386 and
x86_64 architectures and I've similarly set <code class="docutils literal">MACOSX_DEPLOYMENT_TARGET=10.6</code>
and <code class="docutils literal"><span class="pre">-arch</span> i386 <span class="pre">-arch</span> x86_64</code> in my own builds. In practice they are intended
for 10.9 and 10.10, but will probably work on 10.7 and 10.8. They should work
for just about any OS X Python, whether from the system, Homebrew, MacPorts, or
python.org.</p>
<p>If you'd rather continue to compile, e.g, Rasterio's modules using your own
GDAL installation, you've got an out in pip's <code class="docutils literal"><span class="pre">--no-use-wheel</span></code> option:</p>
<div class="code"><pre class="code console"><a id="rest_code_495e04914eae41f4803af8be4023e37e-1" name="rest_code_495e04914eae41f4803af8be4023e37e-1" href="https://sgillies.net/2015/01/24/fiona-rasterio-shapely-binary-wheels-for-os-x.html#rest_code_495e04914eae41f4803af8be4023e37e-1"></a><span class="gp">$ </span><span class="nv">GDAL_CONFIG</span><span class="o">=</span>/path/to/gdal-config pip install --no-use-wheel rasterio
</pre></div>
<p>To contribute to development of these binaries or report installation bugs,
please head over to <a class="reference external" href="https://github.com/sgillies/frs-wheel-builds">https://github.com/sgillies/frs-wheel-builds</a>. Most
importantly, help me spread the word that installation of Fiona, Rasterio, and
Shapely on OS X is easier than ever.</p>Atom extension for Tinkererhttps://sgillies.net/2013/12/03/atom-extension-for-tinkerer.html2013-12-03T00:00:00-07:002013-12-03T00:00:00-07:00Sean Gillies<p><a class="reference external" href="http://tinkerer.me/">Tinkerer</a>, the software I'm using for my blog, lacks
a good Atom feed, so last night I wrote my first Sphinx extension to provide
one. <a class="reference external" href="https://github.com/sgillies/rutherford">Rutherford</a> adds a couple new
config items and a full content Atom feed. It exposes the Tinker categories and
tags and tracks the modification times of posted .rst files so that feeds and
their entries get updated accordingly. My own feed is
<a class="reference external" href="http://sgillies.net/blog/feed.atom">http://sgillies.net/blog/feed.atom</a>.</p>
<p>I'm becoming a fan of the Sphinx <a class="reference external" href="http://sphinx-doc.org/extensions.html">extension story</a>, at least for simple cases like
mine. Python's packaging situation continues to <a class="reference external" href="https://python-packaging-user-guide.readthedocs.org/en/latest/">get better</a> and there
are all kinds of wins for insisting that extensions (think <a class="reference external" href="http://www.qgis.org/en/docs/pyqgis_developer_cookbook/plugins.html">QGIS plugins</a>) be Python
packages: support from pip and setuptools, version pinning, package dependency
resolution, etc.</p>
<aside class="system-message">
<p class="system-message-title">System Message: ERROR/3 (<span class="docutils literal"><string></span>, line 20)</p>
<p>Unknown directive type "summary".</p>
<pre class="literal-block">.. summary:: I'm becoming a fan of the Sphinx extension story</pre>
</aside>