Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Treat default dependencies as main group #1785

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 14 additions & 16 deletions default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ let
, pyProject
, attrs
, includeBuildSystem ? true
, groups ? [ ]
, groups ? [ "main" ]
, checkGroups ? checkGroupsDefault
, extras ? [ "*" ] # * means all extras, otherwise include the dependencies for a given extra
}:
Expand Down Expand Up @@ -82,12 +82,10 @@ let
{
buildInputs = mkInput "buildInputs" (if includeBuildSystem then buildSystemPkgs else [ ]);
propagatedBuildInputs = mkInput "propagatedBuildInputs" (
getDeps allRawDeps ++ (
# >=poetry-1.2.0 dependency groups
if pyProject.tool.poetry.group or { } != { }
then lib.flatten (map (g: getDeps pyProject.tool.poetry.group.${g}.dependencies) groups)
else [ ]
)
let
availableGroups = { main.dependencies = allRawDeps; } // pyProject.tool.poetry.group or { };
in
lib.flatten (map (g: getDeps availableGroups.${g}.dependencies or { }) groups)
);
nativeBuildInputs = mkInput "nativeBuildInputs" [ ];
checkInputs = mkInput "checkInputs" checkInputs';
Expand Down Expand Up @@ -145,7 +143,7 @@ lib.makeScope pkgs.newScope (self: {
# Example: { my-app = ./src; }
, editablePackageSources ? { }
, pyProject ? readTOML pyproject
, groups ? [ ]
, groups ? [ "main" ]
, checkGroups ? checkGroupsDefault
, extras ? [ "*" ]
}:
Expand Down Expand Up @@ -314,7 +312,7 @@ lib.makeScope pkgs.newScope (self: {
, preferWheels ? false
, editablePackageSources ? { }
, extraPackages ? _ps: [ ]
, groups ? [ "dev" ]
, groups ? [ "main" "dev" ]
, checkGroups ? checkGroupsDefault
, extras ? [ "*" ]
}:
Expand All @@ -332,13 +330,13 @@ lib.makeScope pkgs.newScope (self: {
(pkg: editablePackageSources."${pkg}" == null)
(builtins.attrNames editablePackageSources);

allEditablePackageSources = (getEditableDeps (pyProject.tool.poetry."dependencies" or { }))
// (getEditableDeps (pyProject.tool.poetry."dev-dependencies" or { }))
allEditablePackageSources = (getEditableDeps (pyProject.tool.poetry."dev-dependencies" or { }))
// (
# Poetry>=1.2.0
if pyProject.tool.poetry.group or { } != { } then
builtins.foldl' (acc: g: acc // getEditableDeps pyProject.tool.poetry.group.${g}.dependencies) { } groups
else { }
let
deps = pyProject.tool.poetry."dependencies" or { };
availableGroups = { main.dependencies = deps; } // pyProject.tool.poetry.group or { };
in
builtins.foldl' (acc: g: acc // getEditableDeps availableGroups.${g}.dependencies or { }) { } groups
)
// editablePackageSources;

Expand Down Expand Up @@ -380,7 +378,7 @@ lib.makeScope pkgs.newScope (self: {
, python ? pkgs.python3
, pwd ? projectDir
, preferWheels ? false
, groups ? [ ]
, groups ? [ "main" ]
, checkGroups ? checkGroupsDefault
, extras ? [ "*" ]
, ...
Expand Down