Skip to content

Python: overridePythonAttrs should support final: prev: style overrides #258246

@ruro

Description

@ruro

After #119942, mkDerivation supports recursive definition of package attributes with

foo = mkDerivation (final: { });
foo_v2 = foo.overrideAttrs (final: prev: { });

# instead of
foo = mkDerivation rec { };
foo_v2 = foo.overrideAttrs (prev: { });

The buildPythonPackage.overridePythonAttrs functionality originally introduced in #26155 should also support this style of overrides (to avoid the rec antipattern and make the overrides more composable).

pyfoo = buildPythonPackage (final: { });
pyfoo_v2 = pyfoo.overridePythonAttrs (final: prev: { });

# instead of
pyfoo = buildPythonPackage rec { };
pyfoo_v2 = pyfoo.overridePythonAttrs (prev: { });

Also, this probably belongs in #1819.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions