!rWxyQqNqMUDLECdsIf:blad.is

Poetry2nix

319 Members
https://github.com/nix-community/poetry2nix63 Servers

Load older messages


SenderMessageTime
19 Jul 2024
@tyberius_prime:matrix.orgTyberiusPrime (smilodon inopinatus)but that one has me utterly stumped.13:47:48
@truh:matrix.orgtruhI wish there weren't so many python packages13:47:50
@oven_spinout988:matrix.orgoven_spinout988
In reply to @truh:matrix.org
For ModuleNotFoundError: No module named 'test.default', { include = "test" }, should be good enough
            Traceback (most recent call last):
              File "/nix/store/mbkyadwnalw99bbvcdfgw4gsjhpzxcgx-python3.12-test-0.0.0/bin/.start-wrapped", line 6, in <module>
                from bin.start import main
              File "/nix/store/mbkyadwnalw99bbvcdfgw4gsjhpzxcgx-python3.12-test-0.0.0/lib/python3.12/site-packages/bin/start.py", line 5, in <module>
                from test.default import get_homedir
            ModuleNotFoundError: No module named 'test.default'

Still the same error with : packages = [{ include = "test" }, { include = "bin" }]

13:48:27
@tyberius_prime:matrix.orgTyberiusPrime (smilodon inopinatus)
In reply to @tyberius_prime:matrix.org
but that one has me utterly stumped.
but I could do a wheel, so shrugh
13:52:20
@truh:matrix.orgtruh

what's that for

            ] ++ pkgs.lib.mapAttrsToList
              (name: value:
                pkgs.writers.writePython3Bin "${name}" { flakeIgnore = [ "E401" "E501" ]; } ''
                  import sys, importlib
                  mod, attr = "${value}".split(":", 1)
                  sys.exit(getattr(importlib.import_module(mod), attr)())
                ''
              )
              (builtins.fromTOML (builtins.readFile ./pyproject.toml)).tool.poetry.scripts;

mkPoetryApplication should create bins for the scripts

13:52:56
@oven_spinout988:matrix.orgoven_spinout988
In reply to @truh:matrix.org

what's that for

            ] ++ pkgs.lib.mapAttrsToList
              (name: value:
                pkgs.writers.writePython3Bin "${name}" { flakeIgnore = [ "E401" "E501" ]; } ''
                  import sys, importlib
                  mod, attr = "${value}".split(":", 1)
                  sys.exit(getattr(importlib.import_module(mod), attr)())
                ''
              )
              (builtins.fromTOML (builtins.readFile ./pyproject.toml)).tool.poetry.scripts;

mkPoetryApplication should create bins for the scripts

Found it in a Github issue. And it was efficient at the time I tested it to remove the bin error.
For what I can remember.

Without this part, I get the following error :

Traceback (most recent call last):
              File "/nix/store/mpn2dgz63imrk5j91ifk3y2nsq5mk9a2-python3.12-test-0.0.0/bin/.start-wrapped", line 6, in <module>
                from bin.start import main
            ModuleNotFoundError: No module named 'bin'
13:56:20
@oven_spinout988:matrix.orgoven_spinout988
In reply to @truh:matrix.org

what's that for

            ] ++ pkgs.lib.mapAttrsToList
              (name: value:
                pkgs.writers.writePython3Bin "${name}" { flakeIgnore = [ "E401" "E501" ]; } ''
                  import sys, importlib
                  mod, attr = "${value}".split(":", 1)
                  sys.exit(getattr(importlib.import_module(mod), attr)())
                ''
              )
              (builtins.fromTOML (builtins.readFile ./pyproject.toml)).tool.poetry.scripts;

mkPoetryApplication should create bins for the scripts

* Found it in a Github issue. And it was efficient at the time I tested it to remove the bin error.
For what I can remember.
13:58:40
@oven_spinout988:matrix.orgoven_spinout988 *

Found it in a Github issue. And it was efficient at the time I tested it to remove the bin error.
For what I can remember.

I removed it and sill get the error about test.default missing.

13:59:39
@oven_spinout988:matrix.orgoven_spinout988 *

Found it in a Github issue. And it was efficient at the time I tested it to remove the bin error.
For what I can remember.

EDIT truh :
I removed it and sill get the error about test.default missing.

13:59:55
@truh:matrix.orgtruhI think you can remove the other buildinputs in mkPoetryApplication too14:01:32
@truh:matrix.orgtruhmaybe pkgs.python3 screws the pythonpath or something14:01:48
@oven_spinout988:matrix.orgoven_spinout988

I just set it at the minimum level :

          testApp = mkPoetryApplication {
            projectDir = ./.;
            overrides = p2n-overrides;

            dependencies = [
              pkgs.redis
              pkgs.ffmpeg
            ];

          };

With the package inside the pyproject.toml, I have this error :

            Traceback (most recent call last):
              File "/nix/store/lbidxwnsm93j6v79hyrl0yvjylbdjd2w-python3.12-test-0.0.0/bin/.start-wrapped", line 6, in <module>
                from bin.start import main
              File "/nix/store/lbidxwnsm93j6v79hyrl0yvjylbdjd2w-python3.12-test-0.0.0/lib/python3.12/site-packages/bin/start.py", line 5, in <module>
                from test.default import get_homedir
            ModuleNotFoundError: No module named 'test.default'

And without :

            Traceback (most recent call last):
              File "/nix/store/ghhaa833nn30ck2y7w8nlq3nx5izvypj-python3.12-test-0.0.0/bin/.start-wrapped", line 6, in <module>
                from bin.start import main
            ModuleNotFoundError: No module named 'bin'
14:08:57
@oven_spinout988:matrix.orgoven_spinout988
In reply to @oven_spinout988:matrix.org

I just set it at the minimum level :

          testApp = mkPoetryApplication {
            projectDir = ./.;
            overrides = p2n-overrides;

            dependencies = [
              pkgs.redis
              pkgs.ffmpeg
            ];

          };

With the package inside the pyproject.toml, I have this error :

            Traceback (most recent call last):
              File "/nix/store/lbidxwnsm93j6v79hyrl0yvjylbdjd2w-python3.12-test-0.0.0/bin/.start-wrapped", line 6, in <module>
                from bin.start import main
              File "/nix/store/lbidxwnsm93j6v79hyrl0yvjylbdjd2w-python3.12-test-0.0.0/lib/python3.12/site-packages/bin/start.py", line 5, in <module>
                from test.default import get_homedir
            ModuleNotFoundError: No module named 'test.default'

And without :

            Traceback (most recent call last):
              File "/nix/store/ghhaa833nn30ck2y7w8nlq3nx5izvypj-python3.12-test-0.0.0/bin/.start-wrapped", line 6, in <module>
                from bin.start import main
            ModuleNotFoundError: No module named 'bin'

Not sure why it is not working in my test package. But in the original package specifying the packages inside the pyproject.tom worked well.

I have now errors complaining about Flask not present.
Do you know why the packages/libraries from the pyproject.toml are not present during run time ?

Anyway thank you for your attention and idea to fix my issue.

14:41:45
@notwren:matrix.orgnotwren
In reply to @picog:matrix.org

I have some thing like

        devShells.a = pkgs.mkShell {
          packages = with pkgs; [
            (mkPoetryEnv {
              projectDir = a/.;
              python=pkgs.python39;
            })
          ];
        };

        devShells.b = pkgs.mkShell {
          packages = with pkgs; [
            (mkPoetryEnv {
              projectDir = b/.;
              python=pkgs.python39;
            })
          ];
        };
I'm not seeing any reference to b in the a devShell here or vice versa?
15:12:00
@oven_spinout988:matrix.orgoven_spinout988 Is normal the normal to use the mkPoetryApplication and use is in a flake output for packages.default ? 16:44:48
@oven_spinout988:matrix.orgoven_spinout988 * Is the normal usage of the mkPoetryApplication to use is in a flake output for packages.default ? 16:45:10
22 Jul 2024
@brokenpip3:matrix.org@brokenpip3:matrix.org left the room.07:46:10
@notwren:matrix.orgnotwrenis there a reason that bumping poetry2nix would have made it now use python3.12 instead of 3.11? the pyproject is set to "^3.11"19:27:35
@notwren:matrix.orgnotwren

for anyone else that has the same problem, you can fix with:

19:30:47
@notwren:matrix.orgnotwren *

for anyone else that has the same problem, you can fix with:

        devShells.default = let 
            envShell = mkPoetryEnv {
              projectDir = ./.;
              python = pkgs.python311;
              overrides = p2n-overrides;
              preferWheels = true;
              editablePackageSources = {
                xoulschemas = xoulschemas/.;
              };
            }; 

19:31:34
@notwren:matrix.orgnotwren *

for anyone else that has the same problem, you can fix with:

        devShells.default = let 
            envShell = mkPoetryEnv {
              projectDir = ./.;
              python = pkgs.python311;
              overrides = p2n-overrides;
              preferWheels = true;
              editablePackageSources = {
                x = x/.;
              };
            }; 

19:31:46
24 Jul 2024
@truh:matrix.orgtruhNewer nixpkgs probably. 3.12 is the default on unstable08:47:07
@lambadada:matrix.orglambadada

I'm trying to set up a python enviroment with poetry2nix. I need to override a package rpds-py to make it function correctly. It already has a override at line 3082 to 3147 in overrides/default.nix But that doesn't have the hash to the latest version. How do I force it to use the correct hash for the latest release?
I know it's a simple override, but everything I try fails to set the hash to what it should be.

I'm trying the following:

{rpds-py = prev.rpds-py.overridePythonAttrs (old: {
          cargoDeps = nixpkgs.rustPlatform.fetchCargoTarball {
            inherit (old) src;
            name = "${old.pname}-${old.version}";
            hash = "sha256-qIXdoCEVGCGUnTicZp4bUTJyGpFy9dwWY03lXUbxiHg=";
          };
          buildInputs = old.buildInputs or [ ] ;
          nativeBuildInputs = old.nativeBuildInputs or [ ] ++ [
            nixpkgs.rustPlatform.cargoSetupHook
            nixpkgs.rustPlatform.maturinBuildHook
          ];
        });
      }
23:07:02
@lambadada:matrix.orglambadada *

I need to override a package rpds-py for my latest project. It already has a override at line 3082 to 3147 in overrides/default.nix But that doesn't have the hash to the latest version. How do I force it to use the correct hash for the latest release?
I know it's a simple override, but everything I try fails to set the hash to what it should be.

I'm trying the following:

{rpds-py = prev.rpds-py.overridePythonAttrs (old: {
          cargoDeps = nixpkgs.rustPlatform.fetchCargoTarball {
            inherit (old) src;
            name = "${old.pname}-${old.version}";
            hash = "sha256-qIXdoCEVGCGUnTicZp4bUTJyGpFy9dwWY03lXUbxiHg=";
          };
          buildInputs = old.buildInputs or [ ] ;
          nativeBuildInputs = old.nativeBuildInputs or [ ] ++ [
            nixpkgs.rustPlatform.cargoSetupHook
            nixpkgs.rustPlatform.maturinBuildHook
          ];
        });
      }
23:07:48
25 Jul 2024
@ezzobirbezziou:matrix.orgEzzobir Bezziou joined the room.08:52:30
@tcsavage:matrix.orgTom Savage joined the room.14:30:23
@virtu:matrix.imvirtu joined the room.17:58:25
@virtu:matrix.imvirtu

Hey! I'm wondering how to correctly set up a devShell using poetry2nix. Previously, I was using:

      devShells.default = pkgs.mkShell {
        packages = with pkgs; [ poetry ];
        LD_LIBRARY_PATH = "${pkgs.stdenv.cc.cc.lib}/lib/";
      };

together with

PYTHON_VERSION=$(python --version | awk '{print $2}' | cut -d. -f1-2 | tr -d '\n')
export PYTHONPATH=$PYTHONPATH:$(poetry env info --path)/lib/python${PYTHON_VERSION}/site-packages

in my .envrc, but I was hoping to get the same effect more gracefully using mkPoetryEnv, so I tried:

      devShells.default = mkPoetryEnv {
        projectDir = ./.;
      };

but for some reason the dependencies aren't available:

» grep pandas pyproject.toml
pandas = "2.1.3"

» python -c "import pandas"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
ModuleNotFoundError: No module named 'pandas'

Any idea what I'm doing wrong?

18:02:10
26 Jul 2024
@tcsavage:matrix.orgTom Savage changed their display name from tcsavage to Tom Savage.08:22:07
@tcsavage:matrix.orgTom Savage set a profile picture.08:23:32

Show newer messages


Back to Room ListRoom Version: 6