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>
5 ;;; This file is part of GNU Guix.
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.
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.
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/>.
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))
29 (define-public python-django
31 (name "python-django")
35 (uri (pypi-uri "Django" version))
38 "12szjsmnfhh2yr54sfynyjr8vl0q9gb6qak3ayqcifcinrs97f0d"))))
39 (build-system python-build-system)
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.
48 (string-append (assoc-ref inputs "tzdata")
54 (string-append ".:" (getenv "PYTHONPATH")))
55 (zero? (system* "python" "tests/runtests.py")))))))
56 ;; TODO: Install extras/django_bash_completion.
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")
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))))))
85 (define-public python2-django
86 (let ((base (package-with-python2 (strip-python2-variant python-django))))
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
96 ,@(package-native-inputs base))))))
98 (define-public python-django-simple-math-captcha
100 (name "python-django-simple-math-captcha")
104 (uri (pypi-uri "django-simple-math-captcha" version))
107 "0906hms6y6znjhpd0g4wmzv9vcla4brkdpsm4zha9zdj8g5vq2hd"))))
108 (build-system python-build-system)
110 ;; FIXME: Upstream uses a 'runtests.py' script that is not
111 ;; present in the pypi tarball.
114 `(("python-django" ,python-django)))
115 (home-page "https://github.com/alsoicode/django-simple-math-captcha")
116 (synopsis "Easy-to-use math field/widget captcha for Django forms")
118 "A multi-value-field that presents a human answerable question,
119 with no settings.py configuration necessary, but instead can be configured
120 with arguments to the field constructor.")
121 (license license:asl2.0)))
123 (define-public python2-django-simple-math-captcha
124 (package-with-python2 python-django-simple-math-captcha))
126 (define-public python-pytest-django
128 (name "python-pytest-django")
132 (uri (pypi-uri "pytest-django" version))
135 "1mmc7zsz3dlhs6sx4sppkj1vgshabi362r1a8b8wpj1qfximpqcb"))))
136 (build-system python-build-system)
138 `(#:tests? #f ; FIXME: How to run tests?
140 (modify-phases %standard-phases
141 (add-after 'unpack 'patch-setuppy
143 (substitute* "setup.py"
144 (("setuptools_scm==1.8.0") "setuptools_scm"))
147 `(("python-django" ,python-django)
148 ("python-setuptools-scm" ,python-setuptools-scm)))
150 `(("python-pytest" ,python-pytest)))
151 (home-page "http://pytest-django.readthedocs.org/")
152 (synopsis "Django plugin for py.test")
153 (description "Pytest-django is a plugin for py.test that provides a set of
154 useful tools for testing Django applications and projects.")
155 (license license:bsd-3)))
157 (define-public python2-pytest-django
158 (package-with-python2 python-pytest-django))
160 (define-public python-django-filter
162 (name "python-django-filter")
166 (uri (pypi-uri "django-filter" version))
169 "0f78hmk8c903zwfzlsiw7ivgag81ymmb5hi73rzxbhnlg2v0l3fx"))))
170 (build-system python-build-system)
173 (modify-phases %standard-phases
176 (zero? (system* "python" "runtests.py")))))))
178 `(("python-django" ,python-django)
179 ("python-mock" ,python-mock)))
180 (home-page "https://django-filter.readthedocs.io/en/latest/")
181 (synopsis "Reusable Django application to filter querysets dynamically")
183 "Django-filter is a generic, reusable application to alleviate writing
184 some of the more mundane bits of view code. Specifically, it allows users to
185 filter down a queryset based on a model’s fields, displaying the form to let
187 (license license:bsd-3)))
189 (define-public python2-django-filter
190 (package-with-python2 python-django-filter))