!rWxyQqNqMUDLECdsIf:blad.is

Poetry2nix

306 Members
https://github.com/nix-community/poetry2nix56 Servers

Load older messages


SenderMessageTime
6 May 2024
@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
@matrixman_:matrix.orgMatt Rixman *

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.

This is what I needed to hear l0b0 , thanks for the hint.

04:22:53
@nazarewk:matrix.orgkdnis poetry2nix using nixpkgs' package definitions or entirely it's own?12:26:56
@nazarewk:matrix.orgkdn * is poetry2nix using nixpkgs' package definitions or entirely it's own? I just noticed pyyaml doesn't have libyaml as a dependency 12:27:40
@julius:mtx.liftm.deˈt͡sɛːzaɐ̯By default, it gets everything from pypi. but you can override.12:33:16
@nazarewk:matrix.orgkdnI'm not sure why was I under impression it reused overrides from nixpkgs as a base12:34:12
@gsaurel:laas.frnim65sthere are default overrides from nixpkgs, in https://github.com/nix-community/poetry2nix/blob/master/overrides/build-systems.json & https://github.com/nix-community/poetry2nix/blob/master/overrides/default.nix13:02:08
@gsaurel:laas.frnim65sthose are here to make packages from PyPI work13:02:18
@gsaurel:laas.frnim65sI mean, packages from PyPI can have additionnal non-PyPI dependecies and/or additionnal PyPI dependecies not declared (especially build systems)13:02:59
@charles:computer.surgeryCharles changed their display name from Charles ⚡️ to Charles.17:01:08
@nazarewk:matrix.orgkdnany idea if it would be possible to install Ansible without the whole default galaxy collections set?17:57:37
7 May 2024
@gaivs:matrix.orggaivs

When I set editablePackageSources.myapp = ./src, this should work right? So that when I edit ./src/myapp/test.py, I thought I should be able to see that change when I run python -m myapp.test, but the same code is executed for me.

07:35:02
@kativen:matrix.orgAndrea Mangrella joined the room.19:18:03
8 May 2024
@vengmark2:matrix.org@vengmark2:matrix.org

pyproj/_datadir.pyx:148:33: Cannot assign type 'void (void *, int, const char ) except * nogil' to 'PJ_LOG_FUNCTION' (alias of 'void ()(void *, int, const char *) noexcept nogil'). Exception values are incompatible. Suggest adding 'noexcept' to the type of 'pyproj_log_function'.
https://github.com/nix-community/poetry2nix/issues/1645

02:01:21
@vengmark2:matrix.org@vengmark2:matrix.org *

pyproj/_datadir.pyx:148:33: Cannot assign type 'void (void *, int, const char ) except * nogil' to 'PJ_LOG_FUNCTION' (alias of 'void ()(void *, int, const char *) noexcept nogil'). Exception values are incompatible. Suggest adding 'noexcept' to the type of 'pyproj_log_function'.

https://github.com/nix-community/poetry2nix/issues/1645

02:01:25
@vengmark2:matrix.org@vengmark2:matrix.org *

pyproj/_datadir.pyx:148:33: Cannot assign type 'void (void *, int, const char ) except * nogil' to 'PJ_LOG_FUNCTION' (alias of 'void ()(void *, int, const char *) noexcept nogil'). Exception values are incompatible. Suggest adding 'noexcept' to the type of 'pyproj_log_function'.

https://github.com/nix-community/poetry2nix/issues/1645

Any ideas?

02:01:37
@vengmark2:matrix.org@vengmark2:matrix.org *

pyproj/_datadir.pyx:148:33: Cannot assign type 'void (void *, int, const char ) except * nogil' to 'PJ_LOG_FUNCTION' (alias of 'void ()(void *, int, const char *) noexcept nogil'). Exception values are incompatible. Suggest adding 'noexcept' to the type of 'pyproj_log_function'.

https://github.com/nix-community/poetry2nix/issues/1645

Any ideas?

Update: I've created a PR with the relevant failing test.

02:13:15
@checooh:matrix.orgchecooh joined the room.11:55:19
@x10an14:matrix.orgx10an14Anyone experienced "missing attribute" error recently? Wrt. `inputs.flake-utils.lib.eachDefaultSystem`. Once I made it follow my existing `flake-utils` input I get nix complaining about line 82 in poetry2nix's `flake.nix` on current `master` (`5a62572`). 12:27:23
@x10an14:matrix.orgx10an14
In reply to @x10an14:matrix.org
Anyone experienced "missing attribute" error recently? Wrt. `inputs.flake-utils.lib.eachDefaultSystem`. Once I made it follow my existing `flake-utils` input I get nix complaining about line 82 in poetry2nix's `flake.nix` on current `master` (`5a62572`).

Here's my flake.nix, stripped of non-Nix/poetry2nix related sturr:

{
  description = "A Nix-flake for poetry based python development ";

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

  outputs = {
    self,
    ...
  } @ inputs:
    inputs.flake-utils.lib.eachDefaultSystem (system: let
      pkgs = import inputs.nixpkgs {localSystem = {inherit system;};};
      inherit (inputs.poetry2nix.lib.mkPoetry2Nix { inherit pkgs; }) mkPoetryApplication;
      myapp = mkPoetryApplication {projectDir = self;};
    in {
      devShells.default = pkgs.mkShell {
        inputsFrom = [myapp];
        packages = with pkgs; [
          poetry
          (
            python3.withPackages (
              exts: [
                exts.ipython
              ]
            )
          )
        ];

        shellHook = ''
          ${pkgs.python3}/bin/python3 --version
          ${pkgs.poetry}/bin/poetry --version
        '';
      };
      packages = {
        inherit myapp;
      };
      packages.default = myapp;
    });
}
12:32:31
@x10an14:matrix.orgx10an14Screenshot from 2024-05-08 14-33-56.png
Download Screenshot from 2024-05-08 14-33-56.png
12:35:13
@truh:matrix.orgtruh
In reply to @x10an14:matrix.org

Here's my flake.nix, stripped of non-Nix/poetry2nix related sturr:

{
  description = "A Nix-flake for poetry based python development ";

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

  outputs = {
    self,
    ...
  } @ inputs:
    inputs.flake-utils.lib.eachDefaultSystem (system: let
      pkgs = import inputs.nixpkgs {localSystem = {inherit system;};};
      inherit (inputs.poetry2nix.lib.mkPoetry2Nix { inherit pkgs; }) mkPoetryApplication;
      myapp = mkPoetryApplication {projectDir = self;};
    in {
      devShells.default = pkgs.mkShell {
        inputsFrom = [myapp];
        packages = with pkgs; [
          poetry
          (
            python3.withPackages (
              exts: [
                exts.ipython
              ]
            )
          )
        ];

        shellHook = ''
          ${pkgs.python3}/bin/python3 --version
          ${pkgs.poetry}/bin/poetry --version
        '';
      };
      packages = {
        inherit myapp;
      };
      packages.default = myapp;
    });
}
You could try nixpkgs.follows = "poetry2nix/nixpkgs"; rather than the other way around.
12:42:20
@x10an14:matrix.orgx10an14
In reply to @truh:matrix.org
You could try nixpkgs.follows = "poetry2nix/nixpkgs"; rather than the other way around.

Thanks for taking a look @truh! Huhm...
I agree that there's a channel mismatch between the two...

But how do you figure it's related to the error message? I don't see anywhere there might be a reference to a flake-utils version missing https://github.com/numtide/flake-utils?tab=readme-ov-file#eachdefaultsystem--system---attrs.

12:48:23
@truh:matrix.orgtruh
  `inputs.flake-utils.follows = "nixpkgs";` this shouldn't follow nixpkgs
12:51:03
@x10an14:matrix.orgx10an14
In reply to @truh:matrix.org
You could try nixpkgs.follows = "poetry2nix/nixpkgs"; rather than the other way around.
Deleting inputs.poetry2nix.inputs.nixpkgs.follows = "nixpkgs"; had indeed zero effect.
12:51:05
@truh:matrix.orgtruh *
  `inputs.flake-utils.follows = "nixpkgs";` 

this shouldn't follow nixpkgs

12:51:25
@truh:matrix.orgtruh *
  inputs.flake-utils.follows = "nixpkgs";

this shouldn't follow nixpkgs

12:52:08
@x10an14:matrix.orgx10an14
In reply to @truh:matrix.org
  `inputs.flake-utils.follows = "nixpkgs";` this shouldn't follow nixpkgs
Derp, I've become blind to my own code... Thanks!
12:53:25

Show newer messages


Back to Room ListRoom Version: 6