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

pythonPackages.toPythonModule: also support overridePythonAttrs. #95687

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
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
6 changes: 4 additions & 2 deletions pkgs/top-level/python-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ let
}
else ff;

buildPythonPackage = makeOverridablePythonPackage ( makeOverridable (callPackage ../development/interpreters/python/mk-python-derivation.nix {
buildPythonPackage = makeOverridablePythonPackage (makeOverridable (callPackage ../development/interpreters/python/mk-python-derivation.nix {
inherit namePrefix; # We want Python libraries to be named like e.g. "python3.6-${name}"
inherit toPythonModule; # Libraries provide modules
}));
Expand Down Expand Up @@ -81,7 +81,9 @@ let
pythonPath = [ ]; # Deprecated, for compatibility.
requiredPythonModules = requiredPythonModules drv.propagatedBuildInputs;
};
});
}) // {
overridePythonAttrs = drv.overrideAttrs;
};
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Problems:

  • This is not composable: You can't overridePythonAttrs twice
  • overrideAttrs doesn't support non-functions, so .overridePythonAttrs {} fails, leading to inconsistent behavior with the overridePythonAttrs that makeOverridablePythonPackage defines.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see. Any suggestion how this can be resolved by adding the override option after the original function (stdenv.mkDerivation) has already been called? This here also seems a case where NixOS/rfcs#3 would be helpful.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Usually this is done by calling the original function again, but I think this get really messy with multiple ways to override things. Maybe look at the implementation of makeOverridable


# Convert a Python library to an application.
toPythonApplication = drv:
Expand Down