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

pythonRuntimeDepsCheck fails for wheels that have missing version specifiers in METADATA #285234

Open
Gigahawk opened this issue Jan 31, 2024 · 1 comment

Comments

@Gigahawk
Copy link
Contributor

Gigahawk commented Jan 31, 2024

Describe the bug

Building a poetry2nix package with git dependencies will fail with something like:

error: builder for '/nix/store/h5j3ida5jjy8k2gvrm4mcm06w09cz6y4-python3.11-smartp-0.1.0.drv' failed with exit code 1;
       last 10 log lines:
       > Creating a wheel...
       > * Getting build dependencies for wheel...
       > * Building wheel...
       > Successfully built smartp-0.1.0-py3-none-any.whl
       > Finished creating a wheel...
       > Finished executing pypaBuildPhase
       > Running phase: pythonRuntimeDepsCheckHook
       > Executing pythonRuntimeDepsCheck
       > Checking runtime dependencies for smartp-0.1.0-py3-none-any.whl
       >   - pysmart not satisfied by version 0.1.dev313
       For full logs, run 'nix log /nix/store/h5j3ida5jjy8k2gvrm4mcm06w09cz6y4-python3.11-smartp-0.1.0.drv'.

This is because the generated METADATA file will not have any version specifier when generated from a poetry file pointing to git:

Metadata-Version: 2.1
Name: smartp
Version: 0.1.0
Summary: Blocking test for all SMART capable drives on the system
Author: Jasper Chan
Author-email: jasperchan515@gmail.com
Requires-Python: >=3.10,<4.0
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Requires-Dist: pySMART
Description-Content-Type: text/markdown

This gets ingested by https://github.com/NixOS/nixpkgs/blob/master/pkgs/development/interpreters/python/hooks/python-runtime-deps-check-hook.py, eventually causing a failure here due to an empty requirement.specifier:

if package.version not in requirement.specifier:
error(
f"{package_name}{requirement.specifier} not satisfied by version {package.version}"
)
return False

Steps To Reproduce

Steps to reproduce the behavior:

  1. Checkout Gigahawk/smartp@6612b56
  2. Run nix build

Expected behavior

A clear and concise description of what you expected to happen.

In this case, since there is no version specified in METADATA, I would expect the version check to be skipped.

Screenshots

If applicable, add screenshots to help explain your problem.

Additional context

Add any other context about the problem here.

Notify maintainers

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"
output here

Add a 👍 reaction to issues you find important.

@nixos-discourse
Copy link

This issue has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/packaging-python-for-nixpkgs-w-dependency-from-github/40415/2

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

2 participants