!rWxyQqNqMUDLECdsIf:blad.is

Poetry2nix

332 Members
https://github.com/nix-community/poetry2nix68 Servers

Load older messages


SenderMessageTime
25 Dec 2021
@adis:blad.isadisbladis changed the history visibility to "world_readable" from "shared".23:58:57
26 Dec 2021
@clango:matrix.orgclango joined the room.19:06:23
28 Dec 2021
@0x4a6f:matrix.org[0x4A6F] joined the room.15:22:40
@artturin:matrix.orgArtturin joined the room.20:32:21
2 Jan 2022
@grahamc:nixos.org@grahamc:nixos.org joined the room.12:22:39
4 Jan 2022
@adis:blad.isadisbladischanged room power levels.07:02:11
@adis:blad.isadisbladis set the room topic to "https://github.com/nix-community/poetry2nix".07:03:01
@mic92:nixos.devMic92 joined the room.18:05:47
@artturin:matrix.orgArtturin just had to add pytest in to the checkPhase and now it works 19:19:29
@adis:blad.isadisbladis
In reply to @artturin:matrix.org

if i add python.pkgs.pytestCheckHook to checkInputs i get many of these

python3.10-nixos-gen-config> Found duplicated packages in closure for dependency 'pytest':
python3.10-nixos-gen-config>   pytest 6.2.5 (/nix/store/km2dg715wf31dq8vafdaplwlnh8jnqzy-python3.10-pytest-6.2.5/lib/python3.10/site-packages)
python3.10-nixos-gen-config>   pytest 6.2.5 (/nix/store/yc3jnjq6wx4zz14anjj9mj8xxv1zc57v-python3.10-pytest-6.2.5/lib/python3.10/site-packages)
You absolutely should not add dependencies from the nixpkgs python package sets like that
19:47:08
@artturin:matrix.orgArtturini realised that19:47:34
* @adis:blad.isadisbladis is slowly gathering an "anti-patterns" section for the readme19:48:05
@artturin:matrix.orgArtturin👍️19:48:19
@artturin:matrix.orgArtturin😆19:48:25
5 Jan 2022
@austinp17:matrix.orgaustinp17 joined the room.13:20:00
@grahamc:nixos.org@grahamc:nixos.org invited @mjolnir:nixos.orgNixOS Moderation Bot.15:08:59
@mjolnir:nixos.orgNixOS Moderation Bot joined the room.15:09:01
@grahamc:nixos.org@grahamc:nixos.orgchanged room power levels.15:09:02
Room Avatar Renderer.15:09:04
@grahamc:nixos.org@grahamc:nixos.org 👍️should be all set adisbladis ! 15:09:21
@mic92:nixos.devMic92 left the room.16:46:19
@averagechris:matrix.orgaveragechris joined the room.22:08:31
7 Jan 2022
@elgert:matrix.orgelgert joined the room.04:04:09
10 Jan 2022
@manveru:matrix.orgmanveru joined the room.13:50:03
11 Jan 2022
@aciceri:nixos.devzrsk joined the room.19:15:53
@aciceri:nixos.devzrsk

Hi,
I'm trying to understand how to use poetry2nix but I've this poroblem, this is my current flake.nix:

{
  description = "My Python application";

  inputs = {
    nixpkgs.url = github:NixOS/nixpkgs/nixos-unstable;
    flake-utils-plus.url = github:gytis-ivaskevicius/flake-utils-plus/v1.3.1;
  };

  outputs = { self, nixpkgs, flake-utils-plus }:
    flake-utils-plus.lib.eachDefaultSystem (system:
      let
        pkgs = nixpkgs.legacyPackages.${system};

        caseGeneratorApp = pkgs.poetry2nix.mkPoetryEnv {
          projectDir = ./case;
          editablePackageSources = {
            src = ./case/src;
          };
        };

        packageName = "case_generator";
      in
      {

        defaultPackage = caseGeneratorApp;
        devShell = pkgs.mkShell {
          name = "development";
          buildInputs = [
            caseGeneratorApp
          ];
        };
      });
}

When I enter in the development shell withnix develop I get the scripts exposed by poetry and configured in the pyproject.toml in my PATH, and I can correctly execute them. But if I edit these sources (in ./case/src/) it makes no difference. I've to exit and re-enter in the shell to make the changes work.

Am I doing things correctly? If someone know a simple and working flake using poetry2nix I would be happy to take a look.

Thank you

23:48:04
@adis:blad.isadisbladis
In reply to @aciceri:nixos.dev

Hi,
I'm trying to understand how to use poetry2nix but I've this poroblem, this is my current flake.nix:

{
  description = "My Python application";

  inputs = {
    nixpkgs.url = github:NixOS/nixpkgs/nixos-unstable;
    flake-utils-plus.url = github:gytis-ivaskevicius/flake-utils-plus/v1.3.1;
  };

  outputs = { self, nixpkgs, flake-utils-plus }:
    flake-utils-plus.lib.eachDefaultSystem (system:
      let
        pkgs = nixpkgs.legacyPackages.${system};

        caseGeneratorApp = pkgs.poetry2nix.mkPoetryEnv {
          projectDir = ./case;
          editablePackageSources = {
            src = ./case/src;
          };
        };

        packageName = "case_generator";
      in
      {

        defaultPackage = caseGeneratorApp;
        devShell = pkgs.mkShell {
          name = "development";
          buildInputs = [
            caseGeneratorApp
          ];
        };
      });
}

When I enter in the development shell withnix develop I get the scripts exposed by poetry and configured in the pyproject.toml in my PATH, and I can correctly execute them. But if I edit these sources (in ./case/src/) it makes no difference. I've to exit and re-enter in the shell to make the changes work.

Am I doing things correctly? If someone know a simple and working flake using poetry2nix I would be happy to take a look.

Thank you

That's because of how flakes work re purity. In a flake evaluation ./foo doesn't refer to the local path, but the path copied to the store.
23:52:29
@adis:blad.isadisbladisIt's not a poetry2nix thing, it's a flakes thing.23:52:40
12 Jan 2022
@aciceri:nixos.devzrskAhh, I understand. What do you suggest me then? What would be the correct way to use a flake to manage a development flow like this?00:02:20
@adis:blad.isadisbladis
In reply to @aciceri:nixos.dev
Ahh, I understand. What do you suggest me then? What would be the correct way to use a flake to manage a development flow like this?

I've seen people using --impure combined with environment variables to reference paths outside of the store.
That could work.

I'm not a flakes user so I might not be of too much help.

00:03:47

Show newer messages


Back to Room ListRoom Version: 6