about summary refs log tree commit diff
path: root/pkgs/development/python-modules
diff options
context:
space:
mode:
authorgithub-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>2022-10-21 00:05:50 +0000
committerGitHub <noreply@github.com>2022-10-21 00:05:50 +0000
commitc43416535429396cc99bccf16e7fbe4c0adea4cf (patch)
tree7ff62b70be50a592d302fe76f007f94c5043751a /pkgs/development/python-modules
parente674dd40b315eec88ac24691145387c202983eb6 (diff)
parentdd2351ee2f2671d2f2216dd843e4997060eb9576 (diff)
Merge master into staging-next
Diffstat (limited to 'pkgs/development/python-modules')
-rw-r--r--pkgs/development/python-modules/apache-airflow/default.nix4
-rw-r--r--pkgs/development/python-modules/flask-appbuilder/default.nix4
-rw-r--r--pkgs/development/python-modules/flask-security-too/default.nix4
-rw-r--r--pkgs/development/python-modules/inscriptis/default.nix38
-rw-r--r--pkgs/development/python-modules/jsonpath-ng/default.nix7
-rw-r--r--pkgs/development/python-modules/nuitka/default.nix6
-rw-r--r--pkgs/development/python-modules/playwright/default.nix221
-rw-r--r--pkgs/development/python-modules/playwright/driver-location.patch47
-rwxr-xr-xpkgs/development/python-modules/playwright/update.sh31
-rw-r--r--pkgs/development/python-modules/selenium/default.nix9
-rw-r--r--pkgs/development/python-modules/sentry-sdk/default.nix2
-rw-r--r--pkgs/development/python-modules/sqlalchemy-continuum/default.nix4
12 files changed, 358 insertions, 19 deletions
diff --git a/pkgs/development/python-modules/apache-airflow/default.nix b/pkgs/development/python-modules/apache-airflow/default.nix
index 091020c76327c..438dc46038cb2 100644
--- a/pkgs/development/python-modules/apache-airflow/default.nix
+++ b/pkgs/development/python-modules/apache-airflow/default.nix
@@ -20,7 +20,7 @@
 , deprecated
 , dill
 , flask
-, flask_login
+, flask-login
 , flask-appbuilder
 , flask-caching
 , flask-session
@@ -159,7 +159,7 @@ buildPythonPackage rec {
     flask-caching
     flask-session
     flask-wtf
-    flask_login
+    flask-login
     GitPython
     graphviz
     gunicorn
diff --git a/pkgs/development/python-modules/flask-appbuilder/default.nix b/pkgs/development/python-modules/flask-appbuilder/default.nix
index 2ef78ecf8d450..b122d6020bc31 100644
--- a/pkgs/development/python-modules/flask-appbuilder/default.nix
+++ b/pkgs/development/python-modules/flask-appbuilder/default.nix
@@ -8,7 +8,7 @@
 , email-validator
 , flask
 , flask-babel
-, flask_login
+, flask-login
 , flask-openid
 , flask-sqlalchemy
 , flask-wtf
@@ -59,7 +59,7 @@ buildPythonPackage rec {
     email-validator
     flask
     flask-babel
-    flask_login
+    flask-login
     flask-openid
     flask-sqlalchemy
     flask-wtf
diff --git a/pkgs/development/python-modules/flask-security-too/default.nix b/pkgs/development/python-modules/flask-security-too/default.nix
index 480e711c1c07e..bdefbc3db291a 100644
--- a/pkgs/development/python-modules/flask-security-too/default.nix
+++ b/pkgs/development/python-modules/flask-security-too/default.nix
@@ -25,7 +25,7 @@
 , blinker
 , email-validator
 , flask
-, flask_login
+, flask-login
 , flask_principal
 , flask-wtf
 , itsdangerous
@@ -57,7 +57,7 @@ buildPythonPackage rec {
     blinker
     email-validator
     flask
-    flask_login
+    flask-login
     flask_principal
     flask-wtf
     itsdangerous
diff --git a/pkgs/development/python-modules/inscriptis/default.nix b/pkgs/development/python-modules/inscriptis/default.nix
new file mode 100644
index 0000000000000..2fa224b3f2109
--- /dev/null
+++ b/pkgs/development/python-modules/inscriptis/default.nix
@@ -0,0 +1,38 @@
+{ lib
+, buildPythonPackage
+, fetchFromGitHub
+, lxml
+, pytestCheckHook
+, requests
+}:
+
+buildPythonPackage rec {
+  pname = "inscriptis";
+  version = "2.3.1";
+  format = "setuptools";
+
+  src = fetchFromGitHub {
+    owner = "weblyzard";
+    repo = "inscriptis";
+    rev = version;
+    sha256 = "sha256-an/FTbujN2VnTYa0wngM8ugV1LNHJWM32RVqIbaW0KY=";
+  };
+
+  propagatedBuildInputs = [
+    lxml
+    requests
+  ];
+
+  checkInputs = [
+    pytestCheckHook
+  ];
+
+  pythonImportsCheck = [ "inscriptis" ];
+
+  meta = with lib; {
+    description = "inscriptis - HTML to text converter";
+    homepage = "https://github.com/weblyzard/inscriptis";
+    license = licenses.asl20;
+    maintainers = with maintainers; [ SuperSandro2000 ];
+  };
+}
diff --git a/pkgs/development/python-modules/jsonpath-ng/default.nix b/pkgs/development/python-modules/jsonpath-ng/default.nix
index da3a03c2a3e09..fce18a6da2cce 100644
--- a/pkgs/development/python-modules/jsonpath-ng/default.nix
+++ b/pkgs/development/python-modules/jsonpath-ng/default.nix
@@ -9,13 +9,14 @@
 
 buildPythonPackage rec {
   pname = "jsonpath-ng";
-  version = "1.5.2";
+  version = "1.5.3";
 
   src = fetchFromGitHub {
     owner = "h2non";
     repo = pname;
-    rev = "v${version}";
-    sha256 = "1cxjwhx0nj85a3awnl7j6afnk07awzv45qfwxl5jqbbc9cxh5bd6";
+    # missing tag https://github.com/h2non/jsonpath-ng/issues/114
+    rev = "cce4a3d4063ac8af928795acc53beb27a2bfd101";
+    sha256 = "sha256-+9iQHQs5TQhZFeIqMlsa3FFPfZEktAWy1lSdJU7kZrc=";
   };
 
   propagatedBuildInputs = [
diff --git a/pkgs/development/python-modules/nuitka/default.nix b/pkgs/development/python-modules/nuitka/default.nix
index 127f1fcbedf68..b81ba43c83174 100644
--- a/pkgs/development/python-modules/nuitka/default.nix
+++ b/pkgs/development/python-modules/nuitka/default.nix
@@ -10,15 +10,15 @@
 }:
 
 buildPythonPackage rec {
-  version = "0.6.14.5";
+  version = "1.1.5";
   pname = "Nuitka";
 
   # Latest version is not yet on PyPi
   src = fetchFromGitHub {
-    owner = "kayhayen";
+    owner = "Nuitka";
     repo = "Nuitka";
     rev = version;
-    sha256 = "08kcp22zdgp25kk4bp56z196mn6bdi3z4x0q2y9vyz0ywfzp9zap";
+    sha256 = "0wgcl860acbxnq8q9hck147yhxz8pcbqhv9glracfnrsd2qkpgpp";
   };
 
   checkInputs = [ vmprof pyqt4 ];
diff --git a/pkgs/development/python-modules/playwright/default.nix b/pkgs/development/python-modules/playwright/default.nix
new file mode 100644
index 0000000000000..cea762819573e
--- /dev/null
+++ b/pkgs/development/python-modules/playwright/default.nix
@@ -0,0 +1,221 @@
+{ lib
+, stdenv
+, buildPythonPackage
+, chromium
+, ffmpeg
+, firefox
+, git
+, greenlet
+, jq
+, nodejs
+, fetchFromGitHub
+, fetchurl
+, makeFontsConf
+, makeWrapper
+, pyee
+, python
+, pythonOlder
+, runCommand
+, setuptools-scm
+, unzip
+}:
+
+let
+  inherit (stdenv.hostPlatform) system;
+  throwSystem = throw "Unsupported system: ${system}";
+
+  driverVersion = "1.27.1";
+
+  driver = let
+    suffix = {
+      x86_64-linux = "linux";
+      aarch64-linux = "linux-arm64";
+      x86_64-darwin = "mac";
+      aarch64-darwin = "mac-arm64";
+    }.${system} or throwSystem;
+    filename = "playwright-${driverVersion}-${suffix}.zip";
+  in stdenv.mkDerivation {
+    pname = "playwright-driver";
+    version = driverVersion;
+
+    src = fetchurl {
+      url = "https://playwright.azureedge.net/builds/driver/${filename}";
+      sha256 = {
+        x86_64-linux = "0x71b4kb8hlyacixipgfbgjgrbmhckxpbmrs2xk8iis7n5kg7539";
+        aarch64-linux = "125lih7g2gj91k7j196wy5a5746wyfr8idj3ng369yh5wl7lfcfv";
+        x86_64-darwin = "0z2kww4iby1izkwn6z2ai94y87bkjvwak8awdmjm8sgg00pa9l1a";
+        aarch64-darwin = "0qajh4ac5lr1sznb2c471r5c5g2r0dk2pyqz8vhvnbk36r524h1h";
+      }.${system} or throwSystem;
+    };
+
+    sourceRoot = ".";
+
+    nativeBuildInputs = [ unzip ];
+
+    postPatch = ''
+      # Use Nix's NodeJS instead of the bundled one.
+      substituteInPlace playwright.sh --replace '"$SCRIPT_PATH/node"' '"${nodejs}/bin/node"'
+      rm node
+
+      # Hard-code the script path to $out directory to avoid a dependency on coreutils
+      substituteInPlace playwright.sh \
+        --replace 'SCRIPT_PATH="$(cd "$(dirname "$0")" ; pwd -P)"' "SCRIPT_PATH=$out"
+
+      patchShebangs playwright.sh package/bin/*.sh
+    '';
+
+    installPhase = ''
+      runHook preInstall
+
+      mkdir -p $out/bin
+      mv playwright.sh $out/bin/playwright
+      mv package $out/
+
+      runHook postInstall
+    '';
+
+    passthru = {
+      inherit filename;
+    };
+  };
+
+  browsers-mac = stdenv.mkDerivation {
+    pname = "playwright-browsers";
+    version = driverVersion;
+
+    src = runCommand "playwright-browsers-base" {
+      outputHashMode = "recursive";
+      outputHashAlgo = "sha256";
+      outputHash = {
+        x86_64-darwin = "0z2kww4iby1izkwn6z2ai94y87bkjvwak8awdmjm8sgg00pa9l1a";
+      }.${system} or throwSystem;
+    } ''
+      export PLAYWRIGHT_BROWSERS_PATH=$out
+      ${driver}/bin/playwright install
+      rm -r $out/.links
+    '';
+
+    installPhase = ''
+      mkdir $out
+      cp -r * $out/
+    '';
+  };
+
+  browsers-linux = { withFirefox ? true, withChromium ? true }: let
+    fontconfig = makeFontsConf {
+      fontDirectories = [];
+    };
+  in runCommand ("playwright-browsers"
+    + lib.optionalString (withFirefox && !withChromium) "-firefox"
+    + lib.optionalString (!withFirefox && withChromium) "-chromium")
+  {
+    nativeBuildInputs = [
+      makeWrapper
+      jq
+    ];
+  } (''
+    BROWSERS_JSON=${driver}/share/playwright-driver/package/browsers.json
+  '' + lib.optionalString withChromium ''
+    CHROMIUM_REVISION=$(jq -r '.browsers[] | select(.name == "chromium").revision' $BROWSERS_JSON)
+    mkdir -p $out/chromium-$CHROMIUM_REVISION/chrome-linux
+
+    # See here for the Chrome options:
+    # https://github.com/NixOS/nixpkgs/issues/136207#issuecomment-908637738
+    makeWrapper ${chromium}/bin/chromium $out/chromium-$CHROMIUM_REVISION/chrome-linux/chrome \
+      --set SSL_CERT_FILE /etc/ssl/certs/ca-bundle.crt \
+      --set FONTCONFIG_FILE ${fontconfig}
+  '' + lib.optionalString withFirefox ''
+    FIREFOX_REVISION=$(jq -r '.browsers[] | select(.name == "firefox").revision' $BROWSERS_JSON)
+    mkdir -p $out/firefox-$FIREFOX_REVISION
+    ln -s ${firefox}/bin/firefox $out/firefox-$FIREFOX_REVISION/firefox
+  '' + ''
+    FFMPEG_REVISION=$(jq -r '.browsers[] | select(.name == "ffmpeg").revision' $BROWSERS_JSON)
+    mkdir -p $out/ffmpeg-$FFMPEG_REVISION
+    ln -s ${ffmpeg}/bin/ffmpeg $out/ffmpeg-$FFMPEG_REVISION/ffmpeg-linux
+  '');
+in
+buildPythonPackage rec {
+  pname = "playwright";
+  version = "1.27.1";
+  format = "setuptools";
+  disabled = pythonOlder "3.7";
+
+  src = fetchFromGitHub {
+    owner = "microsoft";
+    repo = "playwright-python";
+    rev = "v${version}";
+    sha256 = "sha256-cI/4GdkmTikoP9O0Skh/0jCxxRypRua0231iKcxtBcY=";
+  };
+
+  patches = [
+    # This patches two things:
+    # - The driver location, which is now a static package in the Nix store.
+    # - The setup script, which would try to download the driver package from
+    #   a CDN and patch wheels so that they include it. We don't want this
+    #   we have our own driver build.
+    ./driver-location.patch
+  ];
+
+  postPatch = ''
+    # if setuptools_scm is not listing files via git almost all python files are excluded
+    export HOME=$(mktemp -d)
+    git init .
+    git add -A .
+    git config --global user.email "nixpkgs"
+    git config --global user.name "nixpkgs"
+    git commit -m "workaround setuptools-scm"
+
+    substituteInPlace setup.py \
+      --replace "greenlet==1.1.3" "greenlet>=1.1.3" \
+      --replace "pyee==8.1.0" "pyee>=8.1.0" \
+      --replace "setuptools-scm==7.0.5" "setuptools-scm>=7.0.5" \
+      --replace "wheel==0.37.1" "wheel>=0.37.1"
+
+    # Skip trying to download and extract the driver.
+    # This is done manually in postInstall instead.
+    substituteInPlace setup.py \
+      --replace "self._download_and_extract_local_driver(base_wheel_bundles)" ""
+
+    # Set the correct driver path with the help of a patch in patches
+    substituteInPlace playwright/_impl/_driver.py \
+      --replace "@driver@" "${driver}/bin/playwright"
+  '';
+
+
+  nativeBuildInputs = [ git setuptools-scm ];
+
+  propagatedBuildInputs = [
+    greenlet
+    pyee
+  ];
+
+  postInstall = ''
+    ln -s ${driver} $out/${python.sitePackages}/playwright/driver
+  '';
+
+  # Skip tests because they require network access.
+  doCheck = false;
+
+  pythonImportsCheck = [
+    "playwright"
+  ];
+
+  passthru = {
+    inherit driver;
+    browsers = {
+      x86_64-linux = browsers-linux { };
+      aarch64-linux = browsers-linux { };
+      x86_64-darwin = browsers-mac;
+      aarch64-darwin = browsers-mac;
+    }.${system} or throwSystem;
+    browsers-chromium = browsers-linux { withFirefox = false; };
+    browsers-firefox = browsers-linux { withChromium = false; };
+  };
+
+  meta = with lib; {
+    description = "Python version of the Playwright testing and automation library";
+    homepage = "https://github.com/microsoft/playwright-python";
+    license = licenses.asl20;
+    maintainers = with maintainers; [ techknowlogick yrd SuperSandro2000 ];
+  };
+}
diff --git a/pkgs/development/python-modules/playwright/driver-location.patch b/pkgs/development/python-modules/playwright/driver-location.patch
new file mode 100644
index 0000000000000..a7f79840c65db
--- /dev/null
+++ b/pkgs/development/python-modules/playwright/driver-location.patch
@@ -0,0 +1,47 @@
+diff --git a/playwright/_impl/_driver.py b/playwright/_impl/_driver.py
+index f3b911f..d00e509 100644
+--- a/playwright/_impl/_driver.py
++++ b/playwright/_impl/_driver.py
+@@ -23,11 +23,7 @@ from playwright._repo_version import version
+ 
+ 
+ def compute_driver_executable() -> Path:
+-    package_path = Path(inspect.getfile(playwright)).parent
+-    platform = sys.platform
+-    if platform == "win32":
+-        return package_path / "driver" / "playwright.cmd"
+-    return package_path / "driver" / "playwright.sh"
++   return Path("@driver@")
+ 
+ 
+ if sys.version_info.major == 3 and sys.version_info.minor == 7:
+diff --git a/setup.py b/setup.py
+index 3487a6a..05112c2 100644
+--- a/setup.py
++++ b/setup.py
+@@ -141,25 +141,8 @@ class PlaywrightBDistWheelCommand(BDistWheelCommand):
+         base_wheel_location: str = glob.glob(os.path.join(self.dist_dir, "*.whl"))[0]
+         without_platform = base_wheel_location[:-7]
+         for wheel_bundle in wheels:
+-            download_driver(wheel_bundle["zip_name"])
+-            zip_file = (
+-                f"driver/playwright-{driver_version}-{wheel_bundle['zip_name']}.zip"
+-            )
+-            with zipfile.ZipFile(zip_file, "r") as zip:
+-                extractall(zip, f"driver/{wheel_bundle['zip_name']}")
+             wheel_location = without_platform + wheel_bundle["wheel"]
+             shutil.copy(base_wheel_location, wheel_location)
+-            with zipfile.ZipFile(wheel_location, "a") as zip:
+-                driver_root = os.path.abspath(f"driver/{wheel_bundle['zip_name']}")
+-                for dir_path, _, files in os.walk(driver_root):
+-                    for file in files:
+-                        from_path = os.path.join(dir_path, file)
+-                        to_path = os.path.relpath(from_path, driver_root)
+-                        zip.write(from_path, f"playwright/driver/{to_path}")
+-                zip.writestr(
+-                    "playwright/driver/README.md",
+-                    f"{wheel_bundle['wheel']} driver package",
+-                )
+         os.remove(base_wheel_location)
+         if InWheel:
+             for whlfile in glob.glob(os.path.join(self.dist_dir, "*.whl")):
diff --git a/pkgs/development/python-modules/playwright/update.sh b/pkgs/development/python-modules/playwright/update.sh
new file mode 100755
index 0000000000000..51dd8723c8515
--- /dev/null
+++ b/pkgs/development/python-modules/playwright/update.sh
@@ -0,0 +1,31 @@
+#!/usr/bin/env nix-shell
+#!nix-shell -i bash -p curl gnused nix-prefetch common-updater-scripts
+set -euo pipefail
+
+root="$(dirname "$(readlink -f "$0")")"
+
+version=$(curl ${GITHUB_TOKEN:+" -u \":$GITHUB_TOKEN\""} -s https://api.github.com/repos/microsoft/playwright-python/releases/latest | jq -r '.tag_name | sub("^v"; "")')
+
+# Most of the time, this should be the latest stable release of the Node-based
+# Playwright version, but that isn't a guarantee, so this needs to be specified
+# as well:
+setup_py_url="https://github.com/microsoft/playwright-python/raw/v${version}/setup.py"
+driver_version=$(curl -Ls "$setup_py_url" | grep '^driver_version =' | grep -Eo '[0-9]+\.[0-9]+\.[0-9]+')
+
+fetch_driver_arch() {
+  nix-prefetch-url "https://playwright.azureedge.net/builds/driver/playwright-${version}-${1}.zip"
+}
+
+replace_sha() {
+  sed -i "s|$1 = \".\{44,52\}\"|$1 = \"$2\"|" "$root/default.nix"
+}
+
+# Replace SHAs for the driver downloads
+replace_sha "x86_64-linux" "$(fetch_driver_arch "linux")"
+replace_sha "x86_64-darwin" "$(fetch_driver_arch "mac")"
+replace_sha "aarch64-linux" "$(fetch_driver_arch "linux-arm64")"
+replace_sha "aarch64-darwin" "$(fetch_driver_arch "mac-arm64")"
+
+# Update the version stamps
+sed -i "s/driverVersion = \"[^\$]*\"/driverVersion = \"$driver_version\"/" "$root/default.nix"
+update-source-version playwright "$version" --rev="v$version"
diff --git a/pkgs/development/python-modules/selenium/default.nix b/pkgs/development/python-modules/selenium/default.nix
index 4c7eedf281d3b..2656f460ff6a6 100644
--- a/pkgs/development/python-modules/selenium/default.nix
+++ b/pkgs/development/python-modules/selenium/default.nix
@@ -12,14 +12,15 @@
 
 buildPythonPackage rec {
   pname = "selenium";
-  version = "4.4.2";
+  version = "4.5.0";
   disabled = pythonOlder "3.7";
 
   src = fetchFromGitHub {
     owner = "SeleniumHQ";
     repo = "selenium";
-    rev = "refs/tags/selenium-${version}-python"; # check if there is a newer tag with -python suffix
-    hash = "sha256-sJJ3i4mnGp5fDgo64p6B2vRCqp/Wm99VoyRLyy4nBH8=";
+    # check if there is a newer tag with or without -python suffix
+    rev = "refs/tags/selenium-${version}";
+    hash = "sha256-K90CQYTeX9GKpP0ahxLx2HO5HG0P6MN7jeWmHtfiOns=";
   };
 
   postPatch = ''
@@ -50,6 +51,6 @@ buildPythonPackage rec {
     description = "Bindings for Selenium WebDriver";
     homepage = "https://selenium.dev/";
     license = licenses.asl20;
-    maintainers = with maintainers; [ jraygauthier ];
+    maintainers = with maintainers; [ jraygauthier SuperSandro2000 ];
   };
 }
diff --git a/pkgs/development/python-modules/sentry-sdk/default.nix b/pkgs/development/python-modules/sentry-sdk/default.nix
index cd052afdacb36..c52cdeef956d5 100644
--- a/pkgs/development/python-modules/sentry-sdk/default.nix
+++ b/pkgs/development/python-modules/sentry-sdk/default.nix
@@ -19,7 +19,7 @@
 , django
 , falcon
 , flask
-, flask_login
+, flask-login
 , httpx
 , pure-eval
 , pyramid
diff --git a/pkgs/development/python-modules/sqlalchemy-continuum/default.nix b/pkgs/development/python-modules/sqlalchemy-continuum/default.nix
index a97f3e4ddbd3e..0d2ef66cfa88a 100644
--- a/pkgs/development/python-modules/sqlalchemy-continuum/default.nix
+++ b/pkgs/development/python-modules/sqlalchemy-continuum/default.nix
@@ -2,7 +2,7 @@
 , fetchPypi
 , buildPythonPackage
 , flask
-, flask_login
+, flask-login
 , flask-sqlalchemy
 , flexmock
 , pytestCheckHook
@@ -32,7 +32,7 @@ buildPythonPackage rec {
     pytestCheckHook
     sqlalchemy-i18n
     flask
-    flask_login
+    flask-login
     flask-sqlalchemy
     flexmock
   ];