82a309eae81c1b4687d2ed5992692ee25374117a
[mediagoblin.git] / guix-env.scm
1 ;;; GNU MediaGoblin -- federated, autonomous media hosting
2 ;;; Copyright © 2015, 2016 David Thompson <davet@gnu.org>
3 ;;; Copyright © 2016 Christopher Allan Webber <cwebber@dustycloud.org>
4 ;;;
5 ;;; This program is free software: you can redistribute it and/or modify
6 ;;; it under the terms of the GNU General Public License as published by
7 ;;; the Free Software Foundation, either version 3 of the License, or
8 ;;; (at your option) any later version.
9 ;;;
10 ;;; This program is distributed in the hope that it will be useful,
11 ;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
12 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 ;;; GNU General Public License for more details.
14 ;;;
15 ;;; ========================================
16 ;;;
17 ;;; ... This file is also part of GNU MediaGoblin, but we're leaving it
18 ;;; under GPLv3 for easy merge back and forth between Guix proper. It
19 ;;; also borrows some code directly from Guix.
20 ;;;
21 ;;; ========================================
22 ;;;
23 ;;; With `guix environment' you can use guix as kind of a universal
24 ;;; virtualenv, except a universal virtualenv with magical time traveling
25 ;;; properties and also, not just for Python.
26 ;;;
27 ;;; Ok, here's how to use this thing! First, install Guix.
28 ;;; Then do:
29 ;;; guix environment -l guix-env.scm --pure
30 ;;;
31 ;;; And the first time you use it:
32 ;;; ./bootstrap.sh
33 ;;; ./configure --with-python3 --without-virtualenv
34 ;;; make
35 ;;; virtualenv . && ./bin/python setup.py develop --no-deps
36 ;;;
37 ;;; ... wait whaaat, what's that last line! I thought you said this
38 ;;; was a reasonable virtualenv replacement! Well it is and it will
39 ;;; be, but there's a catch, and the catch is that Guix doesn't know
40 ;;; about this directory and "setup.py dist" is technically necessary
41 ;;; for certain things to run, so we have a virtualenv with nothing
42 ;;; in it but this project itself.
43 ;;;
44 ;;; So anyway, now you can do:
45 ;;; PYTHONPATH="${PYTHONPATH}:$(pwd)" ./runtests.sh
46 ;;;
47 ;;; Now notably this is goofier looking than running a virtualenv,
48 ;;; but soon I'll do something truly evil (I hope) that will make
49 ;;; the virtualenv and path-hacking stuff unnecessary.
50 ;;;
51 ;;; Have fun!
52
53 (use-modules (ice-9 match)
54 (srfi srfi-1)
55 (guix packages)
56 (guix licenses)
57 (guix download)
58 (guix git-download)
59 (guix build-system gnu)
60 (guix build-system python)
61 (gnu packages)
62 (gnu packages autotools)
63 (gnu packages base)
64 (gnu packages python)
65 (gnu packages gstreamer)
66 (gnu packages glib)
67 (gnu packages version-control)
68 ((guix licenses) #:select (expat zlib) #:prefix license:))
69
70 ;; =================================================================
71 ;; These packages are on their way into Guix proper but haven't made
72 ;; it in yet...
73 ;; =================================================================
74
75 (define-public python-paste
76 (package
77 (name "python-paste")
78 (version "2.0.2")
79 (source
80 (origin
81 (method url-fetch)
82 (uri (pypi-uri "Paste" version))
83 (sha256
84 (base32
85 "16dsv9qi0r4qsrsb6dilpq2rx0fnglvh36flzywcdnm2jg43mb5d"))
86 ;;; We patch away certain tests in Guix proper, but for here we'll
87 ;;; just comment out the patches and not run the tests
88 ;; (patches (list (search-patch
89 ;; "python-paste-remove-website-test.patch")
90 ;; (search-patch
91 ;; "python-paste-remove-timing-test.patch")))
92 ))
93 (build-system python-build-system)
94 (native-inputs
95 `(("python-nose" ,python-nose)))
96 (propagated-inputs
97 `(;; Uses pkg_resources provided by setuptools internally.
98 ("python-setuptools" ,python-setuptools)
99 ("python-six" ,python-six)))
100 (arguments
101 '(;; Tests don't pass on Python 3, but work fine on Python 2.
102 ;; (As of 2.0.2, Python 3 support in Paste is presently a bit broken,
103 ;; but is usable enough for the minimal amount it's used in MediaGoblin
104 ;; still... things should be better by the next Paste release.)
105 #:tests? #f))
106 (home-page "http://pythonpaste.org")
107 (synopsis
108 "Python web development tools, focusing on WSGI")
109 (description
110 "Paste provides a variety of web development tools and middleware which
111 can be nested together to build web applications. Paste's design closely
112 follows ideas flowing from WSGI (Web Standard Gateway Interface).")
113 (license license:expat)))
114
115 (define-public python-pastescript
116 (package
117 (name "python-pastescript")
118 (version "2.0.2")
119 (source
120 (origin
121 (method url-fetch)
122 (uri (pypi-uri "PasteScript" version))
123 (sha256
124 (base32
125 "1h3nnhn45kf4pbcv669ik4faw04j58k8vbj1hwrc532k0nc28gy0"))))
126 (build-system python-build-system)
127 (native-inputs
128 `(("python-nose" ,python-nose)))
129 (propagated-inputs
130 `(;; Uses pkg_resources provided by setuptools internally.
131 ("python-setuptools" ,python-setuptools)
132 ("python-paste" ,python-paste)
133 ("python-pastedeploy" ,python-pastedeploy)))
134 (home-page "http://pythonpaste.org/script/")
135 (arguments
136 '(;; Unfortunately, this requires the latest unittest2,
137 ;; but that requires traceback2 which requires linecache2 which requires
138 ;; unittest2. So we're skipping tests for now.
139 ;; (Note: Apparently linetest2 only needs unittest2 for its tests,
140 ;; so in theory we could get around this situation somehow.)
141 #:tests? #f))
142 (synopsis
143 "Pluggable command line tool for serving web applications and more")
144 (description
145 "PasteScript is an extensible command line tool which provides a variety
146 of features, from launching web applications to bootstrapping project layouts.")
147 (license license:expat)))
148
149 (define python-sqlalchemy-0.9.10
150 (package
151 (inherit python-sqlalchemy)
152 (version "0.9.10")
153 (source
154 (origin
155 (method url-fetch)
156 (uri (string-append "https://pypi.python.org/packages/source/S/"
157 "SQLAlchemy/SQLAlchemy-" version ".tar.gz"))
158 (sha256
159 (base32
160 "0fqnssf7pxvc7dvd5l83vnqz2wfvpq7y01kcl1537f9nbqnvlp24"))))
161
162 ;; Temporarily skipping tests. It's the stuff that got fixed in
163 ;; the recent sqlalchemy release we struggled with on-list. The
164 ;; patch would have to be backported here to 0.9.10.
165 (arguments
166 '(#:tests? #f))))
167
168 (define python-alembic-0.6.6
169 (package
170 (inherit python-alembic)
171 (version "0.6.6")
172 (source
173 (origin
174 (method url-fetch)
175 (uri (pypi-uri "alembic" version))
176 (sha256
177 (base32
178 "0i3nic56blq079vj1iskkmllwjp980vnvvx898d3bm5qa416crcn"))))
179 (native-inputs
180 `(("python-nose" ,python-nose)
181 ,@(package-native-inputs python-alembic)))
182 (propagated-inputs
183 `(("python-sqlalchemy" ,python-sqlalchemy-0.9.10)
184 ("python-mako" ,python-mako)
185 ("python-editor" ,python-editor)))))
186
187 ;; =================================================================
188
189 (define mediagoblin
190 (package
191 (name "mediagoblin")
192 (version "0.8.1")
193 (source
194 (origin
195 (method url-fetch)
196 (uri (pypi-uri "mediagoblin" version))
197 (sha256
198 (base32
199 "0p2gj4z351166d1zqmmd8wc9bzb69w0fjm8qq1fs8dw2yhcg2wwv"))))
200 (build-system python-build-system)
201 (native-inputs
202 `(("python-pytest" ,python-pytest)))
203 (propagated-inputs
204 `(("python-alembic" ,python-alembic-0.6.6)
205 ("python-pytest-xdist" ,python-pytest-xdist)
206 ("python-celery" ,python-celery)
207 ("python-kombu" ,python-kombu)
208 ("python-webtest" ,python-webtest)
209 ("python-pastedeploy" ,python-pastedeploy)
210 ("python-paste" ,python-paste)
211 ("python-pastescript" ,python-pastescript)
212 ("python-translitcodec" ,python-translitcodec)
213 ("python-babel" ,python-babel)
214 ("python-configobj" ,python-configobj)
215 ("python-dateutil-2" ,python-dateutil-2)
216 ("python-itsdangerous" ,python-itsdangerous)
217 ("python-jinja2" ,python-jinja2)
218 ("python-jsonschema" ,python-jsonschema)
219 ("python-lxml" ,python-lxml)
220 ("python-markdown" ,python-markdown)
221 ("python-oauthlib" ,python-oauthlib)
222 ("python-pillow" ,python-pillow)
223 ("python-py-bcrypt" ,python-py-bcrypt)
224 ("python-pyld" ,python-pyld)
225 ("python-pytz" ,python-pytz)
226 ("python-requests" ,python-requests)
227 ("python-setuptools" ,python-setuptools)
228 ("python-six" ,python-six)
229 ("python-sphinx" ,python-sphinx)
230 ("python-docutils" ,python-docutils)
231 ("python-sqlalchemy" ,python-sqlalchemy-0.9.10)
232 ("python-unidecode" ,python-unidecode)
233 ("python-werkzeug" ,python-werkzeug)
234 ("python-exif-read" ,python-exif-read)
235 ("python-wtforms" ,python-wtforms)))
236 (home-page "http://mediagoblin.org/")
237 (synopsis "Web application for media publishing")
238 (description "MediaGoblin is a web application for publishing all kinds of
239 media.")
240 (license agpl3+)))
241
242 (package
243 (inherit mediagoblin)
244 (name "mediagoblin-hackenv")
245 (version "git")
246 (inputs
247 `(;;; audio/video stuff
248 ("gstreamer" ,gstreamer)
249 ("gst-plugins-base" ,gst-plugins-base)
250 ("gst-plugins-good" ,gst-plugins-good)
251 ("gst-plugins-ugly" ,gst-plugins-ugly)
252 ("gobject-introspection" ,gobject-introspection)
253 ;; useful to have!
254 ("coreutils" ,coreutils)
255 ;; used by runtests.sh!
256 ("which" ,which)
257 ("git" ,git)
258 ("automake" ,automake)
259 ("autoconf" ,(autoconf-wrapper))
260 ,@(package-inputs mediagoblin)))
261 (propagated-inputs
262 `(("python" ,python)
263 ("python-virtualenv" ,python-virtualenv)
264 ("python-pygobject" ,python-pygobject)
265 ;; Needs python-gst in order for all tests to pass
266 ("python-numpy" ,python-numpy)
267 ,@(package-propagated-inputs mediagoblin))))