!rWxyQqNqMUDLECdsIf:blad.is

Poetry2nix

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

Load older messages


SenderMessageTime
26 Apr 2024
@matthewcroughan:defenestrate.itmatthewcroughan
In reply to @k900:0upti.me
Any poetry2nix overrides are applied on top of nixpkgs overrides
Is it possible we could go over this again please? I'm really trying to understand it, and would like to understand this code you wrote a bit better https://github.com/nix-community/poetry2nix/blob/master/default.nix#L233-L285
13:11:23
@matthewcroughan:defenestrate.itmatthewcroughanhttps://github.com/NixOS/nixpkgs/blob/nixos-23.11/pkgs/development/python-modules/apsw/default.nix#L3913:11:36
@matthewcroughan:defenestrate.itmatthewcroughan apsw is a derivation that exists in nixpkgs. When poetry2nix encounters apsw in the pyproject.toml, does it use any information from nixpkgs that is already there, or is it making a completely unique derivation that doesn't re-use anything from nixpkgs? 13:12:07
@matthewcroughan:defenestrate.itmatthewcroughanI'm about to submit a fix for apsw in the overrides.nix in poetry2nix, but want to understand it more first 13:12:26
@matthewcroughan:defenestrate.itmatthewcroughan When poetry2nix sees apsw uses the sources from pypi, which are wrong because they contain a setup.py which breaks the build, because it doesn't do the same thing as the setup.py from GitHub. 13:13:00
@matthewcroughan:defenestrate.itmatthewcroughan * When poetry2nix sees apsw uses the sources from pypi, which are wrong because they contain a setup.py which breaks the build, because it doesn't do the same thing as the setup.py from GitHub. 13:13:09
@matthewcroughan:defenestrate.itmatthewcroughan In addition sqlite is not in the buildInputs of the poetry2nix generated derivation, which implies nothing is added to poetry2nix by the pre-existing nixpkgs derivation 13:14:04
@matthewcroughan:defenestrate.itmatthewcroughan

Here's a minimal flake.nix to reproduce it
``nix
{
description = "A minimal Python project with apsw dependency";

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

outputs = { self, nixpkgs, flake-utils, poetry2nix }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs { inherit system; overlays = [ poetry2nix.overlays.default ]; };
in
{
packages.default = pkgs.poetry2nix.mkPoetryApplication {
projectDir = ./.;
preferWheels = false;
};

    devShell = pkgs.mkShell {
      buildInputs = with pkgs; [
        poetry
        (pkgs.poetry2nix.mkPoetryEnv {
          projectDir = ./.;
          preferWheels = false;
          overrides = pkgs.poetry2nix.defaultPoetryOverrides.extend
            (self: super: {
              apsw = super.apsw.overridePythonAttrs
              (
                old: {
                  src = pkgs.fetchFromGitHub {
                    owner = "rogerbinns";
                    repo = "apsw";
                    rev = "3.45.2.0";
                    hash = "sha256-tTi3/10W4OoGH6PQVhvPWc5o09on5BZrWoAvrfh4C/E=";
                  };
                  buildInputs = old.buildInputs ++ [ pkgs.sqlite ];
                }
              );
            });
        })
      ];
    };
  }
);

}

13:15:34
@matthewcroughan:defenestrate.itmatthewcroughan *

Here's a minimal flake.nix to reproduce it

{
  description = "A minimal Python project with apsw dependency";

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

  outputs = { self, nixpkgs, flake-utils, poetry2nix }:
    flake-utils.lib.eachDefaultSystem (system:
      let
        pkgs = import nixpkgs { inherit system; overlays = [ poetry2nix.overlays.default ]; };
      in
      {
        packages.default = pkgs.poetry2nix.mkPoetryApplication {
          projectDir = ./.;
          preferWheels = false;
        };

        devShell = pkgs.mkShell {
          buildInputs = with pkgs; [
            poetry
            (pkgs.poetry2nix.mkPoetryEnv {
              projectDir = ./.;
              preferWheels = false;
              overrides = pkgs.poetry2nix.defaultPoetryOverrides.extend
                (self: super: {
                  apsw = super.apsw.overridePythonAttrs
                  (
                    old: {
                      src = pkgs.fetchFromGitHub {
                        owner = "rogerbinns";
                        repo = "apsw";
                        rev = "3.45.2.0";
                        hash = "sha256-tTi3/10W4OoGH6PQVhvPWc5o09on5BZrWoAvrfh4C/E=";
                      };
                      buildInputs = old.buildInputs ++ [ pkgs.sqlite ];
                    }
                  );
                });
            })
          ];
        };
      }
    );
}
13:15:56
@matthewcroughan:defenestrate.itmatthewcroughan

and a pyproject.toml

[tool.poetry]
name = "my-project"
version = "0.1.0"
description = "A minimal Python project with apsw dependency"
authors = ["Your Name <your@email.com>"]

[tool.poetry.dependencies]
python = "^3.8"
apsw = "*"

[build-system]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"
~
13:16:11
@matthewcroughan:defenestrate.itmatthewcroughan *

and a pyproject.toml

[tool.poetry]
name = "my-project"
version = "0.1.0"
description = "A minimal Python project with apsw dependency"
authors = ["Your Name <your@email.com>"]

[tool.poetry.dependencies]
python = "^3.8"
apsw = "*"

[build-system]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"
~
13:16:16
@matthewcroughan:defenestrate.itmatthewcroughanhttps://github.com/nix-community/poetry2nix/pull/1614 anyway 14:00:42
@matthewcroughan:defenestrate.itmatthewcroughanmaybe it's not the right way to fix it 14:00:45
@christian:kampka.net@christian:kampka.net left the room.18:32:59
29 Apr 2024
@gaivs:matrix.orggaivs

Have anyone here had success getting imgui to work with nix?

06:55:09
@noonvandersilk:matrix.org@noonvandersilk:matrix.org left the room.08:22:13
@papayapeanut:matrix.orgpapayapeanut joined the room.12:26:53
@matthewcroughan:defenestrate.itmatthewcroughan changed their profile picture.13:02:53
@mjolnir:nixos.orgNixOS Moderation Botchanged room power levels.15:29:44
@tcarlsdyfis:matrix.orgCharles DuffyUsing the current version of the poetry2nix flake, I see poetry2nix being built against pkginfo 1.9.6. Unfortunately, to support metadata from the latest version of hatchling, we need pkginfo 1.10.x (per https://github.com/python-poetry/poetry/issues/9244). Because these are dependencies for poetry2nix itself rather than my project, the override mechanism doesn't apply; where should I start in trying to fix this?23:29:45
30 Apr 2024
@xondtx:matrix.orgondt joined the room.22:24:09
1 May 2024
@mjolnir:nixos.orgNixOS Moderation Botchanged room power levels.15:07:27
@rolandco:matrix.orgRoland Coeurjoly
In reply to @gaivs:matrix.org

Have anyone here had success getting imgui to work with nix?

No, I got a network error. I will copy the error when I can
16:14:16
@gaivs:matrix.orggaivs
In reply to @rolandco:matrix.org
No, I got a network error. I will copy the error when I can
I ended up using dearpygui, works pretty well
16:29:05
@gsaurel:laas.frnim65sWow, there are like 50 PR which were merged or closed in the past 24h 👀 Thanks a lot for that ! ❤️21:08:36
6 May 2024
@matrixman_:matrix.orgMatt RixmanRedacted or Malformed Event02:07:32
@matrixman_:matrix.orgMatt Rixman

I'm trying to get editablePackageSources to work such that I can run pytest in a flake devshell and it will test my package, but be sensitive to local edits. Can I get some help?

I put together a repo for this request: https://github.com/MatrixManAtYrService/pytest_poetry2nix

02:48:40
@vengmark2:matrix.org@vengmark2:matrix.org
In reply to @matrixman_:matrix.org

I'm trying to get editablePackageSources to work such that I can run pytest in a flake devshell and it will test my package, but be sensitive to local edits. Can I get some help?

I put together a repo for this request: https://github.com/MatrixManAtYrService/pytest_poetry2nix

pytest typically runs against the source code, so you shouldn't need to do anything special to achieve this. It's only if you want to run tests against the compiled application that you'd need to re-run nix develop to test against changed files.
03:53:07
@matrixman_:matrix.orgMatt Rixman
In reply to @vengmark2:matrix.org
pytest typically runs against the source code, so you shouldn't need to do anything special to achieve this. It's only if you want to run tests against the compiled application that you'd need to re-run nix develop to test against changed files.
Oh that makes sense. So instead of figuring out how to get an editable install via poetry2nix, I should be trying to figure out why the import is failing for whatever other reason.
04:15:21
@matrixman_:matrix.orgMatt Rixman
In reply to @vengmark2:matrix.org
pytest typically runs against the source code, so you shouldn't need to do anything special to achieve this. It's only if you want to run tests against the compiled application that you'd need to re-run nix develop to test against changed files.
* Oh that makes sense. So instead of figuring out how to get an editable install via poetry2nix, I should be trying to figure out why the import (test module importing app) is failing for whatever other reason.
04:16:32

Show newer messages


Back to Room ListRoom Version: 6