!rWxyQqNqMUDLECdsIf:blad.is

Poetry2nix

319 Members
https://github.com/nix-community/poetry2nix63 Servers

Load older messages


SenderMessageTime
21 Sep 2024
@j0xxx:nixbitcoin.orgwkhi, does anyone know if there is a way to override MAX_JOBS when building a python package? Getting OOM errors09:13:04
@k900:0upti.meK900 --option cores 4 09:32:12
@k900:0upti.meK900Or whatever number you want09:32:15
@j0xxx:nixbitcoin.orgwkhmm i was hoping to be able to override just that package so the rest of the system is unaffected plus it doesnt require keeping track of extra build parameters10:50:26
25 Sep 2024
@luna-null:matrix.orgAutumn changed their display name from luna-null to Autumn.06:39:14
26 Sep 2024
@ersei:ersei.net@ersei:ersei.net joined the room.02:05:20
@ersei:ersei.net@ersei:ersei.netHey all, I'm having trouble with poetry2nix. My pyproject.toml has psycopg-c, and when I go to build the package, I get a "ModuleNotFoundError: No module named 'setuptools'"02:07:42
@ersei:ersei.net@ersei:ersei.netany guidance?02:07:48
@ersei:ersei.net@ersei:ersei.netafaik psycopg-c should have the override already02:19:35
@ersei:ersei.net@ersei:ersei.netI added an override I guess02:31:24
@jfahne:matrix.orgjfahne joined the room.02:45:44
@vengmark2:matrix.orgl0b0
In reply to @ersei:ersei.net
I added an override I guess
Did that work? If so, would you be OK to create a PR?
02:48:05
@ersei:ersei.net@ersei:ersei.net
In reply to @vengmark2:matrix.org
Did that work? If so, would you be OK to create a PR?
yeah, I was just confused since I thought psycopg-c already has one
03:03:01
27 Sep 2024
@ericadelagnier:multi.coopErica joined the room.15:36:54
@ericadelagnier:multi.coopErica Hello and thanks for your work, I'm trying to package my poetry project and I have a few issues. I created a basic app to experiment, if you want to reproduce my bugs. 15:53:52
@ericadelagnier:multi.coopEricaWhen following the tutorial without flakes I'm facing this error message : 15:53:57
@ericadelagnier:multi.coopErica
nix-build default.nix
error:
       … while evaluating the attribute 'drvPath'

         at /nix/store/pp307nbzkgsd6393zl2i9j4j86z5nz9b-nixpkgs-src/lib/customisation.nix:228:7:

          227|     in commonAttrs // {
          228|       drvPath = assert condition; drv.drvPath;
             |       ^
          229|       outPath = assert condition; drv.outPath;

       … while calling the 'derivationStrict' builtin

         at /builtin/derivation.nix:9:12: (source not available)

       (stack trace truncated; use '--show-trace' to show the full trace)

       error: function 'anonymous lambda' called with unexpected argument 'flit-core'

       at /nix/store/pp307nbzkgsd6393zl2i9j4j86z5nz9b-nixpkgs-src/pkgs/development/python-modules/wheel/default.nix:1:1:

            1| { lib
             | ^
            2| , buildPythonPackage

I'm a bit confused by niv since I don't usually use it, I tried to run the command both inside the nix-shell including niv and outside and I'm still getting the same error

15:54:11
@ericadelagnier:multi.coopEricaWhen using flakes, I was able to run my flake (yeah !) but I now have a question regarding the dependency environment can't seems to find the right syntax to build it. 15:54:20
@ericadelagnier:multi.coopErica

The error message when running nix build .is this one

error: flake 'path/to/project' does not provide attribute 'packages.x86_64-linux.default' or 'defaultPackage.x86_64-linux'
15:54:37
@ericadelagnier:multi.coopEricaSeeing that I could at least run the flake in my hello-world project, I tried to apply the same steps to my real-life project, putting aside the building problem for now. I created a PR for an override but I now have this error : 15:54:49
@ericadelagnier:multi.coopErica
error:
       … while evaluating the attribute 'pkgs.buildPythonPackage'

         at /nix/store/p2hby44a0qzrnd1vxcpcgfav6160rmcv-source/pkgs/development/interpreters/python/passthrufun.nix:87:5:

           86|     withPackages = import ./with-packages.nix { inherit buildEnv pythonPackages;};
           87|     pkgs = pythonPackages;
             |     ^
           88|     interpreter = "${self}/bin/${executable}";

       … while calling the 'mapAttrs' builtin

         at /nix/store/p2hby44a0qzrnd1vxcpcgfav6160rmcv-source/pkgs/development/interpreters/python/passthrufun.nix:31:8:

           30|           value;
           31|     in lib.mapAttrs func items;
             |        ^
           32|   in ensurePythonModules (callPackage

       (stack trace truncated; use '--show-trace' to show the full trace)

       error: value is a function while a set was expected
15:54:57
@ericadelagnier:multi.coopEricaThansk by advance for your help ! 15:55:07
@ericadelagnier:multi.coopErica * When using flakes, I was able to run my flake (yeah !) but I now have a question regarding the dependency environment since I can't seems to find the right syntax to build it. 15:56:23
@ericadelagnier:multi.coopErica * When using flakes, I was able to run my flake (yeah !) but I now have a question regarding the dependency environment since I can't seems to find the right syntax to build it (the README give an default.nix as example and I'm don't know enough about flakes to reproduce it) 15:58:48
@ericadelagnier:multi.coopErica * When using flakes, I was able to run my flake (yeah !) but I now have a question regarding the dependency environment to run my app with gunicorn since I can't seems to find the right syntax to build it (the README give an default.nix as example and I'm don't know enough about flakes to reproduce it) 16:08:04
@wecmyrc:matrix.orgwecmyrc
In reply to @ericadelagnier:multi.coop
When using flakes, I was able to run my flake (yeah !) but I now have a question regarding the dependency environment to run my app with gunicorn since I can't seems to find the right syntax to build it (the README give an default.nix as example and I'm don't know enough about flakes to reproduce it)

I think this will work with nix build .

flake.nix:

{
  description = "Python application packaged using poetry2nix";

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

  outputs =
    {
      self,
      nixpkgs,
      poetry2nix,
      flake-utils,
    }:
    flake-utils.lib.eachDefaultSystem (
      system:
      let
        pkgs = nixpkgs.legacyPackages.${system};
        # create a custom "mkPoetryApplication" API function that under the hood uses
        # the packages and versions (python3, poetry etc.) from our pinned nixpkgs above:
        inherit (poetry2nix.lib.mkPoetry2Nix { inherit pkgs; }) mkPoetryApplication;
      in
      {
        packages = {
          app = mkPoetryApplication {
            packageName = "app";
            projectDir = ./.;
          };

          default = self.packages.${system}.app;
        };
      }
    );
}

16:10:55
@ericadelagnier:multi.coopEricaRedacted or Malformed Event16:23:47
@ericadelagnier:multi.coopEricathe build works ! thank you :) I can now run the app with ./result/bin/hello, but I'm not sure how to call it with gunicorn ? the README suggest "./result/bin/gunicorn web:app" but I'm not sure how to make gunicorn available in the result16:26:27
@wecmyrc:matrix.orgwecmyrc
In reply to @ericadelagnier:multi.coop
the build works ! thank you :) I can now run the app with ./result/bin/hello, but I'm not sure how to call it with gunicorn ? the README suggest "./result/bin/gunicorn web:app" but I'm not sure how to make gunicorn available in the result

I would suggest to add gunicorn in flake.nix buildInputs, and run it from python something like subprocess.Popen(["gunicorn", "web:app""])

Part of flake.nix with buildInputs:

packages = {
  app = mkPoetryApplication {
    packageName = "app";
    projectDir = ./.;
  };

  buildInputs = with pkgs; [
    python312Packages.gunicorn
  ];

  default = self.packages.${system}.app;
};

16:38:23
@wecmyrc:matrix.orgwecmyrc
In reply to @ericadelagnier:multi.coop
the build works ! thank you :) I can now run the app with ./result/bin/hello, but I'm not sure how to call it with gunicorn ? the README suggest "./result/bin/gunicorn web:app" but I'm not sure how to make gunicorn available in the result
*

I would suggest to add gunicorn in flake.nix buildInputs, and run it from python something like subprocess.Popen(["gunicorn", "web:app"])

Part of flake.nix with buildInputs:

packages = {
  app = mkPoetryApplication {
    packageName = "app";
    projectDir = ./.;
  };

  buildInputs = with pkgs; [
    python312Packages.gunicorn
  ];

  default = self.packages.${system}.app;
};

16:38:46

Show newer messages


Back to Room ListRoom Version: 6