mirror of
https://github.com/almet/notmyidea.git
synced 2025-04-28 19:42:37 +02:00
217 lines
No EOL
9.2 KiB
HTML
217 lines
No EOL
9.2 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
|
<meta http-equiv="content-type" content="text/html; charset=utf-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1">
|
|
<link rel="shortcut icon" type="image/x-icon" href="favicon.ico" />
|
|
|
|
<title>first week working on distutils2 - Carnets Web</title>
|
|
|
|
<meta charset="utf-8" />
|
|
<link href="https://blog.notmyidea.org/feeds/all.atom.xml" type="application/atom+xml" rel="alternate" title="Carnets Web Full Atom Feed" />
|
|
<link rel="stylesheet" href="https://blog.notmyidea.org/theme/css/poole.css"/>
|
|
<link rel="stylesheet" href="https://blog.notmyidea.org/theme/css/syntax.css"/>
|
|
<link rel="stylesheet" href="https://blog.notmyidea.org/theme/css/lanyon.css"/>
|
|
<link rel="stylesheet" href="//fonts.googleapis.com/css?family=PT+Serif:400,400italic,700%7CPT+Sans:400">
|
|
<link rel="stylesheet" href="https://blog.notmyidea.org/theme/css/styles.css"/>
|
|
|
|
|
|
|
|
<style>
|
|
|
|
h1 {
|
|
font-family: "Avant Garde", Avantgarde, "Century Gothic", CenturyGothic, "AppleGothic", sans-serif;
|
|
padding: 80px 50px;
|
|
text-align: center;
|
|
text-transform: uppercase;
|
|
text-rendering: optimizeLegibility;
|
|
color: #202020;
|
|
letter-spacing: .1em;
|
|
text-shadow:
|
|
-1px -1px 1px #111,
|
|
2px 2px 1px #eaeaea;
|
|
}
|
|
|
|
#main {
|
|
text-align: justify;
|
|
text-justify: inter-word;
|
|
}
|
|
#main h1 {
|
|
padding: 10px;
|
|
}
|
|
|
|
.post-headline {
|
|
padding: 15px;
|
|
}
|
|
</style>
|
|
</head>
|
|
|
|
<body>
|
|
<!-- Target for toggling the sidebar `.sidebar-checkbox` is for regular
|
|
styles, `#sidebar-checkbox` for behavior. -->
|
|
<input type="checkbox" class="sidebar-checkbox" id="sidebar-checkbox">
|
|
<!-- Toggleable sidebar -->
|
|
<div class="sidebar" id="sidebar">
|
|
<div class="sidebar-item">
|
|
<div class="profile">
|
|
<img src="https://blog.notmyidea.org/theme/img/profile.png"/>
|
|
</div>
|
|
</div>
|
|
|
|
<nav class="sidebar-nav">
|
|
<a class="sidebar-nav-item" href="/">Articles</a>
|
|
|
|
<a class="sidebar-nav-item" href="https://www.vieuxsinge.com">Brasserie du Vieux Singe</a>
|
|
<a class="sidebar-nav-item" href="http://blog.notmyidea.org/pages/about.html">A propos</a>
|
|
<a class="sidebar-nav-item" href="https://twitter.com/ametaireau">Messages courts</a>
|
|
<a class="sidebar-nav-item" href="https://github.com/almet">Code</a>
|
|
</nav>
|
|
</div> <div class="wrap">
|
|
<div class="masthead">
|
|
<div class="container">
|
|
<h3 class="masthead-title">
|
|
<a href="https://blog.notmyidea.org/" title="Home">Carnets Web</a>
|
|
</h3>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="container content">
|
|
<div id="main" class="posts">
|
|
<h1 class="post-title">first week working on distutils2</h1>
|
|
<span class="post-date">04 juin 2010</span>
|
|
<img id="illustration" src="" />
|
|
|
|
<div class="post article">
|
|
<h1>🌟</h1>
|
|
<p>As I've been working on
|
|
<a class="reference external" href="http://hg.python.org/distutils2/">Distutils2</a> during the past
|
|
week, taking part of the
|
|
<a class="reference external" href="http://code.google.com/intl/fr/soc/">GSOC</a> program, here is a
|
|
short summary of what I've done so far.</p>
|
|
<p>As my courses are not over yet, I've not worked as much as I
|
|
wanted, and this will continues until the end of June. My main
|
|
tasks are about making installation and uninstallation commands, to
|
|
have a simple way to install distributions via
|
|
<a class="reference external" href="http://hg.python.org/distutils2/">Distutils2</a>.</p>
|
|
<p>To do this, we need to rely on informations provided by the Python
|
|
Package Index (<a class="reference external" href="http://pypi.python.org/">PyPI</a>), and there is at
|
|
least two ways to retreive informations from here: XML-RPC and the
|
|
"simple" API.</p>
|
|
<p>So, I've been working on porting some
|
|
<a class="reference external" href="http://bitbucket.org/tarek/distribute/">Distribute</a> related
|
|
stuff to <a class="reference external" href="http://hg.python.org/distutils2/">Distutils2</a>, cutting
|
|
off all non distutils' things, as we do not want to depend from
|
|
Distribute's internals. My main work has been about reading the
|
|
whole code, writing tests about this and making those tests
|
|
possible.</p>
|
|
<p>In fact, there was a need of a pypi mocked server, and, after
|
|
reading and introducing myself to the distutils behaviors and code,
|
|
I've taken some time to improve the work
|
|
<a class="reference external" href="http://bitbucket.org/konrad">Konrad</a> makes about this mock.</p>
|
|
<div class="section" id="a-pypi-server-mock">
|
|
<h2>A PyPI Server mock</h2>
|
|
<p>The mock is embeded in a thread, to make it available during the
|
|
tests, in a non blocking way. We first used
|
|
<a class="reference external" href="http://wsgi.org">WSGI</a> and
|
|
<a class="reference external" href="http://docs.python.org/library/wsgiref.html">wsgiref</a> in order
|
|
control what to serve, and to log the requests made to the server,
|
|
but finally realised that
|
|
<a class="reference external" href="http://docs.python.org/library/wsgiref.html">wsgiref</a> is not
|
|
python 2.4 compatible (and we <em>need</em> to be python 2.4 compatible in
|
|
Distutils2).</p>
|
|
<p>So, we switched to
|
|
<a class="reference external" href="http://docs.python.org/library/basehttpserver.html">BaseHTTPServer</a>
|
|
and
|
|
<a class="reference external" href="http://docs.python.org/library/simplehttpserver.html">SimpleHTTPServer</a>,
|
|
and updated our tests accordingly. It's been an opportunity to
|
|
realize that <a class="reference external" href="http://wsgi.org">WSGI</a> has been a great step
|
|
forward for making HTTP servers, and expose a really simplest way
|
|
to discuss with HTTP !</p>
|
|
<p>You can find
|
|
<a class="reference external" href="http://bitbucket.org/ametaireau/distutils2/changesets">the modifications I made</a>,
|
|
and the
|
|
<a class="reference external" href="http://bitbucket.org/ametaireau/distutils2/src/tip/docs/source/test_framework.rst">related docs</a>
|
|
about this on
|
|
<a class="reference external" href="http://bitbucket.org/ametaireau/distutils2/">my bitbucket distutils2 clone</a>.</p>
|
|
</div>
|
|
<div class="section" id="the-pypi-simple-api">
|
|
<h2>The PyPI Simple API</h2>
|
|
<p>So, back to the main problematic: make a python library to access
|
|
and request information stored on PyPI, via the simple API. As I
|
|
said, I've just grabbed the work made from
|
|
<a class="reference external" href="http://bitbucket.org/tarek/distribute/">Distribute</a>, and played
|
|
a bit with, in order to view what are the different use cases, and
|
|
started to write the related tests.</p>
|
|
</div>
|
|
<div class="section" id="the-work-to-come">
|
|
<h2>The work to come</h2>
|
|
<p>So, once all use cases covered with tests, I'll rewrite a bit the
|
|
grabbed code, and do some software design work (to not expose all
|
|
things as privates methods, have a clear API, and other things like
|
|
this), then update the tests accordingly and write a documentation
|
|
to make this clear.</p>
|
|
<p>Next step is to a little client, as I've
|
|
<a class="reference external" href="http://github.com/ametaireau/pypiclient">already started here</a>
|
|
I'll take you updated !</p>
|
|
</div>
|
|
|
|
Vous pouvez également <a onclick="(function(){
|
|
let here = document.location;
|
|
document.location = `http://pdf.fivefilters.org/simple-print/url.php?size=A4#${here}`;
|
|
return false;
|
|
})();return false;">télécharger cet article en pdf</a>.
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<label for="sidebar-checkbox" class="sidebar-toggle"></label>
|
|
|
|
<script>
|
|
(function(document) {
|
|
var i = 0;
|
|
// snip empty header rows since markdown can't
|
|
var rows = document.querySelectorAll('tr');
|
|
for(i=0; i<rows.length; i++) {
|
|
var ths = rows[i].querySelectorAll('th');
|
|
var rowlen = rows[i].children.length;
|
|
if (ths.length > 0 && ths.length === rowlen) {
|
|
rows[i].remove();
|
|
}
|
|
}
|
|
})(document);
|
|
</script>
|
|
|
|
<script>
|
|
/* Lanyon & Poole are Copyright (c) 2014 Mark Otto. Adapted to Pelican 20141223 and extended a bit by @thomaswilley */
|
|
(function(document) {
|
|
var toggle = document.querySelector('.sidebar-toggle');
|
|
var sidebar = document.querySelector('#sidebar');
|
|
var checkbox = document.querySelector('#sidebar-checkbox');
|
|
document.addEventListener('click', function(e) {
|
|
var target = e.target;
|
|
if(!checkbox.checked ||
|
|
sidebar.contains(target) ||
|
|
(target === checkbox || target === toggle)) return;
|
|
checkbox.checked = false;
|
|
}, false);
|
|
})(document);
|
|
</script>
|
|
<!-- Piwik -->
|
|
<script type="text/javascript">
|
|
var _paq = _paq || [];
|
|
_paq.push(['trackPageView']);
|
|
_paq.push(['enableLinkTracking']);
|
|
(function() {
|
|
var u="//tracker.notmyidea.org/";
|
|
_paq.push(['setTrackerUrl', u+'piwik.php']);
|
|
_paq.push(['setSiteId', 3]);
|
|
var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
|
|
g.type='text/javascript'; g.async=true; g.defer=true; g.src=u+'piwik.js'; s.parentNode.insertBefore(g,s);
|
|
})();
|
|
</script>
|
|
<noscript><p><img src="//tracker.notmyidea.org/piwik.php?idsite=3" style="border:0;" alt="" /></p></noscript>
|
|
<!-- End Piwik Code -->
|
|
</div>
|
|
</body>
|
|
</html> |