nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at python-updates 126 lines 2.8 kB view raw
1{ 2 lib, 3 python3Packages, 4 fetchFromGitHub, 5 6 # optional-dependencies 7 ruff, 8 9 # tests 10 addBinToPathHook, 11 versionCheckHook, 12 13 nix-update-script, 14}: 15 16let 17 nbqa = python3Packages.buildPythonApplication rec { 18 pname = "nbqa"; 19 version = "1.9.1"; 20 pyproject = true; 21 22 src = fetchFromGitHub { 23 owner = "nbQA-dev"; 24 repo = "nbQA"; 25 tag = version; 26 hash = "sha256-qVNJ8f8vUlTCi5DbvG70orcSnulH60UcI5iABtXYUog="; 27 }; 28 29 build-system = with python3Packages; [ 30 setuptools 31 ]; 32 33 optional-dependencies.toolchain = 34 (with python3Packages; [ 35 black 36 blacken-docs 37 flake8 38 isort 39 jupytext 40 mypy 41 pylint 42 pyupgrade 43 ]) 44 ++ [ 45 ruff 46 ]; 47 48 dependencies = with python3Packages; [ 49 autopep8 50 ipython 51 tokenize-rt 52 tomli 53 ]; 54 55 # Force using the Ruff executable rather than the Python package 56 postPatch = '' 57 substituteInPlace nbqa/__main__.py \ 58 --replace-fail \ 59 'if shell:' \ 60 'if shell or main_command == "ruff":' 61 ''; 62 63 nativeCheckInputs = 64 (with python3Packages; [ 65 autoflake 66 distutils 67 mdformat 68 pre-commit-hooks 69 pydocstyle 70 pytestCheckHook 71 yapf 72 ]) 73 ++ lib.concatAttrValues optional-dependencies 74 ++ [ 75 addBinToPathHook 76 versionCheckHook 77 ]; 78 79 disabledTests = [ 80 # Test data not found 81 "test_black_multiple_files" 82 "test_black_return_code" 83 "test_grep" 84 "test_jupytext_on_folder" 85 "test_mypy_works" 86 "test_running_in_different_dir_works" 87 "test_unable_to_reconstruct_message_pythonpath" 88 "test_with_subcommand" 89 "test_pylint_works" 90 91 # ruff output has changed and invalidates the snapshot tests (AssertionError) 92 "test_ruff_works" 93 ]; 94 95 disabledTestPaths = [ 96 # Test data not found 97 "tests/test_include_exclude.py" 98 ]; 99 100 passthru = { 101 # selector is a function mapping pythonPackages to a list of code quality 102 # tools, e.g. nbqa.withTools (ps: [ ps.black ]) 103 withTools = 104 selector: 105 nbqa.overridePythonAttrs ( 106 { dependencies, ... }: 107 { 108 dependencies = dependencies ++ selector python3Packages; 109 doCheck = false; 110 } 111 ); 112 113 updateScript = nix-update-script { }; 114 }; 115 116 meta = { 117 homepage = "https://github.com/nbQA-dev/nbQA"; 118 changelog = "https://nbqa.readthedocs.io/en/latest/history.html"; 119 description = "Run ruff, isort, pyupgrade, mypy, pylint, flake8, black, blacken-docs, and more on Jupyter Notebooks"; 120 license = lib.licenses.mit; 121 maintainers = with lib.maintainers; [ l0b0 ]; 122 mainProgram = "nbqa"; 123 }; 124 }; 125in 126nbqa