From c19961406504ba9e90e836b30751f68f1d4820d9 Mon Sep 17 00:00:00 2001 From: Giacomo Leidi Date: Tue, 20 Oct 2020 12:51:27 +0200 Subject: [PATCH 9/9] gnu: Add python-sanic. * gnu/packages/python-check.scm (python-pytest-sanic): New variable. * gnu/packages/python-web.scm (python-sanic): New variable. --- gnu/packages/python-check.scm | 28 +++++++++++++++++ gnu/packages/python-web.scm | 59 +++++++++++++++++++++++++++++++++++ 2 files changed, 87 insertions(+) diff --git a/gnu/packages/python-check.scm b/gnu/packages/python-check.scm index 498f495584..caab81f18c 100644 --- a/gnu/packages/python-check.scm +++ b/gnu/packages/python-check.scm @@ -1044,3 +1044,31 @@ any Python VM with basically no runtime overhead.") (description "Robber is a Python assertion library for test-driven and behavior-driven development (TDD and BDD).") (license license:expat))) + +;; This is only used by python-sanic +(define-public python-pytest-sanic + (package + (name "python-pytest-sanic") + (version "1.6.2") + (source + (origin + (method url-fetch) + (uri (pypi-uri "pytest-sanic" version)) + (sha256 + (base32 + "02ajd8z77ahi69kzkz200qgxrb4s2j4qb6k8j9ds1kz6qa6fsa34")))) + (build-system python-build-system) + (arguments + ;; Tests depend on python-sanic. + `(#:tests? #f)) + (propagated-inputs + `(("python-aiohttp" ,python-aiohttp) + ("python-async-generator" + ,python-async-generator) + ("python-pytest" ,python-pytest))) + (home-page + "https://github.com/yunstanford/pytest-sanic") + (synopsis "Pytest plugin for Sanic") + (description "A pytest plugin for Sanic. It helps you to test your +code asynchronously.") + (license license:expat))) diff --git a/gnu/packages/python-web.scm b/gnu/packages/python-web.scm index b0bbd66583..5aaf9fb03d 100644 --- a/gnu/packages/python-web.scm +++ b/gnu/packages/python-web.scm @@ -39,6 +39,7 @@ ;;; Copyright © 2020 Edouard Klein ;;; Copyright © 2020 Vinicius Monego ;;; Copyright © 2020 Konrad Hinsen +;;; Copyright © 2020 Giacomo Leidi ;;; ;;; This file is part of GNU Guix. ;;; @@ -5185,3 +5186,61 @@ challenges.") "@code{python-hstspreload} contains Chromium HSTS Preload list as a Python package.") (license license:bsd-3))) + +(define-public python-sanic + (package + (name "python-sanic") + (version "20.9.0") + (source + (origin + (method url-fetch) + (uri (pypi-uri "sanic" version)) + (sha256 + (base32 + "0h832ja7j1f2w0ylbx5vj0j5gv5j9gn1yhhspvq0yikjyrkg46yr")))) + (build-system python-build-system) + (arguments + '(#:phases + (modify-phases %standard-phases + (add-after 'unpack 'use-recent-pytest + ;; Allow using recent dependencies. + (lambda* (#:key inputs #:allow-other-keys) + (substitute* "setup.py" + (("httpcore==0.3.0") "httpcore") + (("pytest==5.2.1") "pytest")) + #t)) + (replace 'check + (lambda* (#:key inputs outputs #:allow-other-keys) + (add-installed-pythonpath inputs outputs) + (invoke "pytest" "-vv" "./tests" "-k" + "not test_zero_downtime and not test_gunicorn_worker")))))) + (propagated-inputs + `(("python-aiofiles" ,python-aiofiles) + ("python-httptools" ,python-httptools) + ("python-httpx" ,python-httpx) + ("python-multidict" ,python-multidict) + ("python-ujson" ,python-ujson) + ("python-uvloop" ,python-uvloop) + ("python-websockets" ,python-websockets))) + (native-inputs + `(("gunicorn" ,gunicorn) + ("python-beautifulsoup4" ,python-beautifulsoup4) + ("python-hstspreload" ,python-hstspreload) + ("python-httpcore" ,python-httpcore) + ("python-pytest" ,python-pytest) + ("python-pytest-cov" ,python-pytest-cov) + ("python-pytest-benchmark" ,python-pytest-benchmark) + ("python-pytest-sanic" ,python-pytest-sanic) + ("python-pytest-sugar" ,python-pytest-sugar) + ("python-urllib3" ,python-urllib3) + ("python-uvicorn" ,python-uvicorn))) + (home-page + "https://github.com/huge-success/sanic/") + (synopsis + "Async Python 3.6+ web server/framework") + (description + "Sanic is a Python 3.6+ web server and web framework +that's written to go fast. It allows the usage of the +@code{async/await} syntax added in Python 3.5, which makes +your code non-blocking and speedy.") + (license license:expat))) -- 2.28.0