How can I make a derivation for a Python package that includes the standard library?

I’m trying to build this package from PyPi, using this:

    CommonsDownloader = pkgs.python3Packages.buildPythonPackage rec {
      pname = "CommonsDownloader";
      version = "0.5.3";
      src = pkgs.python3Packages.fetchPypi{
        inherit version;
        inherit pname;
        sha256 = "1sf6jixclq0x1d600w4qd7v5n9qpgdrqivk2p1i0z4nzpbadrqar";
      };
      buildInputs = [ pkgs.python3Packages.mwclient ];
    };

but it fails with ERROR: Could not find a version that satisfies the requirement argparse (from CommonsDownloader==0.5.3) (from versions: none). But argparse is in the python standard library, and it isn’t a standalone package that I can put in the buildInputs. So how can I get this to build?

Patch the package source so it no longer depends on argparse. It’s an error in the package.

Cool, how do I do that?

Check the setup.py where they get the install_requires from and patch that value. Normal patch or sed or substituteInPlace. Its quite commonly done in Nixpkgs.