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 `(("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")
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)))
119 (define-public python2-django-simple-math-captcha
120 (package-with-python2 python-django-simple-math-captcha))
122 (define-public python-pytest-django
124 (name "python-pytest-django")
128 (uri (pypi-uri "pytest-django" version))
131 "1mmc7zsz3dlhs6sx4sppkj1vgshabi362r1a8b8wpj1qfximpqcb"))))
132 (build-system python-build-system)
135 (modify-phases %standard-phases
136 (add-after 'unpack 'patch-setuppy
138 (substitute* "setup.py"
139 (("setuptools_scm==1.8.0") "setuptools_scm"))
142 `(("python-django" ,python-django)
143 ("python-setuptools-scm" ,python-setuptools-scm)))
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)))
152 (define-public python2-pytest-django
153 (package-with-python2 python-pytest-django))
155 (define-public python-django-filter
157 (name "python-django-filter")
161 (uri (pypi-uri "django-filter" version))
164 "0f78hmk8c903zwfzlsiw7ivgag81ymmb5hi73rzxbhnlg2v0l3fx"))))
165 (build-system python-build-system)
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")
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
176 (license license:bsd-3)))
178 (define-public python2-django-filter
179 (package-with-python2 python-django-filter))