Closed abathur closed 4 months ago
What do you mean by app's python dependencies - in the pyproject.toml
or in the nix derivation somewhere?
What do you mean by app's python dependencies - in the
pyproject.toml
or in the nix derivation somewhere?
Never mind - I figured it out (at least for me). Place it in the mkDerivation in the module (in the examples in this repo it would be the default.nix
file)
Curious, I've never had that happen before. I'll see if I can debug it later.
@JonBoyleCoding Were you just asking me to clarify, or does your response indicate that you've run into the same error?
I really was hoping someone would know what this was and just tell me I was holding it wrong, so we might be able to help run this to ground by finding a minimal repro.
I took a few quick swings at doing so this morning but haven't yet been able to isolate one, and I've got other fires to fight so I may not be able to revisit for a bit.
@JonBoyleCoding Were you just asking me to clarify, or does your response indicate that you've run into the same error?
I really was hoping someone would know what this was and just tell me I was holding it wrong, so we might be able to help run this to ground by finding a minimal repro.
I took a few quick swings at doing so this morning but haven't yet been able to isolate one, and I've got other fires to fight so I may not be able to revisit for a bit.
I encountered the same error and was asking if you could provide specifics on how you got around it. Thankfully I did manage to get around it for now!
Gotcha. I did something a little more targeted, but what you're saying sounds fine for a workaround.
I don't really love some specifics of the Nix half of this and will probably refactor later, but for reference I just added a new optional/dev dependency group to pyproject.toml containing only "editables". This part looks like:
[tool.pdm.dev-dependencies]
# workaround
editables = [
"editables"
]
Back in flake.nix
I appended dependencies from that group to the buildInputs for only the devShell so that editables
didn't also leak into the container image. In barebones form, that looked something like:
let
get_dev_packages = groups: with groups;
editables.packages //
other_group_i_need.packages;
in {
devShells.default = (pkgs.mkShell rec {
inputsFrom = [
packages.blah.devShell
];
buildInputs = with pkgs; [
# ...
] ++ map (x: (pkgs.lib.head (pkgs.lib.attrValues x)).public) (
pkgs.lib.attrValues (get_dev_packages packages.blah.config.groups)
);
});
}
Is your project public, or is it generally fairly small/simple? This may be an easy fix for @purepani if we have a minimal reproduction at hand. My project's private and somewhat large so it'll take me some time to extract something minimal from it.
I ended up getting the error today while working so I can figure it out based on that.
It will be public in a few days, but not yet. However if you've already got the error then presumably you can go forward with that.
@purepani Awesome, if you take a look! I could do as well, if you want and push a reproducer :)
I'll take a look after work today!
Looks like this may have been a bug in pdm-backend: https://github.com/pdm-project/pdm-backend/issues/242. It was fixed in the most recent update from a few weeks ago, so I made a PR in nixpkgs to update the backend: https://github.com/NixOS/nixpkgs/pull/323292 (though I haven't tested it with @phaer should we wait for this to be merged and hit nixpkgs or fix it here while we wait?
Even better looks like it was already commited into staging 5 days ago: https://github.com/NixOS/nixpkgs/pull/320924
So we just have to wait until https://nixpk.gs/pr-tracker.html?pr=320924 hits nixpkgs-unstable and update the inputs then :)
Yep exactly I did test it by adding an overlay to update it, and it did work correctly so just until it gets merged(I wouldnt recommend this since it took a long time to build since it rebuilds a bunch of stuff)
This is now fixed as far as I can tell!
I couldn't find other reports of this, so maybe I'm just holding it wrong, but after switching to the pdm module I started getting this traceback when I enter a devShell:
I'm able to work around it by adding editables it to the app's python dependencies.