Commit 479a1a6c authored by Robert Schütz's avatar Robert Schütz
Browse files

nbqa: add passthru.withTools

You can now do fancy things like

    (nbqa.override { python3 = python311; }).withTools (ps: [ ps.black ])
parent 23e6b80a
Loading
Loading
Loading
Loading
+94 −76
Original line number Diff line number Diff line
@@ -9,7 +9,9 @@
  # tests
  versionCheckHook,
}:
python3.pkgs.buildPythonApplication rec {

let
  nbqa = python3.pkgs.buildPythonApplication rec {
    pname = "nbqa";
    version = "1.9.0";
    pyproject = true;
@@ -88,6 +90,20 @@ python3.pkgs.buildPythonApplication rec {
      "tests/test_include_exclude.py"
    ];

    passthru = {
      # selector is a function mapping pythonPackages to a list of code quality
      # tools, e.g. nbqa.withTools (ps: [ ps.black ])
      withTools =
        selector:
        nbqa.overridePythonAttrs (
          { dependencies, ... }:
          {
            dependencies = dependencies ++ selector python3.pkgs;
            doCheck = false;
          }
        );
    };

    meta = {
      homepage = "https://github.com/nbQA-dev/nbQA";
      changelog = "https://nbqa.readthedocs.io/en/latest/history.html";
@@ -96,4 +112,6 @@ python3.pkgs.buildPythonApplication rec {
      maintainers = with lib.maintainers; [ l0b0 ];
      mainProgram = "nbqa";
    };
}
  };
in
nbqa