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

python3Packages: deprecate 'format = "other/pyproject"' #355654

Open
wants to merge 4 commits into
base: staging
Choose a base branch
from

Conversation

natsukium
Copy link
Member

generated by following command
rg 'format = "other"' -l | xargs -n 1 sed -i 's/format = "other"/pyproject = false/g'

The following commits enabled assertions for format = "other/pyproject"
5d6d563
460c25c

Things done

  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandboxing enabled in nix.conf? (See Nix manual)
    • sandbox = relaxed
    • sandbox = true
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 24.11 Release Notes (or backporting 23.11 and 24.05 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
  • Fits CONTRIBUTING.md.

Add a 👍 reaction to pull requests you find important.

@github-actions github-actions bot added 6.topic: python 6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS 6.topic: GNOME GNOME desktop environment and its underlying platform 8.has: module (update) This PR changes an existing module in `nixos/` 6.topic: vim 6.topic: TeX Issues regarding texlive and TeX in general 6.topic: mate The MATE Desktop Environment 6.topic: jupyter Interactive computing tooling: kernels, notebook, jupyterlab 6.topic: games 6.topic: rocm labels Nov 13, 2024
@@ -154,6 +154,7 @@ in
, ... } @ attrs:

assert (pyproject != null) -> (format == null);
assert lib.assertMsg (format != "other") "${namePrefix}${attrs.pname}: `format = \"other\"` is deprecated. Use `pyproject = false` instead.";
Copy link
Member

Choose a reason for hiding this comment

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

Might be better to keep lib.warn for a release, and change to assert/throw in the next.

Copy link
Member Author

@natsukium natsukium Nov 13, 2024

Choose a reason for hiding this comment

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

Since these changes are just replacements, and the release included is 25.05 in 6 months, I think we could throw an error.
We easily miss warnings, and I'm exhausted of pointing them out in reviews.

But if someone else also suggests lib.warn, I'll make the change.

Copy link
Member

Choose a reason for hiding this comment

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

Since these changes are just replacements, and the release included is 25.05 in 6 months, I think we could throw an error.

That will still be a show stopper for people using unstable channel. Such changes are not completely unacceptable, but we generally don't do this.

We easily miss warnings, and I'm exhausted of pointing them out in reviews.

Ofborg will turn it into an error so such new patterns won't be accepted into Nixpkgs.

Copy link
Member Author

Choose a reason for hiding this comment

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

Ok, let's change it to warn. I found the evaluation errors around home-assistant, so I'll commit it along with this fix.
Thanks for your review.

@natsukium natsukium marked this pull request as draft November 13, 2024 12:54
@GaetanLepage
Copy link
Contributor

I guess when converting format = "pyproject"; to pyproject = true, you often need to add setuptools to build-system no ?

@natsukium
Copy link
Member Author

I guess when converting format = "pyproject"; to pyproject = true, you often need to add setuptools to build-system no ?

In many cases, simply change nativeBuildInputs to build-system. However, we cannot change them automatically. This is because nativeBuildInputs may contain other non-python modules, for example, rustc, pkg-config, and makeWrapper. And there are over 2,000 python modules that have nativeBuildInputs.

Also, to change format = setuptools, setuptools should be added to build-system, but it causes the build system to change. It means, dependency checks or something will become blockers, and we will also need a number of manual fixes.

@natsukium natsukium force-pushed the deprecate-format-step-1 branch 2 times, most recently from d9c55c4 to 61d861f Compare November 13, 2024 14:22
@Aleksanaa
Copy link
Member

You need tree-sitter and a Nix evaluator. Not impossible but will be more complex than a simple grep.

@natsukium
Copy link
Member Author

You need tree-sitter and a Nix evaluator. Not impossible but will be more complex than a simple grep.

Good point. Yes, I have a fork of nixpkgs-lint.
nix-community/nixpkgs-lint@master...natsukium:nixpkgs-lint:python

@natsukium natsukium marked this pull request as ready for review November 13, 2024 14:41
@SuperSandro2000
Copy link
Member

I was first confused by the commit titles and thought we abort evaluation instead of just logging a warning.

generated by following command
rg 'format = "other"' -l | xargs -n 1 sed -i 's/format = "other"/pyproject = false/g'

Note: python27Packages should not adopt this change, because the builder for python2
cannot recognize the "pyproject" attribute
generated by following command
rg 'format = "pyproject"' -l | xargs -n 1 sed -i 's/format = "pyproject"/pyproject = true/g'

Note: python27Packages.backports-functools-lru-cache should not adopt
this change, because the builder for python2 cannot recognize the
"pyproject" attribute
@natsukium natsukium force-pushed the deprecate-format-step-1 branch from 61d861f to a85486a Compare November 13, 2024 15:37
@natsukium
Copy link
Member Author

I was first confused by the commit titles and thought we abort evaluation instead of just logging a warning.

Thanks, updated the commit messages.

@ofborg ofborg bot added the 2.status: merge conflict This PR has merge conflicts with the target branch label Nov 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2.status: merge conflict This PR has merge conflicts with the target branch 6.topic: games 6.topic: GNOME GNOME desktop environment and its underlying platform 6.topic: jupyter Interactive computing tooling: kernels, notebook, jupyterlab 6.topic: mate The MATE Desktop Environment 6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS 6.topic: python 6.topic: rocm 6.topic: TeX Issues regarding texlive and TeX in general 6.topic: vim 8.has: module (update) This PR changes an existing module in `nixos/`
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants