about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/python-modules/sanic
diff options
context:
space:
mode:
authorAlyssa Ross <hi@alyssa.is>2021-01-15 10:30:44 +0000
committerAlyssa Ross <hi@alyssa.is>2021-01-15 10:30:44 +0000
commite0794be8a0d11e90461e5a9c85012a36b93ec976 (patch)
treeefd9cbc55ea3322867bf601c4d536758a3dd5fcc /nixpkgs/pkgs/development/python-modules/sanic
parent3538874082ded7647b1ccec0343c7c1e882cfef3 (diff)
parent1a57d96edd156958b12782e8c8b6a374142a7248 (diff)
downloadnixlib-e0794be8a0d11e90461e5a9c85012a36b93ec976.tar
nixlib-e0794be8a0d11e90461e5a9c85012a36b93ec976.tar.gz
nixlib-e0794be8a0d11e90461e5a9c85012a36b93ec976.tar.bz2
nixlib-e0794be8a0d11e90461e5a9c85012a36b93ec976.tar.lz
nixlib-e0794be8a0d11e90461e5a9c85012a36b93ec976.tar.xz
nixlib-e0794be8a0d11e90461e5a9c85012a36b93ec976.tar.zst
nixlib-e0794be8a0d11e90461e5a9c85012a36b93ec976.zip
Merge commit '1a57d96edd156958b12782e8c8b6a374142a7248'
Diffstat (limited to 'nixpkgs/pkgs/development/python-modules/sanic')
-rw-r--r--nixpkgs/pkgs/development/python-modules/sanic/default.nix134
1 files changed, 22 insertions, 112 deletions
diff --git a/nixpkgs/pkgs/development/python-modules/sanic/default.nix b/nixpkgs/pkgs/development/python-modules/sanic/default.nix
index c4f56e2d4c6d..aaedaa5ef8c5 100644
--- a/nixpkgs/pkgs/development/python-modules/sanic/default.nix
+++ b/nixpkgs/pkgs/development/python-modules/sanic/default.nix
@@ -1,130 +1,40 @@
-{ lib
-, buildPythonPackage
-, fetchPypi
-, httptools
-, aiofiles
-, websockets
-, multidict
-, uvloop
-, ujson
-, pytest
-, gunicorn
-, aiohttp
-, beautifulsoup4
-, pytest-sanic
-, pytest-benchmark
-
-# required just httpcore / requests-async
-, h11
-, h2
-, certifi
-, chardet
-, idna
-, requests
-, rfc3986
-, uvicorn
+{ lib, buildPythonPackage, fetchPypi
+, aiofiles, httptools, httpx, multidict, ujson, uvloop, websockets
+, pytestCheckHook, beautifulsoup4, gunicorn, httpcore, uvicorn
+, pytest-asyncio, pytest-benchmark, pytest-dependency, pytest-sanic, pytest-sugar, pytestcov
 }:
 
-let
-
-  # This version of sanic depends on two packages that have been deprecated by
-  # their development teams:
-  #
-  # - requests-async [where first line of pypi says to use `http3` instead now]
-  # - httpcore       [where the homepage redirects to `http3` now]
-  #
-  # Since no other packages in nixpkg depend on these right now, define these
-  # packages just as local dependencies here, to avoid bloat.
-
-  httpcore = buildPythonPackage rec {
-    pname = "httpcore";
-    version = "0.3.0";
-    src = fetchPypi {
-      inherit pname version;
-      sha256 = "0n3bamaixxhcm27gf1ws3g6rkamvqx87087c88r6hyyl52si1ycn";
-    };
-
-    propagatedBuildInputs = [ certifi chardet h11 h2 idna rfc3986 ];
-
-    # relax pinned old version of h11
-    postConfigure = ''
-      substituteInPlace setup.py \
-        --replace "h11==0.8.*" "h11"
-      '';
-
-    # LICENCE.md gets propagated without this, causing collisions
-    postInstall = ''
-      rm $out/LICENSE.md
-    '';
-  };
-
-  requests-async = buildPythonPackage rec {
-    pname = "requests-async";
-    version = "0.5.0";
-    src = fetchPypi {
-      inherit pname version;
-      sha256 = "8731420451383196ecf2fd96082bfc8ae5103ada90aba185888499d7784dde6f";
-    };
-
-    propagatedBuildInputs = [ requests httpcore ];
-
-    # LICENCE.md gets propagated without this, causing collisions
-    postInstall = ''
-      rm $out/LICENSE.md
-    '';
-  };
-
-in
-
 buildPythonPackage rec {
   pname = "sanic";
-  version = "19.6.3";
+  version = "20.9.1";
 
   src = fetchPypi {
     inherit pname version;
-    sha256 = "0b1qqsvdjkibrw5kgr0pm7n7jzb1403132wjmb0lx3k5wyvqfi95";
+    sha256 = "06p0lsxqbfbka2yaqlpp0bg5pf7ma44zi6kq7qbb6hhry48dp1w6";
   };
 
+  patchPhase = ''
+    substituteInPlace setup.py \
+      --replace '"multidict==5.0.0"' '"multidict"' \
+      --replace '"httpx==0.15.4"' '"httpx"' \
+      --replace '"httpcore==0.3.0"' '"httpcore"' \
+      --replace '"pytest==5.2.1"' '"pytest"'
+  '';
+
   propagatedBuildInputs = [
-    httptools
-    aiofiles
-    websockets
-    multidict
-    requests-async
-    uvloop
-    ujson
+    aiofiles httptools httpx multidict ujson uvloop websockets
   ];
 
   checkInputs = [
-    pytest
-    gunicorn
-    aiohttp
-    beautifulsoup4
-    pytest-sanic
-    pytest-benchmark
-    uvicorn
+    pytestCheckHook beautifulsoup4 gunicorn httpcore uvicorn
+    pytest-asyncio pytest-benchmark pytest-dependency pytest-sanic pytest-sugar pytestcov
   ];
 
-  # Sanic says it needs websockets 7.x, but the changelog for 8.x is actually
-  # nearly compatible with sanic's use. So relax this constraint, with a small
-  # required code change.
-  postConfigure = ''
-    substituteInPlace setup.py --replace \
-      "websockets>=7.0,<8.0"             \
-      "websockets>=7.0,<9.0"
-    substituteInPlace sanic/websocket.py --replace    \
-           "self.websocket.subprotocol = subprotocol" \
-           "self.websocket.subprotocol = subprotocol
-            self.websocket.is_client = False"
-  '';
-
-  # 10/500 tests ignored due to missing directory and
-  # requiring network access
-  checkPhase = ''
-    pytest --ignore tests/test_blueprints.py \
-           --ignore tests/test_routes.py \
-           --ignore tests/test_worker.py
-  '';
+  disabledTests = [
+    "test_gunicorn" # No "examples" directory in pypi distribution.
+    "test_logo" # Fails to filter out "DEBUG asyncio:selector_events.py:59 Using selector: EpollSelector"
+    "test_zero_downtime" # No "examples.delayed_response.app" module in pypi distribution.
+  ];
 
   meta = with lib; {
     description = "A microframework based on uvloop, httptools, and learnings of flask";