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

Python dependencies are no longer checked #253131

Closed
bbjubjub2494 opened this issue Sep 3, 2023 · 5 comments
Closed

Python dependencies are no longer checked #253131

bbjubjub2494 opened this issue Sep 3, 2023 · 5 comments

Comments

@bbjubjub2494
Copy link
Member

Describe the bug

The python tooling does not enforce the presence of dependencies at build time when doCheck is set to false.

Steps To Reproduce

Steps to reproduce the behavior:

  1. nix build github/lourkeur/nixpkgs-python-dependency-bypass

Expected behavior

The build should fail with ERROR; Could not find a version that satisfies the requirement [...]

Screenshots

If applicable, add screenshots to help explain your problem.

Additional context

Introduced in #248866

Notify maintainers

@tjni and @FRidh for the bisected commits (6c85fff,0d7647889c6701d8a0e6fa784e886012011ca2d8)

Metadata

Please run nix-shell -p nix-info --run "nix-info -m" and paste the result.

[user@system:~]$ nix-shell -p nix-info --run "nix-info -m"
 - system: `"x86_64-linux"`
 - host os: `Linux 6.1.47, NixOS, 23.05 (Stoat), 23.05pre-git`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.13.5`
 - nixpkgs: `/etc/nix/channels/nixos`

@yajo
Copy link
Contributor

yajo commented Sep 4, 2023

Could this be a good thing? Since long ago it's been a problem that you need runtime dependencies when building a python package in nixpkgs. You should only need buildtime dependencies, and runtime ones for installing it (not building it). See the whole story in #170577 and #26400.

@bbjubjub2494
Copy link
Member Author

I encountered this in a context where it is bad because I have a package with doCheck = false (chia) and as a result I am able to successfully build with clearly outdated dependencies. I also don't think it is intended behavior but this could be discussed.

@erikarvstedt
Copy link
Member

erikarvstedt commented Dec 2, 2023

Dependencies are no longer checked at all, regardless of the value of doCheck. See #253872 for a repro.
(@lourkeur, can you update your description?)

More concretely, it is neither checked whether a requirement exists at all nor whether the required version matches.

I've confirmed this for format = "setuptools" (the default) and format = "pyproject".

This is a major regression.
@FRidh, was this a deliberate design choice?

Workaround

Add the following to your buildPythonPackage drv:

# Enable Python requirements check
dontUsePypaInstall = true;
nativeBuildInputs = [ pipInstallHook ];

@bbjubjub2494
Copy link
Member Author

With my poc (same as OP but updated) it's different:

doCheck | setuptools | pyproject
false        | bad           | bad
true         | good         | bad

bad: no dependency check, successful build
good: dependency check and error

I can also show that in the pyproject case, if I add pythonImportsCheckHook, it fixes it. It's usually a good idea to add it anyways but I discovered that randomly earlier today.

@natsukium
Copy link
Member

The dependency check has now been introduced in python-updates branch as pythonRuntimeDepsCheckHook.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants