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

buildPythonApplication no longer checks that the dependencies are satisfied for pyproject #253872

Closed
GrigorenkoPV opened this issue Sep 7, 2023 · 1 comment
Labels
0.kind: bug Something is broken

Comments

@GrigorenkoPV
Copy link

Steps To Reproduce

  1. Have a project like this one:
  • default.nix:
let
  pkgs = import <nixpkgs> { };
  python = pkgs.python310;
in
{
  build = python.pkgs.buildPythonApplication {
    name = "example";
    format = "pyproject";
    buildInputs = with python.pkgs; [ setuptools ];
    propagatedBuildInputs = with python.pkgs; [
      #emoji
    ];
    src = ./.;
  };
}
  • pyproject.toml:
[build-system]
requires = ["setuptools>=61"]
build-backend = "setuptools.build_meta"

[project]
name = "example"
description = "Sample Text"
version = "1.0.0"
requires-python = "~=3.10"
dependencies = ["emoji~=2.0"]

[tool.setuptools]
py-modules = ["example"]

[project.scripts]
example = "example:main"
  • example.py:
import emoji

def main():
    print(emoji.emojize('Python is :thumbs_up:'))
  1. Run nix-build

Expected behavior

It fails to build:

Successfully built example
Finished creating a wheel...
Finished executing pipBuildPhase
installing
Executing pipInstallPhase
/build/test/dist /build/test
Processing ./example-1.0.0-py3-none-any.whl
ERROR: Could not find a version that satisfies the requirement emoji~=2.0 (from example) (from versions: none)
ERROR: No matching distribution found for emoji~=2.0

error: builder for '/nix/store/h5sj5gnr47p030xw4n8s3g8952y3sqfq-example.drv' failed with exit code 1;
       last 10 log lines:
       > Successfully built example
       > Finished creating a wheel...
       > Finished executing pipBuildPhase
       > installing
       > Executing pipInstallPhase
       > /build/test/dist /build/test
       > Processing ./example-1.0.0-py3-none-any.whl
       > ERROR: Could not find a version that satisfies the requirement emoji~=2.0 (from example) (from versions: none)
       > ERROR: No matching distribution found for emoji~=2.0
       > 
       For full logs, run 'nix-store -l /nix/store/h5sj5gnr47p030xw4n8s3g8952y3sqfq-example.drv'.

Actual behavior

It builds successfully. Running the built program reveals missing dependencies:

$ ./result/bin/example
Traceback (most recent call last):
  File "/nix/store/60am1awx2jrjpdz9hjdk3vikjvnvzx1x-example/bin/.example-wrapped", line 6, in <module>
    from example import main
  File "/nix/store/60am1awx2jrjpdz9hjdk3vikjvnvzx1x-example/lib/python3.10/site-packages/example.py", line 1, in <module>
    import emoji
ModuleNotFoundError: No module named 'emoji'

Additional context

I've run git bisect.

The first bad commit is e1cafe6.
The last good commit is e8cca49.
The three commits between those (6c85fff, 0d76478, & 349f57f) just cause nix-build to go unresponsive and eat more and more RAM indefinitely.

Notify maintainers

@FRidh
@mweinelt
@jonringer
@tjni
@fabaff

@GrigorenkoPV GrigorenkoPV added the 0.kind: bug Something is broken label Sep 7, 2023
@FRidh
Copy link
Member

FRidh commented Sep 7, 2023

Duplicate of #253131.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0.kind: bug Something is broken
Projects
None yet
Development

No branches or pull requests

2 participants