!rWxyQqNqMUDLECdsIf:blad.is

Poetry2nix

327 Members
https://github.com/nix-community/poetry2nix62 Servers

Load older messages


SenderMessageTime
26 Oct 2023
@k900:0upti.meK900It just adds new API22:23:21
@k900:0upti.meK900Anyway, done here: https://github.com/nix-community/poetry2nix/pull/137522:23:34
27 Oct 2023
@adis:blad.isadisbladisI just moved pyproject.nix to nix-community00:55:44
@adis:blad.isadisbladisIf it's going to be such a fundamental dependency of poetry2nix it should live in the same org00:56:02
@federicodschonborn:matrix.org@federicodschonborn:matrix.org changed their profile picture.01:24:26
@k900:0upti.meK900Maybe that will get more eyes on it too 06:10:37
@adis:blad.isadisbladisFor better or for worse =)06:48:53
@adis:blad.isadisbladis I was holding off on moving it precisely to get less eyes on it ;) 06:49:04
@janik0:matrix.org@janik0:matrix.org joined the room.12:56:55
@janik0:matrix.org@janik0:matrix.org

Hi, I'm not too familiar with poetry2nix so excuse the probably stupid question, how do I make nix build myPoetryPackage run tests?
Currently my Project looks like:

├── flake.lock
├── flake.nix
├── LICENSE.md
├── poetry.lock
├── pyproject.toml
├── README.md
├── src
│   └── first_time_contribution_tagger
│       ├── __init__.py
│       └── pullRequest.py
└── tests
    └── test_filterGraphqlOutput.py

And if I do: poetry run pytest the test runs successfully

13:04:38
@k900:0upti.meK900 Add pytestCheckHook to your nativeBuildInputs 13:05:28
@mlenz:matrix.org@mlenz:matrix.org I also did not know about this hook! One question though: Which attribute contains this hook? All examples I found online receive it as an argument via callPackage. I tried „pkgs.pytestCheckHook“, but this is empty.   13:16:09
@k900:0upti.meK900 It's in python3Packages 13:16:22
@janik0:matrix.org@janik0:matrix.org

doing:

          defaultPackage = pkgs.poetry2nix.mkPoetryApplication {
            projectDir = ./.;
            nativeBuildInputs = with pkgs; [
              python3.pkgs.pytestCheckHook
            ];
          };

seems to work, currently just have to pin some versions to see if it actually works because pytest and pluggy in my local project are newer then the one in nixpkgs

13:18:05
@janik0:matrix.org@janik0:matrix.orgimage.png
Download image.png
13:21:20
@k900:0upti.meK900Oh13:21:44
@k900:0upti.meK900pytestCheckHook probably pulls in its own pytest13:21:50
@janik0:matrix.org@janik0:matrix.orgI have no idea how to pin them to use the same version since the semVersion numbers seem to be the same13:21:52
@k900:0upti.meK900 You want to use the pytestCheckHook from the poetry2nix-created packages set 13:22:12
@janik0:matrix.org@janik0:matrix.org
In reply to @k900:0upti.me
You want to use the pytestCheckHook from the poetry2nix-created packages set
how would I access that?
13:22:43
@k900:0upti.meK900That's... a good question, actually13:23:31
@k900:0upti.meK900I'm not sure we have a good way to actually get to that from inside the package itself13:23:43
@janik0:matrix.org@janik0:matrix.orgI can also switch to buildPythonPackage from nixpkgs since I'm reworking some parts of the project anyways like adding test and fixing the bug where it tags prs from people that just changed there github name key because of cause I made the mistake of using that instead of the id.. 13:28:02
@janik0:matrix.org@janik0:matrix.org * I can also just switch to buildPythonPackage from nixpkgs since I'm reworking some parts of the project anyways like adding test and fixing the bug where it tags prs from people that just changed there github name key because of cause I made the mistake of using that instead of the id.. 13:28:12
@petrichor:envs.net@petrichor:envs.net joined the room.18:24:47
28 Oct 2023
@adis:blad.isadisbladis

It's not exactly obvious... But I think you could do:

let
  drv = poetry2nix.mkPoetryApplication {
    nativeBuildInputs = [
      drv.passthru.python.pkgs.pytestCheckHook
    ];
  };
in drv
03:31:44
@adis:blad.isadisbladis
In reply to @janik0:matrix.org
how would I access that?
^
03:32:16
@pcloud:matrix.orgcpcloud Looks like pyproject.nix doesn't handle ^4 style constraints 09:44:40
@adis:blad.isadisbladis
In reply to @pcloud:matrix.org
Looks like pyproject.nix doesn't handle ^4 style constraints
It does: https://nix-community.github.io/pyproject.nix/lib/poetry.html#function-library-lib.poetry.parseVersionCond
10:01:13
@pcloud:matrix.orgcpcloudDoes it support it in markers?10:01:47

Show newer messages


Back to Room ListRoom Version: 6