16 src = fetchFromGitHub {
18 repo = "basedpyright";
19 rev = "refs/tags/v${version}";
20 hash = "sha256-SMF7BXPhoMyUqGY8WK5pIVAy+p/mS+Li+Lz0uLyhFjY=";
23 patchedPackageJSON = runCommand "package.json" { } ''
25 .devDependencies |= with_entries(select(.key == "glob" or .key == "jsonc-parser"))
27 ' ${src}/package.json > $out
30 pyright-root = buildNpmPackage {
31 pname = "pyright-root";
33 npmDepsHash = "sha256-63kUhKrxtJhwGCRBnxBfOFXs2ARCNn+OOGu6+fSJey4=";
36 cp ${patchedPackageJSON} ./package.json
37 cp ${./package-lock.json} ./package-lock.json
46 pyright-internal = buildNpmPackage {
47 pname = "pyright-internal";
49 sourceRoot = "${src.name}/packages/pyright-internal";
50 npmDepsHash = "sha256-GO6ozBtf9P6tKhqtgNJjNdziJ9rYImH0fdYi7KZ1NgI=";
52 # FIXME: Remove this flag when TypeScript 5.5 is released
53 npmFlags = [ "--legacy-peer-deps" ];
61 docify = python3.pkgs.buildPythonApplication {
65 src = fetchFromGitHub {
66 owner = "AThePeanut4";
68 rev = "7380a6faa6d1e8a3dc790a00254e6d77f84cbd91";
69 hash = "sha256-BPR1rc/JzdBweiWmdHxgardDDrJZVWkUIF3ZEmEYf/A=";
71 buildInputs = [ python3.pkgs.setuptools ];
72 propagatedBuildInputs = [
78 docstubs = stdenvNoCC.mkDerivation {
81 buildInputs = [ docify ];
85 cp -r packages/pyright-internal/typeshed-fallback docstubs
86 ${docify}/bin/docify docstubs/stdlib --builtins-only --in-place
87 cp -rv docstubs "$out"
93 pname = "basedpyright";
96 sourceRoot = "${src.name}/packages/pyright";
97 npmDepsHash = "sha256-areRNvJXmnK/yNCwQ//SNVI6eDOqweYxTULvrANLwPo=";
101 ln -s ${docstubs} ../../docstubs
102 ln -s ${pyright-root}/node_modules ../../node_modules
103 chmod +w ../pyright-internal
104 ln -s ${pyright-internal}/node_modules ../pyright-internal/node_modules
108 mv "$out/bin/pyright" "$out/bin/basedpyright"
109 mv "$out/bin/pyright-langserver" "$out/bin/basedpyright-langserver"
115 updateScript = ./update.sh;
116 tests.version = testers.testVersion { package = basedpyright; };
120 changelog = "https://github.com/detachhead/basedpyright/releases/tag/${version}";
121 description = "Type checker for the Python language";
122 homepage = "https://github.com/detachhead/basedpyright";
123 license = lib.licenses.mit;
124 mainProgram = "basedpyright";
125 maintainers = with lib.maintainers; [ kiike ];