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

buildPythonPackage: add api version for automation tools #103401

Closed
wants to merge 1 commit into from

Conversation

DavHau
Copy link
Member

@DavHau DavHau commented Nov 11, 2020

Motivation for this change

Facing the upcoming backwards incompatible buildPythonPackage API changes in #102613 , I'd like to introduce an API version number for it, so automation tools like mach-nix can stay compatible to multiple versions of nixpkgs, without introducing weird hacks.

Things done

Add attribute python.pkgs._meta.apiVersion.buildPythonPackage which is meant to be increased on all backwards incompatible changes on buildPythonPackage.

  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS linux)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Ensured that relevant documentation is up to date
  • Fits CONTRIBUTING.md.

Copy link
Contributor

@jonringer jonringer left a comment

Choose a reason for hiding this comment

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

I'm not "thrilled" at this, but I think it's practical; and I completely understand.

I'll defer to @FRidh

@FRidh
Copy link
Member

FRidh commented Nov 11, 2020

buildPython* nowadays consists of many hooks. We've made some changes to those regularly, which impacts the builds, but not so much the interface (removing a hook simply means an option is not being used). The question is where to draw the line to increase the version number.

With the upcoming breaking change it is obvious, the main parameters of the function change. But with e.g. #102949 makeWrapperArgs will probably be renamed. Should we then also increase the version?

A question I guess to ask is "what parts need to be acted upon if they change?".

@DavHau
Copy link
Member Author

DavHau commented Nov 11, 2020

I think it should always be assumed that a user uses all possible arguments.
If a change in the API requires users to update their code to prevent breakage, then the version should be increased.

A renaming of an argument falls in that category.

Adding an argument ... only if its a mandatory one.
Removing an argument is also fine, as long as it stays backwards compatible.

I think, in case of uncertainty, it's better to increase it than not to increase it.

An alternative might be to not use a version number, but make the function arguments discoverable, or automatically compute some kind of signature on the function argument names.

@FRidh
Copy link
Member

FRidh commented Nov 11, 2020

The build functions depend on the Python-specific hooks as well as the stdenv, which are many pieces of code, some that are hardly used. Doing it that thoroughly is not realistic, or at least, I would say then, it is not public/stable.

Looking back, there are changes every year or so, one bigger than the other. In the last two years or so that has been regarding the introduction of build backends, the rewrite to hooks where options were renamed, and how e.g. python.withPackages behaves.

For 21.03 there is this change, but we will also likely need to change format to default to pyproject which will also be breaking. Then there is the part that I intend to get in changing how we do our wrapping.

To be honest, I think it is much more realistic to rely on NixOS version. In unstable, you just don't know how it looks. We are not a rolling distro after all.

@DavHau
Copy link
Member Author

DavHau commented Nov 11, 2020

How would I inspect the nixpkgs version of a given pkgs?

@DavHau
Copy link
Member Author

DavHau commented Nov 24, 2020

> lib.trivial.release will do it then.

@DavHau DavHau closed this Nov 24, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants