12 Oct 2024 |
laurents | In reply to @k900:0upti.me We try to normalize it across the ecosystem good to keep in mind then. Thanks! | 15:35:47 |
13 Oct 2024 |
virtu | is there anything special I need to pay attention to if I want to use poetry2nix to create a package that I can import after installing via flake? for some reason, the package is not in the site-packages of the system-wide python env and I can't import it. I have packages = [{ include = "mypkg", from="src" }] in my pyprojects.toml and am using regular mkPoetryApplication. It works in a devShell, but not system-wide when using something like python311.withPackages(ps: [ps.someNixPkgsPackage myflake.packages.${system}.default ])` | 16:03:13 |
virtu | * is there anything special I need to pay attention to if I want to use poetry2nix to create a package that I can import after installing via flake? for some reason, the package is not in the site-packages of the system-wide python env and I can't import it. I have packages = [{ include = "mypkg", from="src" }] in my pyprojects.toml and am using regular mkPoetryApplication. It works in a devShell, but not system-wide when using something likepython311.withPackages(ps: \[ps.someNixPkgsPackage myflake.packages.${system}.default \])\ | 16:04:13 |
15 Oct 2024 |
| nate5824 joined the room. | 21:33:26 |
nate5824 | Hello, I'm trying to use P2N to get a development environment for Langchain https://github.com/langchain-ai/langchain.
I have a simple env:
myenv = { poetry2nix, lib }: poetry2nix.mkPoetryEnv {
projectDir = self;
preferWheels = true;
}
and I get this error:
error: attribute 'override' missing
at /nix/store/x946wzivanqfxs1dpyai49wfwmj1mimy-source/overrides/default.nix:3851:20:
3850| # the complexity manageable for now.
3851| tokenizers = prev.tokenizers.override {
| ^
3852| preferWheel = true;
| 21:34:37 |
nate5824 | * Hello, I'm trying to use P2N to get a development environment for Langchain https://github.com/langchain-ai/langchain.
I have a simple env as a flake.nix in the root of the Langchain repo (using that pyproject/poetry.toml):
myenv = { poetry2nix, lib }: poetry2nix.mkPoetryEnv {
projectDir = self;
preferWheels = true;
}
and I get this error:
error: attribute 'override' missing
at /nix/store/x946wzivanqfxs1dpyai49wfwmj1mimy-source/overrides/default.nix:3851:20:
3850| # the complexity manageable for now.
3851| tokenizers = prev.tokenizers.override {
| ^
3852| preferWheel = true;
| 21:34:58 |
nate5824 | I only added preferWheels = true for maturin but supposedly there's already an override for that in p2n? | 21:59:19 |
nate5824 | ModuleNotFoundError: No module named 'maturin' | 22:05:41 |
16 Oct 2024 |
| loudgolem joined the room. | 02:30:30 |
Artturin | In reply to @nate5824:matrix.org
Hello, I'm trying to use P2N to get a development environment for Langchain https://github.com/langchain-ai/langchain.
I have a simple env as a flake.nix in the root of the Langchain repo (using that pyproject/poetry.toml):
myenv = { poetry2nix, lib }: poetry2nix.mkPoetryEnv {
projectDir = self;
preferWheels = true;
}
and I get this error:
error: attribute 'override' missing
at /nix/store/x946wzivanqfxs1dpyai49wfwmj1mimy-source/overrides/default.nix:3851:20:
3850| # the complexity manageable for now.
3851| tokenizers = prev.tokenizers.override {
| ^
3852| preferWheel = true;
Weird, override exists for it on unstable and nixos-24.05
nix-repl> python3Packages.tokenizers.override
{ __functionArgs = { ... }; __functor = «lambda @ /home/artturin/nixpkgs/lib/trivial.nix:895:19»; }
| 04:28:53 |
loudgolem | maybe offtopic but I have the same error with override with home-manager with https://github.com/nix-community/home-manager/pull/5930 when I do nix build .#test-espanso-basic-configuration
error: attribute 'override' missing
at /nix/store/60sn02zhawl3kwn0r515zff3h6hg6ydz-source/pkgs/top-level/all-packages.nix:4867:21:
4866| };
4867| espanso-wayland = espanso.override {
| ^
4868| x11Support = false;
| 04:31:02 |
loudgolem | * maybe offtopic and/or unrelated but I have the same error with override with home-manager with https://github.com/nix-community/home-manager/pull/5930 when I do nix build .#test-espanso-basic-configuration
error: attribute 'override' missing
at /nix/store/60sn02zhawl3kwn0r515zff3h6hg6ydz-source/pkgs/top-level/all-packages.nix:4867:21:
4866| };
4867| espanso-wayland = espanso.override {
| ^
4868| x11Support = false;
| 04:31:45 |
loudgolem | * maybe offtopic and/or unrelated but I have the same error with override with home-manager with https://github.com/nix-community/home-manager/pull/5930 when I do nix build .#test-espanso-basic-configuration
error: attribute 'override' missing
at /nix/store/60sn02zhawl3kwn0r515zff3h6hg6ydz-source/pkgs/top-level/all-packages.nix:4867:21:
4866| };
4867| espanso-wayland = espanso.override {
| ^
4868| x11Support = false;
| 04:32:11 |
Artturin | In reply to @artturin:matrix.org
Weird, override exists for it on unstable and nixos-24.05
nix-repl> python3Packages.tokenizers.override
{ __functionArgs = { ... }; __functor = «lambda @ /home/artturin/nixpkgs/lib/trivial.nix:895:19»; }
Oh yeah poetry2nix doesn't use those | 04:32:51 |
Artturin | I think | 04:33:55 |
Artturin | I wonder if this works https://github.com/nix-community/poetry2nix/blob/8a18db56dd62edd26458a87e4d335b7df84c3f3f/overrides/default.nix#L884 | 04:34:09 |
Artturin | Maybe missing a lib.makeOverridable call somewhere | 04:34:34 |
Artturin | In reply to @phanirithvij:matrix.org
maybe offtopic and/or unrelated but I have the same error with override with home-manager with https://github.com/nix-community/home-manager/pull/5930 when I do nix build .#test-espanso-basic-configuration
error: attribute 'override' missing
at /nix/store/60sn02zhawl3kwn0r515zff3h6hg6ydz-source/pkgs/top-level/all-packages.nix:4867:21:
4866| };
4867| espanso-wayland = espanso.override {
| ^
4868| x11Support = false;
Not using callPackage (which applies makeOverridable) or makeOverridable will cause override to be missing
callPackage is used so neither of those are the problem https://github.com/NixOS/nixpkgs/blob/6e918e75e8bed152f24787aaad718649dc1963fe/pkgs/top-level/all-packages.nix#L4858 | 04:43:34 |
Artturin | Wrong room anyways, I looked and couldn't see the problem. | 04:54:07 |
| akshaykarle joined the room. | 09:56:30 |
18 Oct 2024 |
| @kritnich:kritni.ch left the room. | 11:01:03 |
19 Oct 2024 |
| opacity=0 joined the room. | 15:07:29 |
20 Oct 2024 |
laurents | Hello! I'm trying to package a python app into a docker image with poetry2nix and then streamLayeredImage . I'm struggling to get my own code into the result. My code is organised like:
+ my_project
|- + ofd_runner
| | ...
| pyproject.toml
| poetry.lock
| flake.nix
In flake.nix I do:
myEnv = pkgs.poetry2nix.mkPoetryEnv {
projectDir = ./.;
preferWheels = true;
};
dockerImage = pkgs.docker.streamLayeredImage {
name = "ofd_user_code";
tag = "latest";
contents = [
pkgs.bash
pkgs.coreutils
ofdUserCodeEnv
];
config = {
Cmd = [
"${myEnv}/bin/dagster"
"api"
"grpc"
"-h"
"0.0.0.0"
"-p"
"4000"
"-m"
"ofd_runner"
];
Env = [
"DAGSTER_HOME=${dagsterHome}"
];
WorkingDir = "${myEnv}/lib/python3.11/site-packages";
};
In pyproject.toml , I have a set of dependencies which end up in my docker image, I can do import polars in the python in that docker image, but import ofd_runner won't work. Why is that? How do I get my own code in ofd_runner to land in my image? | 19:19:23 |
laurents | In reply to @laurents:fsfe.org
Hello! I'm trying to package a python app into a docker image with poetry2nix and then streamLayeredImage . I'm struggling to get my own code into the result. My code is organised like:
+ my_project
|- + ofd_runner
| | ...
| pyproject.toml
| poetry.lock
| flake.nix
In flake.nix I do:
myEnv = pkgs.poetry2nix.mkPoetryEnv {
projectDir = ./.;
preferWheels = true;
};
dockerImage = pkgs.docker.streamLayeredImage {
name = "ofd_user_code";
tag = "latest";
contents = [
pkgs.bash
pkgs.coreutils
ofdUserCodeEnv
];
config = {
Cmd = [
"${myEnv}/bin/dagster"
"api"
"grpc"
"-h"
"0.0.0.0"
"-p"
"4000"
"-m"
"ofd_runner"
];
Env = [
"DAGSTER_HOME=${dagsterHome}"
];
WorkingDir = "${myEnv}/lib/python3.11/site-packages";
};
In pyproject.toml , I have a set of dependencies which end up in my docker image, I can do import polars in the python in that docker image, but import ofd_runner won't work. Why is that? How do I get my own code in ofd_runner to land in my image? apparently I had to use mkPoetryApplication and then use .dependencyEnv to get my code in there. | 22:56:03 |
21 Oct 2024 |
| adrblo joined the room. | 14:36:10 |
opacity=0 | Hi, I am trying to package a python package using poetry2nix. Unfortunately i need to override both the buildInputs and one of the dependencies. I am following the relevant edge cases documentation, however I am stuck with the error error: value is a set while a list was expected . I presume this is because defaultPoetryOverrides.extend and overrides.withDefaults do not work together. Has anyone encountered this issue before? | 14:39:28 |
opacity=0 | This is the corresponding flake:
description = "SMURFS";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
poetry2nix.url = "github:nix-community/poetry2nix";
};
outputs = { self, nixpkgs, poetry2nix }:
let
system = "x86_64-linux";
pkgs = nixpkgs.legacyPackages.${system};smurfs =
let
inherit (poetry2nix.lib.mkPoetry2Nix { inherit pkgs; }) defaultPoetryOverrides overrides mkPoetryApplication;
pypkgs-build-requirements = {
lightkurve = [ "setuptools" ];
fbpca = [ "setuptools" ];
memoization = [ "setuptools" ];
};
p2n-overrides = defaultPoetryOverrides.extend
(final: prev:
builtins.mapAttrs
(package: build-requirements:
(builtins.getAttr package prev).overridePythonAttrs (old: {
buildInputs = (old.buildInputs or [ ]) ++
(builtins.map
(pkg:
if builtins.isString pkg
then builtins.getAttr pkg prev
else pkg)
build-requirements);
}))
pypkgs-build-requirements
);
lightkurve-override = final: prev: {
lightkurve = prev.lightkurve.overridePythonAttrs
(old: rec {
version = "2.5.0";
src = prev.pkgs.fetchFromGitHub {
owner = "Alpha-Ursae-Minoris";
repo = "lightkurve";
rev = "1ec6609da1bd980883593ac1a6354639310f773c";
hash = "sha256-6/2CiQ1DMTIX4XV+WkeyI6uBKe032VZ4kHU3FSHhie8=";
};
});
};
combined-overrides = p2n-overrides ++ lightkurve-override;
in
mkPoetryApplication
{
projectDir = ./.;
overrides = overrides.withDefaults combined-overrides;
#preferWheels = true;
};
in
{
apps.${system}.default = {
type = "app";
# Replace <script> with the name in the [tool.poetry.scripts] section of your pyproject.toml
program = "${smurfs}/bin/<smurfs>";
};
};
}
| 14:41:04 |
opacity=0 | * This is the corresponding flake:
description = "SMURFS";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
poetry2nix.url = "github:nix-community/poetry2nix";
};
outputs = { self, nixpkgs, poetry2nix }:
let
system = "x86_64-linux";
pkgs = nixpkgs.legacyPackages.${system};
smurfs =
let
inherit (poetry2nix.lib.mkPoetry2Nix { inherit pkgs; }) defaultPoetryOverrides overrides mkPoetryApplication;
pypkgs-build-requirements = {
lightkurve = [ "setuptools" ];
fbpca = [ "setuptools" ];
memoization = [ "setuptools" ];
};
p2n-overrides = defaultPoetryOverrides.extend
(final: prev:
builtins.mapAttrs
(package: build-requirements:
(builtins.getAttr package prev).overridePythonAttrs (old: {
buildInputs = (old.buildInputs or [ ]) ++
(builtins.map
(pkg:
if builtins.isString pkg
then builtins.getAttr pkg prev
else pkg)
build-requirements);
}))
pypkgs-build-requirements
);
lightkurve-override = final: prev: {
lightkurve = prev.lightkurve.overridePythonAttrs
(old: rec {
version = "2.5.0";
src = prev.pkgs.fetchFromGitHub {
owner = "Alpha-Ursae-Minoris";
repo = "lightkurve";
rev = "1ec6609da1bd980883593ac1a6354639310f773c";
hash = "sha256-6/2CiQ1DMTIX4XV+WkeyI6uBKe032VZ4kHU3FSHhie8=";
};
});
};
combined-overrides = p2n-overrides ++ lightkurve-override;
in
mkPoetryApplication
{
projectDir = ./.;
overrides = overrides.withDefaults combined-overrides;
#preferWheels = true;
};
in
{
apps.${system}.default = {
type = "app";
# Replace <script> with the name in the [tool.poetry.scripts] section of your pyproject.toml
program = "${smurfs}/bin/<smurfs>";
};
};
}
| 14:42:14 |
| @ersei:ersei.net left the room. | 14:53:00 |
| adrblo set a profile picture. | 15:08:59 |