gnu: libuv: Update to 1.11.0.
[jackhill/guix/guix.git] / gnu / packages / django.scm
1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2016 Hartmut Goebel <h.goebel@crazy-compilers.com>
3 ;;; Copyright © 2016 Efraim Flashner <efraim@flashner.co.il>
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")
32 (version "1.10.5")
33 (source (origin
34 (method url-fetch)
35 (uri (pypi-uri "Django" version))
36 (sha256
37 (base32
38 "12szjsmnfhh2yr54sfynyjr8vl0q9gb6qak3ayqcifcinrs97f0d"))))
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.
57 (native-inputs
58 `(("tzdata", tzdata)
59 ;; bcrypt and argon2-cffi are extra requirements not yet in guix
60 ;;("python-argon2-cffi" ,python-argon2-cffi) ; >= 16.1.0
61 ;;("python-bcrypt" ,python-bcrypt) ; not py-bcrypt!
62 ;; Remaining packages are test requirements taken from
63 ;; tests/requirements/py3.txt
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
79 development and clean, pragmatic design. It provides many tools for building
80 any Web site. Django focuses on automating as much as possible and adhering
81 to 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)
89 (native-inputs
90 `(;; Test requirements for Python 2 taken from
91 ;; tests/requirements/py3.txt: enum34 and mock.
92 ("python2-enum34" ,python2-enum34)
93 ("python2-mock" ,python2-mock)
94 ;; When adding memcached mind: for Python 2 memcached <= 1.53 is
95 ;; required.
96 ,@(package-native-inputs base))))))
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)
109 (propagated-inputs
110 `(("python-django" ,python-django)))
111 (home-page "https://github.com/alsoicode/django-simple-math-captcha")
112 (synopsis "Easy-to-use math field/widget captcha for Django forms")
113 (description
114 "A multi-value-field that presents a human answerable question,
115 with no settings.py configuration necessary, but instead can be configured
116 with arguments to the field constructor.")
117 (license license:asl2.0)))
118
119 (define-public python2-django-simple-math-captcha
120 (package-with-python2 python-django-simple-math-captcha))
121
122 (define-public python-pytest-django
123 (package
124 (name "python-pytest-django")
125 (version "2.9.1")
126 (source (origin
127 (method url-fetch)
128 (uri (pypi-uri "pytest-django" version))
129 (sha256
130 (base32
131 "1mmc7zsz3dlhs6sx4sppkj1vgshabi362r1a8b8wpj1qfximpqcb"))))
132 (build-system python-build-system)
133 (arguments
134 `(#:phases
135 (modify-phases %standard-phases
136 (add-after 'unpack 'patch-setuppy
137 (lambda _
138 (substitute* "setup.py"
139 (("setuptools_scm==1.8.0") "setuptools_scm"))
140 #t)))))
141 (native-inputs
142 `(("python-django" ,python-django)
143 ("python-setuptools-scm" ,python-setuptools-scm)))
144 (propagated-inputs
145 `(("python-pytest" ,python-pytest)))
146 (home-page "http://pytest-django.readthedocs.org/")
147 (synopsis "Django plugin for py.test")
148 (description "Pytest-django is a plugin for py.test that provides a set of
149 useful tools for testing Django applications and projects.")
150 (license license:bsd-3)))
151
152 (define-public python2-pytest-django
153 (package-with-python2 python-pytest-django))
154
155 (define-public python-django-filter
156 (package
157 (name "python-django-filter")
158 (version "0.14.0")
159 (source (origin
160 (method url-fetch)
161 (uri (pypi-uri "django-filter" version))
162 (sha256
163 (base32
164 "0f78hmk8c903zwfzlsiw7ivgag81ymmb5hi73rzxbhnlg2v0l3fx"))))
165 (build-system python-build-system)
166 (native-inputs
167 `(("python-django" ,python-django)
168 ("python-mock" ,python-mock)))
169 (home-page "https://django-filter.readthedocs.io/en/latest/")
170 (synopsis "Reusable Django application to filter querysets dynamically")
171 (description
172 "Django-filter is a generic, reusable application to alleviate writing
173 some of the more mundane bits of view code. Specifically, it allows users to
174 filter down a queryset based on a model’s fields, displaying the form to let
175 them do this.")
176 (license license:bsd-3)))
177
178 (define-public python2-django-filter
179 (package-with-python2 python-django-filter))