Skip to content

pylint: unable to import requests. #646

@cronyakatsuki

Description

@cronyakatsuki

Using pylint as a pre-commit hook it can't import requests which leads to not being able to commit changes, this is what my shell.nix looks like:

{
  pkgs ? import <nixpkgs> {},
  pre-commit-hooks,
}: let
  pre-commit-check = pre-commit-hooks.lib.${pkgs.system}.run {
    src = ./.;
    hooks = {
      ruff.enable = true;
      pylint.enable = true;
    };
  };
  myPython = pkgs.python3.withPackages (pyPkgs: with pyPkgs; [requests pylint]);
in
  pkgs.mkShell {
    name = "hb-downloader";
    buildInputs = [myPython];
    nativeBuildInputs = [pkgs.aria2 pkgs.ruff pkgs.basedpyright];
    shellHook = ''
      PYTHONPATH=${myPython}/${myPython.sitePackages}
      ${pre-commit-check.shellHook}
    '';
  }

I can run the python code directly with no issues,and when edition the python code with neovim ruff and basedpyright don't say anything about not being able to import requests.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions