gnu: Add paperkey.
[jackhill/guix/guix.git] / gnu / packages / python.scm
CommitLineData
a01b6da7
NK
1;;; GNU Guix --- Functional package management for GNU
2;;; Copyright © 2013 Nikita Karetnikov <nikita@karetnikov.org>
3;;; Copyright © 2013 Ludovic Courtès <ludo@gnu.org>
af807dea 4;;; Copyright © 2013 Andreas Enge <andreas@enge.fr>
a01b6da7
NK
5;;;
6;;; This file is part of GNU Guix.
7;;;
8;;; GNU Guix is free software; you can redistribute it and/or modify it
9;;; under the terms of the GNU General Public License as published by
10;;; the Free Software Foundation; either version 3 of the License, or (at
11;;; your option) any later version.
12;;;
13;;; GNU Guix is distributed in the hope that it will be useful, but
14;;; WITHOUT ANY WARRANTY; without even the implied warranty of
15;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16;;; GNU General Public License for more details.
17;;;
18;;; You should have received a copy of the GNU General Public License
19;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
20
1ffa7090 21(define-module (gnu packages python)
011b18c3
LC
22 #:use-module ((guix licenses)
23 #:select (bsd-3 bsd-style psfl x11 gpl2+ lgpl2.1+))
1d08c01f 24 #:use-module ((guix licenses) #:select (zlib)
ed0cdf83 25 #:renamer (symbol-prefix-proc 'license:))
3fdc99da 26 #:use-module (gnu packages)
1ffa7090 27 #:use-module (gnu packages compression)
3fdc99da 28 #:use-module (gnu packages gdbm)
421a80a2 29 #:use-module (gnu packages icu4c)
3fdc99da 30 #:use-module (gnu packages readline)
1ffa7090 31 #:use-module (gnu packages openssl)
3e778ad3 32 #:use-module (gnu packages elf)
1d08c01f 33 #:use-module (gnu packages sqlite)
a01b6da7
NK
34 #:use-module (guix packages)
35 #:use-module (guix download)
11bb85a1 36 #:use-module (guix utils)
acc26ff1 37 #:use-module (guix build-system gnu)
898238b9
AE
38 #:use-module (guix build-system python)
39 #:use-module (guix build-system trivial))
a01b6da7 40
b24d1cfc 41(define-public python-2
a01b6da7
NK
42 (package
43 (name "python")
ee2b5109 44 (version "2.7.6")
a01b6da7
NK
45 (source
46 (origin
47 (method url-fetch)
48 (uri (string-append "http://www.python.org/ftp/python/"
49 version "/Python-" version ".tar.xz"))
50 (sha256
51 (base32
ee2b5109 52 "18gnpyh071dxa0rv3silrz92jw9qpblswzwv4gzqcwxzz20qxmhz"))))
a01b6da7 53 (build-system gnu-build-system)
3fdc99da 54 (arguments
af807dea
AE
55 `(#:tests? #f
56;; 258 tests OK.
57;; 103 tests failed:
58;; test_bz2 test_distutils test_file test_file2k test_popen2
59;; test_shutil test_signal test_site test_slice test_smtplib
60;; test_smtpnet test_socket test_socketserver test_softspace
61;; test_sort test_sqlite test_ssl test_startfile test_str
62;; test_strftime test_string test_stringprep test_strop test_strptime
63;; test_strtod test_struct test_structmembers test_structseq
64;; test_subprocess test_sunaudiodev test_sundry test_symtable
65;; test_syntax test_sys test_sys_setprofile test_sys_settrace
66;; test_sysconfig test_tarfile test_tcl test_telnetlib test_tempfile
67;; test_textwrap test_thread test_threaded_import
68;; test_threadedtempfile test_threading test_threading_local
69;; test_threadsignals test_time test_timeout test_tk test_tokenize
70;; test_tools test_trace test_traceback test_transformer
71;; test_ttk_guionly test_ttk_textonly test_tuple test_typechecks
72;; test_ucn test_unary test_undocumented_details test_unicode
73;; test_unicode_file test_unicodedata test_univnewlines
74;; test_univnewlines2k test_unpack test_urllib test_urllib2
75;; test_urllib2_localnet test_urllib2net test_urllibnet test_urlparse
76;; test_userdict test_userlist test_userstring test_uu test_uuid
77;; test_wait3 test_wait4 test_warnings test_wave test_weakref
78;; test_weakset test_whichdb test_winreg test_winsound test_with
79;; test_wsgiref test_xdrlib test_xml_etree test_xml_etree_c
80;; test_xmllib test_xmlrpc test_xpickle test_xrange test_zipfile
81;; test_zipfile64 test_zipimport test_zipimport_support test_zlib
82;; 31 tests skipped:
83;; test_aepack test_al test_applesingle test_ascii_formatd test_bsddb
84;; test_bsddb185 test_bsddb3 test_cd test_cl test_codecmaps_cn
85;; test_codecmaps_hk test_codecmaps_jp test_codecmaps_kr
86;; test_codecmaps_tw test_ctypes test_curses test_dl test_gdb test_gl
87;; test_imageop test_imgfile test_ioctl test_kqueue
88;; test_linuxaudiodev test_macos test_macostools test_msilib
89;; test_multiprocessing test_ossaudiodev test_pep277
90;; test_scriptpackages
91;; 7 skips unexpected on linux2:
92;; test_ascii_formatd test_bsddb test_bsddb3 test_ctypes test_gdb
93;; test_ioctl test_multiprocessing
94;; One of the typical errors:
95;; test_unicode
96;; test test_unicode crashed -- <type 'exceptions.OSError'>: [Errno 2] No such file or directory
97 #:test-target "test"
3fdc99da
CR
98 #:configure-flags
99 (let ((bz2 (assoc-ref %build-inputs "bzip2"))
100 (gdbm (assoc-ref %build-inputs "gdbm"))
101 (openssl (assoc-ref %build-inputs "openssl"))
102 (readline (assoc-ref %build-inputs "readline"))
103 (zlib (assoc-ref %build-inputs "zlib")))
fd982732
LC
104 (list "--enable-shared" ; allow embedding
105 (string-append "CPPFLAGS="
3fdc99da
CR
106 "-I" bz2 "/include "
107 "-I" gdbm "/include "
108 "-I" openssl "/include "
109 "-I" readline "/include "
110 "-I" zlib "/include")
111 (string-append "LDFLAGS="
112 "-L" bz2 "/lib "
113 "-L" gdbm "/lib "
114 "-L" openssl "/lib "
115 "-L" readline "/lib "
fd982732
LC
116 "-L" zlib "/lib")))
117
118 #:modules ((guix build gnu-build-system)
119 (guix build utils)
3309e3a1 120 (guix build rpath)
fd982732 121 (srfi srfi-26))
3309e3a1
LC
122 #:imported-modules ((guix build gnu-build-system)
123 (guix build utils)
124 (guix build rpath))
fd982732
LC
125
126 #:phases
127 (alist-cons-after
128 'strip 'add-lib-to-runpath
129 (lambda* (#:key outputs #:allow-other-keys)
fd982732
LC
130 (let* ((out (assoc-ref outputs "out"))
131 (lib (string-append out "/lib")))
132 ;; Add LIB to the RUNPATH of all the executables.
133 (with-directory-excursion out
134 (for-each (cut augment-rpath <> lib)
135 (find-files "bin" ".*")))))
136 %standard-phases)))
a01b6da7 137 (inputs
3fdc99da
CR
138 `(("bzip2" ,bzip2)
139 ("gdbm" ,gdbm)
a01b6da7 140 ("openssl" ,openssl)
3fdc99da 141 ("readline" ,readline)
fd982732 142 ("zlib" ,zlib)
3309e3a1 143 ("patchelf" ,patchelf))) ; for (guix build rpath)
9be8d7c8
LC
144 (native-search-paths
145 (list (search-path-specification
146 (variable "PYTHONPATH")
147 (directories '("lib/python2.7/site-packages")))))
a01b6da7
NK
148 (home-page "http://python.org")
149 (synopsis
150 "Python, a high-level dynamically-typed programming language")
151 (description
152 "Python is a remarkably powerful dynamic programming language that
153is used in a wide variety of application domains. Some of its key
154distinguishing features include: clear, readable syntax; strong
155introspection capabilities; intuitive object orientation; natural
156expression of procedural code; full modularity, supporting hierarchical
157packages; exception-based error handling; and very high level dynamic
158data types.")
159 (license psfl)))
acc26ff1 160
b24d1cfc
AE
161(define-public python
162 (package (inherit python-2)
55781376 163 (version "3.3.3")
f26a77ff
AE
164 (source
165 (origin
166 (method url-fetch)
167 (uri (string-append "http://www.python.org/ftp/python/"
168 version "/Python-" version ".tar.xz"))
169 (sha256
170 (base32
55781376 171 "11f6hg9wdhm6hyzj49gxlvvp1s0l5hqgcsq1i4ayygqs1arpb4ik"))))
1aebc0cb
AE
172 (native-search-paths
173 (list (search-path-specification
174 (variable "PYTHONPATH")
175 (directories '("lib/python3.3/site-packages")))))))
f26a77ff 176
898238b9
AE
177(define-public python-wrapper
178 (package (inherit python)
179 (name "python-wrapper")
180 (source #f)
181 (build-system trivial-build-system)
182 (inputs `(("python" ,python)))
183 (arguments
184 `(#:modules ((guix build utils))
185 #:builder
186 (begin
187 (use-modules (guix build utils))
188 (let ((bin (string-append (assoc-ref %outputs "out") "/bin"))
189 (python (string-append (assoc-ref %build-inputs "python") "/bin/")))
190 (mkdir-p bin)
191 (for-each
192 (lambda (old new)
193 (symlink (string-append python old)
194 (string-append bin "/" new)))
195 `("python3", "pydoc3", "idle3")
196 `("python", "pydoc", "idle"))))))
197 (description (string-append (package-description python)
198 "\n\nThis wrapper package provides symbolic links to the python binaries
199 without version suffix."))))
200
201
89114f39 202(define-public python-pytz
acc26ff1 203 (package
89114f39 204 (name "python-pytz")
acc26ff1
CR
205 (version "2013b")
206 (source
207 (origin
208 (method url-fetch)
209 (uri (string-append "https://launchpad.net/pytz/main/" version
210 "/+download/pytz-" version ".tar.bz2"))
211 (sha256
212 (base32
213 "19giwgfcrg0nr1gdv49qnmf2jb2ilkcfc7qyqvfpz4dp0p64ksv5"))))
214 (build-system python-build-system)
8498b8cf 215 (arguments `(#:tests? #f)) ; no test target
acc26ff1
CR
216 (home-page "https://launchpad.net/pytz")
217 (synopsis "The Python timezone library.")
218 (description
219 "This library allows accurate and cross platform timezone calculations
220using Python 2.4 or higher and provides access to the Olson timezone database.")
221 (license x11)))
5ace6e2f 222
89114f39 223(define-public python2-pytz
11bb85a1 224 (package-with-python2 python-pytz))
89114f39 225
fc50e9c6 226
89114f39 227(define-public python-babel
5ace6e2f 228 (package
89114f39 229 (name "python-babel")
e1804763 230 (version "1.3")
5ace6e2f
CR
231 (source
232 (origin
233 (method url-fetch)
e1804763 234 (uri (string-append "https://pypi.python.org/packages/source/B/Babel/Babel-"
5ace6e2f
CR
235 version ".tar.gz"))
236 (sha256
237 (base32
e1804763 238 "0bnin777lc53nxd1hp3apq410jj5wx92n08h7h4izpl4f4sx00lz"))))
5ace6e2f
CR
239 (build-system python-build-system)
240 (inputs
e1804763
AE
241 `(("python-pytz" ,python-pytz)
242 ("python-setuptools" ,python-setuptools)))
8498b8cf 243 (arguments `(#:tests? #f)) ; no test target
e1804763 244 (home-page "http://babel.pocoo.org/")
5ace6e2f
CR
245 (synopsis
246 "Tools for internationalizing Python applications")
247 (description
248 "Babel is composed of two major parts:
249- tools to build and work with gettext message catalogs
250- a Python interface to the CLDR (Common Locale Data Repository), providing
251access to various locale display names, localized number and date formatting,
252etc. ")
253 (license bsd-3)))
89114f39
AE
254
255(define-public python2-babel
11bb85a1 256 (package-with-python2 python-babel))
73adf220 257
fc50e9c6 258
73adf220
AE
259(define-public python-setuptools
260 (package
261 (name "python-setuptools")
262 (version "1.1.4")
263 (source
264 (origin
265 (method url-fetch)
266 (uri (string-append "https://pypi.python.org/packages/source/s/setuptools/setuptools-"
267 version ".tar.gz"))
268 (sha256
269 (base32
270 "0hl9sa5xr9bi2ifq51wy1bawsjv5nzvpbac7m9z1ciz778874csf"))))
271 (build-system python-build-system)
272 (arguments
824af8ca 273 `(#:tests? #f))
73adf220
AE
274 ;;FIXME: test_sdist_with_utf8_encoded_filename fails in
275 ;; /tmp/nix-build-python2-setuptools-1.1.4.drv-0/setuptools-1.1.4/setuptools/tests/test_sdist.py"
276 ;; line 354
277 ;; The tests pass with Python 2.7.5.
73adf220
AE
278 (home-page "https://pypi.python.org/pypi/setuptools")
279 (synopsis
280 "Library designed to facilitate packaging Python projects")
281 (description
282 "Setuptools is a fully-featured, stable library designed to facilitate
283packaging Python projects, where packaging includes:
284Python package and module definitions,
285distribution package metadata,
286test hooks,
287project installation,
288platform-specific details,
289Python 3 support.")
290 (license psfl)))
291
292(define-public python2-setuptools
293 (package-with-python2 python-setuptools))
fc50e9c6
AE
294
295
296(define-public python-dateutil
297 (package
298 (name "python-dateutil")
299 (version "1.5") ; last version for python < 3
300 (source
301 (origin
302 (method url-fetch)
303 (uri (string-append "http://labix.org/download/python-dateutil/python-dateutil-"
304 version ".tar.gz"))
305 (sha256
306 (base32
307 "0fqfglhy5khbvsipr3x7m6bcaqljh8xl5cw33vbfxy7qhmywm2n0"))))
308 (build-system python-build-system)
309 (inputs
310 `(("python-setuptools" ,python-setuptools)))
311 (home-page "http://labix.org/python-dateutil")
312 (synopsis
313 "Extensions to the standard datetime module, available in Python 2.3+")
314 (description
315 "The dateutil module provides powerful extensions to the standard
316datetime module, available in Python 2.3+.")
317 (license psfl)))
318
319(define-public python2-dateutil
320 (package-with-python2 python-dateutil))
1d08c01f
AE
321
322
323(define-public python2-pysqlite
324 (package
325 (name "python2-pysqlite")
326 (version "2.6.3")
327 (source
328 (origin
329 (method url-fetch)
330 (uri (string-append "http://pysqlite.googlecode.com/files/pysqlite-"
331 version ".tar.gz"))
332 (sha256
333 (base32
334 "0nsqqfp072rgqbls100rdvbzkjkin7li3kprhfxlfqvzf608hlqd"))))
335 (build-system python-build-system)
336 (inputs
337 `(("sqlite" ,sqlite)))
338 (arguments
339 `(#:python ,python-2 ; incompatible with Python 3
340 #:tests? #f)) ; no test target
341 (home-page "http://labix.org/python-dateutil")
342 (synopsis
343 "SQLite bindings for Python.")
344 (description
345 "Pysqlite provides SQLite bindings for Python that comply to the
346Database API 2.0T.")
ed0cdf83 347 (license license:zlib)))
1d08c01f 348
2875caf5
AE
349
350(define-public python2-mechanize
351 (package
352 (name "python2-mechanize")
353 (version "0.2.5")
354 (source
355 (origin
356 (method url-fetch)
357 (uri (string-append "https://pypi.python.org/packages/source/m/mechanize/mechanize-"
358 version ".tar.gz"))
359 (sha256
360 (base32
361 "0rj7r166i1dyrq0ihm5rijfmvhs8a04im28lv05c0c3v206v4rrf"))))
362 (build-system python-build-system)
363 (inputs
364 `(("python2-setuptools" ,python2-setuptools)))
365 (arguments
366 `(#:python ,python-2 ; apparently incompatible with Python 3
367 #:tests? #f))
368 ;; test fails with message
369 ;; AttributeError: 'module' object has no attribute 'test_pullparser'
370 ;; (python-3.3.2) or
371 ;; AttributeError: 'module' object has no attribute 'test_urllib2_localnet'
372 ;; (python-2.7.5).
373 ;; The source code is from March 2011 and probably not up-to-date
374 ;; with respect to python unit tests.
375 (home-page "http://wwwsearch.sourceforge.net/mechanize/")
376 (synopsis
377 "Stateful programmatic web browsing in Python")
378 (description
379 "Mechanize implements stateful programmatic web browsing in Python,
380after Andy Lester’s Perl module WWW::Mechanize.")
381 (license (bsd-style "file://COPYING"
382 "See COPYING in the distribution."))))
383
0352532e
AE
384
385(define-public python-simplejson
386 (package
387 (name "python-simplejson")
388 (version "3.3.0")
389 (source
390 (origin
391 (method url-fetch)
392 (uri (string-append "https://pypi.python.org/packages/source/s/simplejson/simplejson-"
393 version ".tar.gz"))
394 (sha256
395 (base32
396 "07wsry5j44l5zzm74l4j2bvasiq8n5m32f31n2p7c68i5vc6p2ks"))))
397 (build-system python-build-system)
398 (home-page "http://simplejson.readthedocs.org/en/latest/")
399 (synopsis
400 "Json library for Python")
401 (description
402 "JSON (JavaScript Object Notation) is a subset of JavaScript syntax
cc20a22a 403 (ECMA-262 3rd edition) used as a lightweight data interchange format.
0352532e
AE
404
405Simplejson exposes an API familiar to users of the standard library marshal
406and pickle modules. It is the externally maintained version of the json
407library contained in Python 2.6, but maintains compatibility with Python 2.5
408and (currently) has significant performance advantages, even without using
409the optional C extension for speedups. Simplejson is also supported on
410Python 3.3+.")
411 (license x11)))
412
413(define-public python2-simplejson
414 (package-with-python2 python-simplejson))
421a80a2
AE
415
416
417(define-public python2-pyicu
418 (package
419 (name "python2-pyicu")
420 (version "1.5")
421 (source
422 (origin
423 (method url-fetch)
424 (uri (string-append "https://pypi.python.org/packages/source/P/PyICU/PyICU-"
425 version ".tar.gz"))
426 (sha256
427 (base32
428 "011vwflpir8wvh48mvi6d9a7vw0f43bkwv0w6bzxbzmvz20ax5vm"))))
429 (build-system python-build-system)
430 (inputs
431 `(("icu4c" ,icu4c)))
432 (arguments
433 `(#:python ,python-2 ; Python 3 works also, but needs special care for
434 ; linking with libpython3.3m
435 #:tests? #f)) ; no check target
436 (home-page "http://pyicu.osafoundation.org/")
437 (synopsis
438 "Python extension wrapping the ICU C++ API.")
439 (description
440 "PyICU is a python extension wrapping the ICU C++ API.")
441 (license x11)))
cc20a22a
LC
442
443(define-public python2-dogtail
444 ;; Python 2 only, as it leads to "TabError: inconsistent use of tabs and
445 ;; spaces in indentation" with Python 3.
446 (package
447 (name "python2-dogtail")
448 (version "0.8.2")
449 (source (origin
450 (method url-fetch)
451 (uri (string-append
452 "https://fedorahosted.org/released/dogtail/dogtail-"
453 version ".tar.gz"))
454 (sha256
455 (base32
456 "1yc4cg7ip87z15gyd4wy2vzbywrjc52a3m8r8gqy2b50d65llcg1"))))
457 (build-system python-build-system)
458 (arguments `(#:python ,python-2
459 #:tests? #f)) ; invalid command "test"
460 (home-page "https://fedorahosted.org/dogtail/")
461 (synopsis "GUI test tool and automation framework written in ​Python")
462 (description
463 "dogtail is a GUI test tool and automation framework written in Python.
464It uses Accessibility (a11y) technologies to communicate with desktop
465applications. dogtail scripts are written in Python and executed like any
466other Python program.")
467 (license gpl2+)))
515e6878 468
011b18c3
LC
469(define-public python2-empy
470 (package
471 (name "python2-empy")
472 (version "3.3")
473 (source (origin
474 (method url-fetch)
475 (uri (string-append "http://www.alcyone.com/software/empy/empy-"
476 version ".tar.gz"))
477 (sha256
478 (base32
479 "01g8mmkfnvjdmlhsihwyx56lrg7r5m5d2fg6mnxsvy6g0dnl69f6"))))
480 (build-system python-build-system)
481 (arguments
482 `(#:python ,python-2
483 #:phases (alist-replace
484 'check
485 (lambda _
486 (zero? (system* "./test.sh")))
487 %standard-phases)))
488 (home-page "http://www.alcyone.com/software/empy/")
489 (synopsis "Templating system for Python")
490 (description
491 "EmPy is a system for embedding Python expressions and statements in
492template text; it takes an EmPy source file, processes it, and produces
493output. This is accomplished via expansions, which are special signals to the
494EmPy system and are set off by a special prefix (by default the at sign, @).
495EmPy can expand arbitrary Python expressions and statements in this way, as
496well as a variety of special forms. Textual data not explicitly delimited in
497this way is sent unaffected to the output, allowing Python to be used in
498effect as a markup language. Also supported are callbacks via hooks,
499recording and playback via diversions, and dynamic, chainable filters. The
500system is highly configurable via command line options and embedded
501commands.")
502 (license lgpl2.1+)))
503
515e6878
LC
504(define-public scons
505 (package
506 (name "scons")
507 (version "2.1.0")
508 (source (origin
509 (method url-fetch)
510 (uri (string-append "mirror://sourceforge/scons/scons-"
511 version ".tar.gz"))
512 (sha256
513 (base32
514 "07cjn4afb2cljjrd3cr7xf062qq58z8q96f58z6yplhdyqafsfa1"))))
515 (build-system python-build-system)
516 (arguments
517 ;; With Python 3.x, fails to build with a syntax error.
518 `(#:python ,python-2
519 #:tests? #f)) ; no 'python setup.py test' command
520 (home-page "http://scons.org/")
521 (synopsis "Software construction tool written in Python")
522 (description
523 "SCons is a software construction tool. Think of SCons as an improved,
524cross-platform substitute for the classic Make utility with integrated
525functionality similar to autoconf/automake and compiler caches such as ccache.
526In short, SCons is an easier, more reliable and faster way to build
527software.")
528 (license x11)))
011b18c3 529