poetry2nix
poetry2nix copied to clipboard
exceptiongroup 1.0.0rc8 missing flit_scm module
Describe the issue
Building the below (from this project) using latest nixpkgs results in the following error:
ModuleNotFoundError: No module named 'flit_scm'
Additional context
I just ran into this myself. It looks like that flit
isn't being included here by default.
I am like an intermediate nix user, but ended up getting around it by passing extraPackages
to poetry2nix.mkPoetryEnv
like so:
outputs = { self, nixpkgs, flake-utils, poetry2nix }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs {
inherit system;
config = { allowBroken = true; };
overlays = [ poetry2nix.overlay ];
};
in {
devShell = pkgs.mkShell {
nativeBuildInputs = [ pkgs.bashInteractive ];
buildInputs = with pkgs; [
# [SNIP]
(pkgs.poetry2nix.mkPoetryEnv {
projectDir = ./.;
preferWheels = true;
extraPackages = (ps: [ pythonPackages.flit ]); # <------
})
];
};
})
I've tried two similar things but it still fails:
extraPackages = (ps: [ pkgs.python310Packages.flit ]);
and
exceptiongroup = super.exceptiongroup.overridePythonAttrs (
old: {
nativeBuildInputs = old.nativeBuildInputs or [ ] ++ [ self.flit ];
}
);
It looks like what's missing is deciphering what flitBuildHook
evaluates to, and including that. I thought this required running tools/find-build-systems
:
- Clone repo
-
cd
into repo -
nix-shell
-
cd tools
-
nix-build
-
result/bin/python ./find-build-systems.py build-systems.json
However, the resulting file just seems to be a copy of the build-systems.json
in the repo, so I'm out of ideas.
I solved this issue with the following overrides:
final.poetry2nix.overrides.withDefaults (self: super: {
flit-scm = self.callPackage ./flit-scm.nix { };
exceptiongroup = super.exceptiongroup.overridePythonAttrs (old: {
nativeBuildInputs = old.nativeBuildInputs ++ [
self.flit-scm
];
});
})
where flit-scm.nix
is
{ buildPythonPackage
, fetchPypi
, flit-core
, flitBuildHook
, setuptools-scm
}:
buildPythonPackage {
pname = "flit-scm";
version = "1.7.0";
format = "flit";
src = fetchPypi {
pname = "flit_scm";
version = "1.7.0";
sha256 = "961bd6fb24f31bba75333c234145fff88e6de0a90fc0f7e5e7c79deca69f6bb2";
};
nativeBuildInputs = [
flit-core
flitBuildHook
setuptools-scm
];
pythonImportsCheck = [ "flit_scm" ];
}
I guess flit-scm should be published to nixpkgs and then added as known build engines. Isn't it?
Ran into similar problem trying to bump cattrs 22.2.0.
@yajo flit-scm is not in 22.05 yet, but a PR to introduce it to the master branch was added just 11 hours ago. Not sure when/if it will be promoted to stable.
Seems to be merged now.
Seems to be merged now.
I also backported it to 22.05.
Thanks all, this is fixed in master!