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

Surprising versions selected if overrides are used. #1314

Closed
fzakaria opened this issue Sep 18, 2023 · 0 comments · Fixed by #1315
Closed

Surprising versions selected if overrides are used. #1314

fzakaria opened this issue Sep 18, 2023 · 0 comments · Fixed by #1315

Comments

@fzakaria
Copy link
Contributor

Describe the issue

I have a package in my poetry.lock file at a specific version.

[[package]]
name = "lief"
version = "0.13.2"
description = "Library to instrument executable formats"
category = "main"
optional = false
python-versions = ">=3.8"

I however wanted a newer version of this package so I overrode it in my poetry Nix configuration.

# the following is lief.nix
{ fetchFromGitHub, python, stdenv, cmake, ninja }:
let
  pyEnv = python.withPackages (ps: [ ps.setuptools ps.tomli ps.pip ps.setuptools ]);
in
stdenv.mkDerivation rec {
  pname = "lief";
  version = "0.14.0-3414ded";
  src = fetchFromGitHub {
    owner = "lief-project";
    repo = "LIEF";
    rev = "3414ded8cdcbd9705f7871c66c212b15cd74ea69";
    sha256 = "sha256-GJTj4w8HhAiC2bQAjEIqPw9feaOHL4fmAfLACioW0Q0=";
  };
  outputs = [ "out" "py" ];
....
lief-3414ded = self.callPackage ./lief.nix { python = self.python3; };

poetryOverrides = self: super: {
    lief = super.toPythonModule super.pkgs.lief-3414ded.py;
  };

I'm surprised that this works and that the version is the newer one but the poetry.lock is now out of sync with what I am installing.

❯ python
Python 3.10.12 (main, Jun  6 2023, 22:43:10) [GCC 12.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import lief;print(lief.__version__)
0.14.0-

Is this an anti-pattern ? Is this what we expect?

Maybe we should log something when poetry2nix is using a version that differs than the lock file?

fzakaria added a commit to fzakaria/poetry2nix that referenced this issue Sep 18, 2023
Add a new doc explaining the footgun that can happen if you chose to
override the package version for a python package in poetry2nix

fixes nix-community#1314
cpcloud pushed a commit to fzakaria/poetry2nix that referenced this issue Oct 28, 2023
Add a new doc explaining the footgun that can happen if you chose to
override the package version for a python package in poetry2nix

fixes nix-community#1314
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant