!rWxyQqNqMUDLECdsIf:blad.is

Poetry2nix

315 Members
https://github.com/nix-community/poetry2nix60 Servers

Load older messages


SenderMessageTime
7 Jun 2024
@k900:0upti.meK900By something12:37:45
@tyberius_prime:matrix.orgTyberiusPrime (smilodon inopinatus)yeah by the buildSystem that's set in poetry2nix13:00:06
@tyberius_prime:matrix.orgTyberiusPrime (smilodon inopinatus)but I don't think I can override that downstream.13:00:14
@tyberius_prime:matrix.orgTyberiusPrime (smilodon inopinatus)So a fork & PR it is...13:00:23
8 Jun 2024
@else42:tchncs.de@else42:tchncs.de joined the room.07:51:31
@else42:tchncs.de@else42:tchncs.dewhat's the standard way to ignore/skip some dependencies, that are included by default, but are not needed for productive use?07:56:27
@kritnich:kritni.ch@kritnich:kritni.ch joined the room.20:45:49
@kritnich:kritni.ch@kritnich:kritni.chHello, I'm having issues with building opencv using poetry2nix. It happens both for 4.9 and 4.10. https://dpaste.com/CWX5GZVEQ I found some issues on opencv related to this but those have been fixed in these two versions already so I'm not sure why it is happening again. The pure package in nixpkgs works fine.20:54:59
@kritnich:kritni.ch@kritnich:kritni.ch preferWheels = true fixes it for now 22:27:33
10 Jun 2024
@jameswarren-582a7124d73408ce4f35e991:gitter.imjameswarren (James Warren) joined the room.16:23:16
@jameswarren-582a7124d73408ce4f35e991:gitter.imjameswarren (James Warren)

Hello all - I have a question about editable packages. I'll try to keep it brief but can expand as needed.

We're looking into using nix and poetry to manage a python monorepo. For a client project to depend on a local utils library, we have this dependency in the utils pyproject.toml:

[tool.poetry.dependencies]
python = "^3.11"
utils = { path = "../utils/", develop = true }
16:40:21
@jameswarren-582a7124d73408ce4f35e991:gitter.imjameswarren (James Warren)

We'd also like to have utils as an editable installation in the nix development shell for client. I was able to accomplish this by redundantly stating this by using mkPoetryEditablePackage:

          devShells = {
            explicit = pkgs.mkShell {
              buildInputs = [
                (mkPoetryEditablePackage {
                  projectDir = ./.;
                  editablePackageSources = {
                    utils = ../utils;
                  };
                })
              ];
            };
          };
16:42:34
@jameswarren-582a7124d73408ce4f35e991:gitter.imjameswarren (James Warren) *

We'd also like to have utils as an editable installation in the nix development shell for client. I was able to accomplish this by redundantly stating this by using mkPoetryEditablePackage in the clients flake.nix:

          devShells = {
            explicit = pkgs.mkShell {
              buildInputs = [
                (mkPoetryEditablePackage {
                  projectDir = ./.;
                  editablePackageSources = {
                    utils = ../utils;
                  };
                })
              ];
            };
          };
16:42:58
@jameswarren-582a7124d73408ce4f35e991:gitter.imjameswarren (James Warren) However, this seems messy and error-prone to declare the same intention in multiple places. Reading the docs for mkPoetryEnv, the comment on editablePackageSources suggests that declaring develop = true in the pyproject.toml should install utils as editable, but empirically testing it does not. Am I misunderstanding how it should be used? 16:45:43
@jameswarren-582a7124d73408ce4f35e991:gitter.imjameswarren (James Warren) *

We'd also like to have utils as an editable installation in the nix development shell for client. I was able to accomplish this by redundantly stating this intention using mkPoetryEditablePackage in the clients flake.nix:

          devShells = {
            explicit = pkgs.mkShell {
              buildInputs = [
                (mkPoetryEditablePackage {
                  projectDir = ./.;
                  editablePackageSources = {
                    utils = ../utils;
                  };
                })
              ];
            };
          };
16:51:02
11 Jun 2024
@tyberius_prime:matrix.orgTyberiusPrime (smilodon inopinatus)Hey, I'm trying to specifiy a dependency via {url =...} in my pyproject.toml, but I keep getting a hash mismatched on the downloaded file. Can somebody have a look at my minimal example here: https://github.com/TyberiusPrime/poetry_url_bug_maybe and tell me what's going on?08:00:28
@tyberius_prime:matrix.orgTyberiusPrime (smilodon inopinatus)where's that specified hash even coming from...08:00:34
@tyberius_prime:matrix.orgTyberiusPrime (smilodon inopinatus)(ok, changing the hash that's in poetry.lock does change the specified hash...)08:02:57
@tyberius_prime:matrix.orgTyberiusPrime (smilodon inopinatus)seems it's the to_base32(to_sri(poetry.lock-hash that starts with sha256))08:03:26
@tyberius_prime:matrix.orgTyberiusPrime (smilodon inopinatus)it's gone away... maybe it was just a pypi fluke...08:09:05
@tyberius_prime:matrix.orgTyberiusPrime (smilodon inopinatus)or maybe not. hm.08:10:29
@tyberius_prime:matrix.orgTyberiusPrime (smilodon inopinatus)I think it's a bug. poetry2nix appears to be using the 'fetchzip' unpacked&recursive hash, while poetry specifies the hash of the tar.gz - https://github.com/nix-community/poetry2nix/issues/169508:29:33
@horigome:matrix.orgÓli joined the room.12:22:36
@horigome:matrix.orgÓli
In reply to @jameswarren-582a7124d73408ce4f35e991:gitter.im
However, this seems messy and error-prone to declare the same intention in multiple places. Reading the docs for mkPoetryEnv, the comment on editablePackageSources suggests that declaring develop = true in the pyproject.toml should install utils as editable, but empirically testing it does not. Am I misunderstanding how it should be used?
I'm having similar issues. Are you using a flake for your project?
16:30:51
12 Jun 2024
@jameswarren-582a7124d73408ce4f35e991:gitter.imjameswarren (James Warren)Yes I am. Looking at the source code, it looks somewhat understandable - I was planning on spending more time pondering it to either understand how it's to be used or how I could modify it. It's not my most pressing problem at the moment, though. 🤷03:53:45
13 Jun 2024
@ixxie:matrix.org@ixxie:matrix.org joined the room.08:18:15
@ixxie:matrix.org@ixxie:matrix.org

Hey folks, I'm new to poetry2nix and trying to get my first flake going for a python backend in a monorepo.

The flake quickstart example has a default app output as follows:

apps.${system}.default = {
  type = "app";
  program = "${myapp}/bin/some_script";
};

But I would like to output multiple scripts as different commands. How would I go about it? I thought I could just do apps.${system}.command_name but it complains:

error: flake 'git+file:///home/ixxie/myapp?dir=backend' does not provide attribute 'packages.x86_64-linux.default' or 'defaultPackage.x86_64-linux
08:20:09
@ixxie:matrix.org@ixxie:matrix.orgah right, need to run it as an app, not build it08:37:21
@ixxie:matrix.org@ixxie:matrix.org

I'm not sure what to make of this... here is the flake for the backend (it's in ${monorepo}/backend):

{
  description = "MyApp Backend - Python, Uvicorn & FastAPI";

  inputs = {
    nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
    poetry2nix.url = "github:nix-community/poetry2nix";
  };
  
  outputs = { self, nixpkgs, poetry2nix }:
    let
      system = "x86_64-linux";
      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;
      myapp = mkPoetryApplication { projectDir = ./.; };
    in
    {
      apps.${system}.backend = {
        type = "app";
        program = "${myapp}/bin/backend";
      };
    };
}

But I get the following error:

warning: Git tree '/home/ixxie/myapp' is dirty
error:
       … while calling a functor (an attribute set with a '__functor' attribute)
         at /nix/store/lpqygnph8c5l7ajkmqr4rff0pvkfz1f6-source/default.nix:407:13:
          406|
          407|       app = py.pkgs.buildPythonPackage (
             |             ^
          408|         passedAttrs // inputAttrs // {

       … while evaluating a branch condition
         at /nix/store/dydg48djlykksz8cxq0xjplyxpa9pvf4-source/pkgs/development/interpreters/python/python-packages-base.nix:28:7:
           27|     in
           28|       if builtins.isAttrs result then result
             |       ^
           29|       else if builtins.isFunction result then {

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

       error: expected a set but found null: null
08:44:08
@ixxie:matrix.org@ixxie:matrix.org How do I control the name of the package created with mkPoetryApplication and installed with nix profile install? 11:29:47

Show newer messages


Back to Room ListRoom Version: 6