mach-nix icon indicating copy to clipboard operation
mach-nix copied to clipboard

Packages that require tomli are broken in recent versions of pypi-deps-db

Open IllustratedMan-code opened this issue 3 years ago • 0 comments

This is the same issue as #389. This seems to be a problem for several packages. I ran into this issue with the black package. I had to use dependency injection like in #389 to solve the issue. Here is the flake I used.

{
  inputs = {
    mach-nix.url = "github:DavHau/mach-nix";
    pypi.url = "github:DavHau/pypi-deps-db";
    pypi.flake = false;
    mach-nix.inputs.pypi-deps-db.follows = "pypi";
  };
  outputs = {self, nixpkgs, ...}@inputs:
    let
      target-system = "x86_64-linux";
      pkgs = import nixpkgs {system = target-system;};

      # this will find all dependencies in setup.py
      mkPackage = system: inputs.mach-nix.lib."${system}".buildPythonPackage {src=./.;
                                                                              python = "python38";
                                                                             };
      mkPython = system: inputs.mach-nix.lib."${system}".mkPython {
        python = "python38";
        # extra packages needed for development
        requirements = ''python-lsp-server
                         rich-click
                         black'';

        # had to use this line to fix it
        _.black.propagatedBuildInputs.mod = pySelf: self: oldVal: oldVal ++ [ pySelf.tomli ];
        packagesExtra = [ (mkPackage system)];
      };
    in
  {
    packages.${target-system}.default = mkPackage target-system;
    devShells.${target-system}.default = pkgs.mkShell{
      buildInputs=[(mkPython target-system)];
    };

  };
}

Why is the _.black.propagatedBuildInputs.mod line necessary? What needs to be done to fix it?

IllustratedMan-code avatar Jul 06 '22 14:07 IllustratedMan-code