!rWxyQqNqMUDLECdsIf:blad.is

Poetry2nix

306 Members
https://github.com/nix-community/poetry2nix56 Servers

Load older messages


SenderMessageTime
12 Jan 2022
@averagechris:matrix.orgaveragechrisTotally makes sense I didn't even think about that.00:47:54
@averagechris:matrix.orgaveragechris set a profile picture.03:00:47
@jairo:recallstack.icuJairo Llopis joined the room.11:53:46
@jairo:recallstack.icuJairo Llopis

hello folks, I'm trying to use poetry2nix (total noob in nix, sorry) with a new project I'm developing.

it's weird that I can run this without problems:

> nix develop -c python -c 'import plumbum; print(plumbum.__file__)'
warning: Git tree '/var/home/yajo/prodevel/automirror' is dirty
/nix/store/5vnfif1w37raxbaxqn5qvpc9caqdgrkf-python3-3.9.6-env/lib/python3.9/site-packages/plumbum/__init__.py

however, when I attempt to build it, it fails:

> nix build
warning: Git tree '/var/home/yajo/prodevel/automirror' is dirty
error: --- Error -------------------------------------------------------------------------------------------------------------------------------------------------------------- nix
builder for '/nix/store/6s1kmxzh0nm65hj0zb18f1hs913szy0q-python3.9-automirror-0.0.0.drv' failed with exit code 1; last 10 log lines:
  Removed build tracker: '/build/pip-req-tracker-3skg7iy7'
  Finished creating a wheel...
  Finished executing pipBuildPhase
  installing
  Executing pipInstallPhase
  /build/source/dist /build/source
  Processing ./automirror-0.0.0-py3-none-any.whl
  Requirement already satisfied: git-aggregator<3.0.0,>=2.1.0 in /nix/store/nv8c0dhjcqxdrr08wgp25al6qfiqs5kk-python3.9-git-aggregator-2.1.0/lib/python3.9/site-packages (from automirror==0.0.0) (2.1.0)
  ERROR: Could not find a version that satisfies the requirement plumbum<2.0.0,>=1.7.2 (from automirror) (from versions: none)
  ERROR: No matching distribution found for plumbum<2.0.0,>=1.7.2

of course, plumbum is in my dependencies, added with poetry add plumbum just like normal; actually there's another dependency and that one gives no problems

11:57:58
@jairo:recallstack.icuJairo Llopis nix shell and nix run fail with the same error as nix build; of course I can just use nix develop for everything, but it doesn't seem extremely nice to me when not actually developing 12:00:18
@jairo:recallstack.icuJairo Llopisany idea on how to fix it?12:02:29
@jairo:recallstack.icuJairo Llopisdid I give enough information?13:20:53
15 Jan 2022
@liff:matrix.orgollijh joined the room.09:34:30
16 Jan 2022
@mou_bugtracker:matrix.orgmou joined the room.15:01:46
17 Jan 2022
@mou_bugtracker:matrix.orgmou

Hi everyone. Thanks to all who contributed into such great tool. It works like a charm. But i encountered issue that's is quite common, according to search. Issue i encountered is related to coverage python package. Including just this package cause infinite recursion. Searching and reading bring me to workaround, by explicitly specifying setuptools-scm dependency in my poetry config.

But i would like to know is it the only way to avoid infinite recursion or there are another more elegant without polluting dependencies? Also i would like to understand what goes under the hood to produce such error, is there any explanation documented?

08:36:36
@mou_bugtracker:matrix.orgmou *

Hi everyone. Thanks to all who contributed into such great tool. It works like a charm. But i encountered issue that's is quite common, according to search. Issue i encountered is related to coverage python package. Including just this package cause infinite recursion. Searching and reading bring me to workaround, by explicitly specifying setuptools-scm dependency in my poetry config.

But i would like to know is it the only way to avoid infinite recursion or there are another more elegant ways without polluting dependencies? Also i would like to understand what goes under the hood to produce such error, is there any explanation documented?

08:40:01
@mou_bugtracker:matrix.orgmou changed their display name from mou_bugtracker to mou.08:40:42
@adis:blad.isadisbladis
In reply to @jairo:recallstack.icu

hello folks, I'm trying to use poetry2nix (total noob in nix, sorry) with a new project I'm developing.

it's weird that I can run this without problems:

> nix develop -c python -c 'import plumbum; print(plumbum.__file__)'
warning: Git tree '/var/home/yajo/prodevel/automirror' is dirty
/nix/store/5vnfif1w37raxbaxqn5qvpc9caqdgrkf-python3-3.9.6-env/lib/python3.9/site-packages/plumbum/__init__.py

however, when I attempt to build it, it fails:

> nix build
warning: Git tree '/var/home/yajo/prodevel/automirror' is dirty
error: --- Error -------------------------------------------------------------------------------------------------------------------------------------------------------------- nix
builder for '/nix/store/6s1kmxzh0nm65hj0zb18f1hs913szy0q-python3.9-automirror-0.0.0.drv' failed with exit code 1; last 10 log lines:
  Removed build tracker: '/build/pip-req-tracker-3skg7iy7'
  Finished creating a wheel...
  Finished executing pipBuildPhase
  installing
  Executing pipInstallPhase
  /build/source/dist /build/source
  Processing ./automirror-0.0.0-py3-none-any.whl
  Requirement already satisfied: git-aggregator<3.0.0,>=2.1.0 in /nix/store/nv8c0dhjcqxdrr08wgp25al6qfiqs5kk-python3.9-git-aggregator-2.1.0/lib/python3.9/site-packages (from automirror==0.0.0) (2.1.0)
  ERROR: Could not find a version that satisfies the requirement plumbum<2.0.0,>=1.7.2 (from automirror) (from versions: none)
  ERROR: No matching distribution found for plumbum<2.0.0,>=1.7.2

of course, plumbum is in my dependencies, added with poetry add plumbum just like normal; actually there's another dependency and that one gives no problems

I guess it's the same setuptools-scm problems that keeps haunting us..
You could try an override similar to https://github.com/nix-community/poetry2nix/blob/master/overrides.nix#L53-L57
09:28:32
@adis:blad.isadisbladis
In reply to @mou_bugtracker:matrix.org

Hi everyone. Thanks to all who contributed into such great tool. It works like a charm. But i encountered issue that's is quite common, according to search. Issue i encountered is related to coverage python package. Including just this package cause infinite recursion. Searching and reading bring me to workaround, by explicitly specifying setuptools-scm dependency in my poetry config.

But i would like to know is it the only way to avoid infinite recursion or there are another more elegant ways without polluting dependencies? Also i would like to understand what goes under the hood to produce such error, is there any explanation documented?

Could you give me a complete reproduction case? I could try to figure out what's going on.
09:30:37
@mou_bugtracker:matrix.orgmou
In reply to @adis:blad.is
Could you give me a complete reproduction case? I could try to figure out what's going on.
Sure, just give me a minute
09:31:07
@mou_bugtracker:matrix.orgmou

pyproject.toml

name = "minimal-recursion"
version = "0.1.0"
description = ""
authors = ["Andrey Larionov <anlarionov@gmail.com>"]

[tool.poetry.dependencies]
python = "^3.10"

[tool.poetry.dev-dependencies]
coverage = "^6.2"

[build-system]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"

flake.nix

  description = "minimal-recursion";

  inputs.flake-utils.url = "github:numtide/flake-utils";
  inputs.nixpkgs.url = "github:NixOS/nixpkgs";
  inputs.poetry2nix.url = "github:nix-community/poetry2nix";

  outputs = { self, nixpkgs, flake-utils, poetry2nix }:
    {
      # Nixpkgs overlay providing the application
      overlay = nixpkgs.lib.composeManyExtensions [
        poetry2nix.overlay
        (final: prev: {
          # The application
          minRec = prev.poetry2nix.mkPoetryApplication {
            projectDir = ./.;
          };
        })
      ];
    } // (flake-utils.lib.eachDefaultSystem (system:
      let
        pkgs = import nixpkgs {
          inherit system;
          overlays = [ self.overlay ];
        };
      in
      rec {
        apps = {
          exyaru = pkgs.minRec;
        };

        defaultApp = pkgs.minRec;

        packages = {
          exyaru = pkgs.minRec;
        };

        defaultPackage = pkgs.minRec;
      }));
}
09:32:57
@mou_bugtracker:matrix.orgmouSame goes for other interpreter version09:33:23
@adis:blad.isadisbladis
In reply to @mou_bugtracker:matrix.org

pyproject.toml

name = "minimal-recursion"
version = "0.1.0"
description = ""
authors = ["Andrey Larionov <anlarionov@gmail.com>"]

[tool.poetry.dependencies]
python = "^3.10"

[tool.poetry.dev-dependencies]
coverage = "^6.2"

[build-system]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"

flake.nix

  description = "minimal-recursion";

  inputs.flake-utils.url = "github:numtide/flake-utils";
  inputs.nixpkgs.url = "github:NixOS/nixpkgs";
  inputs.poetry2nix.url = "github:nix-community/poetry2nix";

  outputs = { self, nixpkgs, flake-utils, poetry2nix }:
    {
      # Nixpkgs overlay providing the application
      overlay = nixpkgs.lib.composeManyExtensions [
        poetry2nix.overlay
        (final: prev: {
          # The application
          minRec = prev.poetry2nix.mkPoetryApplication {
            projectDir = ./.;
          };
        })
      ];
    } // (flake-utils.lib.eachDefaultSystem (system:
      let
        pkgs = import nixpkgs {
          inherit system;
          overlays = [ self.overlay ];
        };
      in
      rec {
        apps = {
          exyaru = pkgs.minRec;
        };

        defaultApp = pkgs.minRec;

        packages = {
          exyaru = pkgs.minRec;
        };

        defaultPackage = pkgs.minRec;
      }));
}
https://github.com/nix-community/poetry2nix/pull/510
09:46:01
@mou_bugtracker:matrix.orgmou
In reply to @adis:blad.is
https://github.com/nix-community/poetry2nix/pull/510
Wow. That was quick. Thank you so much.
09:48:36
@adis:blad.isadisbladis
In reply to @mou_bugtracker:matrix.org
Wow. That was quick. Thank you so much.
You caught me at a good time :)
09:49:21
@mou_bugtracker:matrix.orgmouThanks also for comment. Now i understand where from recursion come from.09:52:59
@adis:blad.isadisbladis mou: I'm also attempting an alternative fix in https://github.com/nix-community/poetry2nix/pull/511 10:10:35
@mou_bugtracker:matrix.orgmouCool. Will wait till merge and then remove my explicit dependency on setuptools10:11:46
@adis:blad.isadisbladis
In reply to @mou_bugtracker:matrix.org
Cool. Will wait till merge and then remove my explicit dependency on setuptools
I've already merged the first fix.
10:12:00
@adis:blad.isadisbladisSince it fixes the immediate issue10:12:14
@adis:blad.isadisbladisThen we'll see about the more principled fix10:12:24
@mou_bugtracker:matrix.orgmou

Just updated poetry2nix and encountered error i'm pretty sure does not seen before
pyproject.toml

name = "poetry2nix-ref-rev"
version = "0.1.0"
description = ""
authors = ["Andrey Larionov <anlarionov@gmail.com>"]

[tool.poetry.dependencies]
python = "^3.9"
uengine = { git = "https://github.com/mou/uengine.git", rev = "9331977689e49a59cded336247f8cd54ae989b94" }

[build-system]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"

flake.nix

  description = "poetry2nix minimal project to reproduce rev-ref bug";

  inputs.flake-utils.url = "github:numtide/flake-utils";
  inputs.nixpkgs.url = "github:NixOS/nixpkgs";
  inputs.poetry2nix.url = "github:nix-community/poetry2nix";

  outputs = { self, nixpkgs, flake-utils, poetry2nix }:
    {
      # Nixpkgs overlay providing the application
      overlay = nixpkgs.lib.composeManyExtensions [
        poetry2nix.overlay
        (final: prev: {
          # The application
          refrev = prev.poetry2nix.mkPoetryApplication {
            projectDir = ./.;
          };
        })
      ];
    } // (flake-utils.lib.eachDefaultSystem (system:
      let
        pkgs = import nixpkgs {
          inherit system;
          overlays = [ self.overlay ];
        };
      in
      rec {
        apps = {
          refrev = pkgs.refrev;
        };

        defaultApp = pkgs.refrev;

        packages = {
          refrev = pkgs.refrev;
        };

        defaultPackage = pkgs.refrev;
      }));
}

nix build --show-trace

error: program 'git' failed with exit code 128

       … while fetching the input 'git+https://github.com/mou/uengine.git?ref=9331977689e49a59cded336247f8cd54ae989b94&rev=9331977689e49a59cded336247f8cd54ae989b94'

       … while evaluating the attribute 'src.name'

       at /nix/store/90rq6828hgygs5h3shm4zgn810h9xa8b-source/mk-poetry-dep.nix:169:7:

          168|       # Here we can then choose a file based on that info.
          169|       src =
             |       ^
          170|         if isGit then

       … while evaluating 'hasSuffix'

       at /nix/store/m41jr4nfb4vxf39nwqvc9sx68xi04gar-source/lib/strings.nix:234:5:

          233|     # Input string
          234|     content:
             |     ^
          235|     let

       … from call site

       at /nix/store/m41jr4nfb4vxf39nwqvc9sx68xi04gar-source/pkgs/development/interpreters/python/mk-python-derivation.nix:127:25:

          126|       pythonRemoveBinBytecodeHook
          127|     ] ++ lib.optionals (lib.hasSuffix "zip" (attrs.src.name or "")) [
             |                         ^
          128|       unzip

       … while evaluating 'optionals'

       at /nix/store/m41jr4nfb4vxf39nwqvc9sx68xi04gar-source/lib/lists.nix:270:5:

          269|     # List to return if condition is true
          270|     elems: if cond then elems else [];
             |     ^
          271|

       … from call site

       at /nix/store/m41jr4nfb4vxf39nwqvc9sx68xi04gar-source/pkgs/development/interpreters/python/mk-python-derivation.nix:127:10:

          126|       pythonRemoveBinBytecodeHook
          127|     ] ++ lib.optionals (lib.hasSuffix "zip" (attrs.src.name or "")) [
             |          ^
          128|       unzip

       … while evaluating 'chooseDevOutputs'

       at /nix/store/m41jr4nfb4vxf39nwqvc9sx68xi04gar-source/lib/attrsets.nix:498:22:

          497|   /* Pick the outputs of packages to place in buildInputs */
          498|   chooseDevOutputs = drvs: builtins.map getDev drvs;
             |                      ^
          499|

       … from call site

       … while evaluating the attribute 'nativeBuildInputs' of the derivation 'python3.9-uengine-3.6.14'

       at /nix/store/m41jr4nfb4vxf39nwqvc9sx68xi04gar-source/pkgs/stdenv/generic/make-derivation.nix:205:7:

          204|     // (lib.optionalAttrs (attrs ? name || (attrs ? pname && attrs ? version)) {
          205|       name =
             |       ^
          206|         let

       … while evaluating the attribute 'out.outPath'

       at /nix/store/m41jr4nfb4vxf39nwqvc9sx68xi04gar-source/lib/customisation.nix:157:13:

          156|             drvPath = assert condition; drv.${outputName}.drvPath;
          157|             outPath = assert condition; drv.${outputName}.outPath;
             |             ^
          158|           };

       … while evaluating the attribute 'propagatedBuildInputs' of the derivation 'python3.9-poetry2nix-ref-rev-0.1.0'

       at /nix/store/m41jr4nfb4vxf39nwqvc9sx68xi04gar-source/pkgs/stdenv/generic/make-derivation.nix:205:7:

          204|     // (lib.optionalAttrs (attrs ? name || (attrs ? pname && attrs ? version)) {
          205|       name =
             |       ^
          206|         let

       … while evaluating the attribute 'drvPath'

       at /nix/store/m41jr4nfb4vxf39nwqvc9sx68xi04gar-source/lib/customisation.nix:163:7:

          162|     in commonAttrs // {
          163|       drvPath = assert condition; drv.drvPath;
             |       ^
          164|       outPath = assert condition; drv.outPath;

I'm not sure but looks like revision is also placed in position of reference when fetching from git. Pretty sure at least couple of week ago i did not saw this error for similar dependencies.

10:47:04
@mou_bugtracker:matrix.orgmou missed line preceeding log above
fetching Git repository 'https://github.com/mou/uengine.git'fatal: couldn't find remote ref refs/heads/9331977689e49a59cded336247f8cd54ae989b94
10:47:56
@adis:blad.isadisbladisI think you may have run in to https://github.com/nix-community/poetry2nix/pull/42410:54:25
@mou_bugtracker:matrix.orgmou

hmm. i'm looking into mk-poetry-dep.nix

  171           (
  172             builtins.fetchGit {
  173               inherit (source) url;
  174               rev = source.resolved_reference or source.reference;
  175               ref = sourceSpec.branch or sourceSpec.rev or (if sourceSpec?tag then "refs/tags/${sourceSpec.tag}" else "HEAD");
  176             }
  177           )

looks like if source has no branch specification, then ref will get binding to sourceSpec.rev. Which is cause constructing url git+https://github.com/mou/uengine.git?ref=9331977689e49a59cded336247f8cd54ae989b94&rev=9331977689e49a59cded336247f8cd54ae989b94

I'm total newbie and migth not understand completly what this code does.

11:07:02

Show newer messages


Back to Room ListRoom Version: 6