gnu: python-pytest-xdist: Disable tests.
[jackhill/guix/guix.git] / gnu / packages / django.scm
CommitLineData
d18197af
HG
1;;; GNU Guix --- Functional package management for GNU
2;;; Copyright © 2016 Hartmut Goebel <h.goebel@crazy-compilers.com>
23b563dc 3;;; Copyright © 2016 Efraim Flashner <efraim@flashner.co.il>
d18197af
HG
4;;;
5;;; This file is part of GNU Guix.
6;;;
7;;; GNU Guix is free software; you can redistribute it and/or modify it
8;;; under the terms of the GNU General Public License as published by
9;;; the Free Software Foundation; either version 3 of the License, or (at
10;;; your option) any later version.
11;;;
12;;; GNU Guix is distributed in the hope that it will be useful, but
13;;; WITHOUT ANY WARRANTY; without even the implied warranty of
14;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15;;; GNU General Public License for more details.
16;;;
17;;; You should have received a copy of the GNU General Public License
18;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
19
20(define-module (gnu packages django)
21 #:use-module ((guix licenses) #:prefix license:)
22 #:use-module (guix packages)
23 #:use-module (guix download)
24 #:use-module (guix build-system python)
25 #:use-module (gnu packages)
26 #:use-module (gnu packages base)
27 #:use-module (gnu packages python))
28
29(define-public python-django
30 (package
31 (name "python-django")
bac3d609 32 (version "1.10.3")
d18197af
HG
33 (source (origin
34 (method url-fetch)
35 (uri (pypi-uri "Django" version))
36 (sha256
37 (base32
bac3d609 38 "0c4c8zs7kzb0bdlpy4vlzv6va26dbazr32h91rldf6waxs6z14kg"))))
d18197af
HG
39 (build-system python-build-system)
40 (arguments
41 '(#:phases
42 (modify-phases %standard-phases
43 (add-before 'check 'set-tzdir
44 (lambda* (#:key inputs #:allow-other-keys)
45 ;; The test-suite tests timezone-dependent functions, thus tzdata
46 ;; needs to be available.
47 (setenv "TZDIR"
48 (string-append (assoc-ref inputs "tzdata")
49 "/share/zoneinfo"))
50 #t))
51 (replace 'check
52 (lambda _
53 (setenv "PYTHONPATH"
54 (string-append ".:" (getenv "PYTHONPATH")))
55 (zero? (system* "python" "tests/runtests.py")))))))
56 ;; TODO: Install extras/django_bash_completion.
dfdaea32
HG
57 (native-inputs
58 `(("tzdata", tzdata)
59 ;; bcrypt and argon2-cffi are extra requirements not yet in guix
d18197af
HG
60 ;;("python-argon2-cffi" ,python-argon2-cffi) ; >= 16.1.0
61 ;;("python-bcrypt" ,python-bcrypt) ; not py-bcrypt!
dfdaea32
HG
62 ;; Remaining packages are test requirements taken from
63 ;; tests/requirements/py3.txt
d18197af
HG
64 ("python-docutils" ,python-docutils)
65 ;; optional for tests: ("python-geoip2" ,python-geoip2)
66 ("python-jinja2" ,python-jinja2) ; >= 2.7
67 ;; optional for tests: ("python-memcached" ,python-memcached)
68 ("python-numpy" ,python-numpy)
69 ("python-pillow" ,python-pillow)
70 ("python-pyyaml" ,python-pyyaml)
71 ("python-pytz" ,python-pytz)
72 ;; optional for tests: ("python-selenium" ,python-selenium)
73 ("python-sqlparse" ,python-sqlparse)
74 ("python-tblib" ,python-tblib)))
75 (home-page "http://www.djangoproject.com/")
76 (synopsis "High-level Python Web framework")
77 (description
78 "Django is a high-level Python Web framework that encourages rapid
79development and clean, pragmatic design. It provides many tools for building
80any Web site. Django focuses on automating as much as possible and adhering
81to the @dfn{don't repeat yourself} (DRY) principle.")
82 (license license:bsd-3)
83 (properties `((python2-variant . ,(delay python2-django))))))
84
85(define-public python2-django
86 (let ((base (package-with-python2 (strip-python2-variant python-django))))
87 (package
88 (inherit base)
dfdaea32
HG
89 (native-inputs
90 `(;; Test requirements for Python 2 taken from
91 ;; tests/requirements/py3.txt: enum34 and mock.
d18197af
HG
92 ("python2-enum34" ,python2-enum34)
93 ("python2-mock" ,python2-mock)
94 ;; When adding memcached mind: for Python 2 memcached <= 1.53 is
95 ;; required.
cda5e76f 96 ,@(package-native-inputs base))))))
b53fc294
HG
97
98(define-public python-django-simple-math-captcha
99 (package
100 (name "python-django-simple-math-captcha")
101 (version "1.0.7")
102 (source (origin
103 (method url-fetch)
104 (uri (pypi-uri "django-simple-math-captcha" version))
105 (sha256
106 (base32
107 "0906hms6y6znjhpd0g4wmzv9vcla4brkdpsm4zha9zdj8g5vq2hd"))))
108 (build-system python-build-system)
281cc11c
MB
109 (arguments
110 ;; FIXME: Upstream uses a 'runtests.py' script that is not
111 ;; present in the pypi tarball.
112 '(#:tests? #f))
b53fc294
HG
113 (propagated-inputs
114 `(("python-django" ,python-django)))
b53fc294
HG
115 (home-page "https://github.com/alsoicode/django-simple-math-captcha")
116 (synopsis "Easy-to-use math field/widget captcha for Django forms")
117 (description
118 "A multi-value-field that presents a human answerable question,
119with no settings.py configuration necessary, but instead can be configured
120with arguments to the field constructor.")
121 (license license:asl2.0)))
122
123(define-public python2-django-simple-math-captcha
124 (package-with-python2 python-django-simple-math-captcha))
23b563dc
EF
125
126(define-public python-pytest-django
127 (package
128 (name "python-pytest-django")
129 (version "2.9.1")
130 (source (origin
131 (method url-fetch)
132 (uri (pypi-uri "pytest-django" version))
133 (sha256
134 (base32
135 "1mmc7zsz3dlhs6sx4sppkj1vgshabi362r1a8b8wpj1qfximpqcb"))))
136 (build-system python-build-system)
137 (arguments
138 `(#:phases
139 (modify-phases %standard-phases
140 (add-after 'unpack 'patch-setuppy
141 (lambda _
142 (substitute* "setup.py"
143 (("setuptools_scm==1.8.0") "setuptools_scm"))
144 #t)))))
145 (native-inputs
d18c69aa
EF
146 `(("python-django" ,python-django)
147 ("python-setuptools-scm" ,python-setuptools-scm)))
f22efa01 148 (propagated-inputs
bac68168 149 `(("python-pytest" ,python-pytest)))
23b563dc
EF
150 (home-page "http://pytest-django.readthedocs.org/")
151 (synopsis "Django plugin for py.test")
152 (description "Pytest-django is a plugin for py.test that provides a set of
153useful tools for testing Django applications and projects.")
23b563dc
EF
154 (license license:bsd-3)))
155
156(define-public python2-pytest-django
5c31f4aa 157 (package-with-python2 python-pytest-django))
894810c7
EF
158
159(define-public python-django-filter
160 (package
161 (name "python-django-filter")
162 (version "0.14.0")
163 (source (origin
164 (method url-fetch)
165 (uri (pypi-uri "django-filter" version))
166 (sha256
167 (base32
168 "0f78hmk8c903zwfzlsiw7ivgag81ymmb5hi73rzxbhnlg2v0l3fx"))))
169 (build-system python-build-system)
55ab6451
MB
170 (arguments
171 '(#:phases
172 (modify-phases %standard-phases
173 (replace 'check
174 (lambda _
175 (zero? (system* "python" "runtests.py")))))))
fa7cd333
EF
176 (native-inputs
177 `(("python-django" ,python-django)
178 ("python-mock" ,python-mock)))
894810c7
EF
179 (home-page "https://django-filter.readthedocs.io/en/latest/")
180 (synopsis "Reusable Django application to filter querysets dynamically")
181 (description
182 "Django-filter is a generic, reusable application to alleviate writing
183some of the more mundane bits of view code. Specifically, it allows users to
184filter down a queryset based on a model’s fields, displaying the form to let
185them do this.")
894810c7
EF
186 (license license:bsd-3)))
187
188(define-public python2-django-filter
5c31f4aa 189 (package-with-python2 python-django-filter))