11 Jun 2024 |
TyberiusPrime (smilodon inopinatus) | where's that specified hash even coming from... | 08:00:34 |
TyberiusPrime (smilodon inopinatus) | (ok, changing the hash that's in poetry.lock does change the specified hash...) | 08:02:57 |
TyberiusPrime (smilodon inopinatus) | seems it's the to_base32(to_sri(poetry.lock-hash that starts with sha256)) | 08:03:26 |
TyberiusPrime (smilodon inopinatus) | it's gone away... maybe it was just a pypi fluke... | 08:09:05 |
TyberiusPrime (smilodon inopinatus) | or maybe not. hm. | 08:10:29 |
TyberiusPrime (smilodon inopinatus) | I think it's a bug. poetry2nix appears to be using the 'fetchzip' unpacked&recursive hash, while poetry specifies the hash of the tar.gz - https://github.com/nix-community/poetry2nix/issues/1695 | 08:29:33 |
| Óli joined the room. | 12:22:36 |
Óli | In reply to @jameswarren-582a7124d73408ce4f35e991:gitter.im However, this seems messy and error-prone to declare the same intention in multiple places. Reading the docs for mkPoetryEnv, the comment on editablePackageSources suggests that declaring develop = true in the pyproject.toml should install utils as editable, but empirically testing it does not. Am I misunderstanding how it should be used? I'm having similar issues. Are you using a flake for your project? | 16:30:51 |
12 Jun 2024 |
jameswarren (James Warren) | Yes I am. Looking at the source code, it looks somewhat understandable - I was planning on spending more time pondering it to either understand how it's to be used or how I could modify it. It's not my most pressing problem at the moment, though. 🤷 | 03:53:45 |
13 Jun 2024 |
| ixxie joined the room. | 08:18:15 |
ixxie | Hey folks, I'm new to poetry2nix and trying to get my first flake going for a python backend in a monorepo.
The flake quickstart example has a default app output as follows:
apps.${system}.default = {
type = "app";
program = "${myapp}/bin/some_script";
};
But I would like to output multiple scripts as different commands. How would I go about it? I thought I could just do apps.${system}.command_name but it complains:
error: flake 'git+file:///home/ixxie/myapp?dir=backend' does not provide attribute 'packages.x86_64-linux.default' or 'defaultPackage.x86_64-linux
| 08:20:09 |
ixxie | ah right, need to run it as an app, not build it | 08:37:21 |
ixxie | I'm not sure what to make of this... here is the flake for the backend (it's in ${monorepo}/backend ):
{
description = "MyApp Backend - Python, Uvicorn & FastAPI";
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};
# create a custom "mkPoetryApplication" API function that under the hood uses
# the packages and versions (python3, poetry etc.) from our pinned nixpkgs above:
inherit (poetry2nix.lib.mkPoetry2Nix { inherit pkgs; }) mkPoetryApplication;
myapp = mkPoetryApplication { projectDir = ./.; };
in
{
apps.${system}.backend = {
type = "app";
program = "${myapp}/bin/backend";
};
};
}
But I get the following error:
warning: Git tree '/home/ixxie/myapp' is dirty
error:
… while calling a functor (an attribute set with a '__functor' attribute)
at /nix/store/lpqygnph8c5l7ajkmqr4rff0pvkfz1f6-source/default.nix:407:13:
406|
407| app = py.pkgs.buildPythonPackage (
| ^
408| passedAttrs // inputAttrs // {
… while evaluating a branch condition
at /nix/store/dydg48djlykksz8cxq0xjplyxpa9pvf4-source/pkgs/development/interpreters/python/python-packages-base.nix:28:7:
27| in
28| if builtins.isAttrs result then result
| ^
29| else if builtins.isFunction result then {
(stack trace truncated; use '--show-trace' to show the full, detailed trace)
error: expected a set but found null: null
| 08:44:08 |
ixxie | How do I control the name of the package created with mkPoetryApplication and installed with nix profile install ? | 11:29:47 |
TyberiusPrime (smilodon inopinatus) | In reply to @ixxie:matrix.org How do I control the name of the package created with mkPoetryApplication and installed with nix profile install ? I thought it was taken from pyproject.toml? the source indicate that this is true | 12:08:17 |
TyberiusPrime (smilodon inopinatus) | adisbladis: Hi, are you still working on poetry2nix? | 12:09:01 |
TyberiusPrime (smilodon inopinatus) | ixxie: I think you just call mkPoetryApplication and then they're all in ./results/bin | 12:09:58 |
ixxie | In reply to @tyberius_prime:matrix.org I thought it was taken from pyproject.toml? the source indicate that this is true I've set the name in pyproject.toml , and set pname in mkPoetryApplication but when I run nix profile install .#package-name but then I still get something like this:
> nix profile list
Name: path/from/git/root/to/flake
Flake attribute: packages.x86_64-linux.default
Original flake URL: git+file:///home/ixxie/project?dir=path/from/git/root/to/flake
Locked flake URL: git+file:///home/ixxie/project?dir=path/from/git/root/to/flake
Store paths: /nix/store/4r112qhr7f3vsxj3jx4ynvyb8560vjxf-python3.11-cli-0.1
| 12:15:12 |
ixxie | I mean it installs well, I'm just wondering why the name is like this | 12:16:43 |
TyberiusPrime (smilodon inopinatus) | well, the name (pname + version) ends up in the store path, which I giuess is where the python3.11-cli comes from (cli being set in your pyproject.toml).
I suppose you want to change 'Name:'? | 12:16:49 |
ixxie | In reply to @tyberius_prime:matrix.org well, the name (pname + version) ends up in the store path, which I giuess is where the python3.11-cli comes from (cli being set in your pyproject.toml).
I suppose you want to change 'Name:'? yep, because that would be how I refer to it when managing it with nix profile | 12:17:18 |
TyberiusPrime (smilodon inopinatus) | (I don't use nix profile, so I can't comment on where it's getting the name from.) | 12:17:30 |
TyberiusPrime (smilodon inopinatus) | I mean you can change the flake attribute easily enough, so 'flake attribute' is something you could change, at the price of having to do nix profile install /path/to/flake#name | 12:18:41 |
ixxie | In reply to @tyberius_prime:matrix.org I mean you can change the flake attribute easily enough, so 'flake attribute' is something you could change, at the price of having to do nix profile install /path/to/flake#name yeah the attribute hasn't been an issue | 12:24:42 |
ixxie | thanks anyway | 12:24:45 |
TyberiusPrime (smilodon inopinatus) | no worries | 12:26:41 |
15 Jun 2024 |
| @roastedcheesee:matrix.org joined the room. | 17:32:41 |
@roastedcheesee:matrix.org | hey, how can I override the generated inputs in mkPoetryApplication ? I know I can override the dependencies but I can't manage to add inputs to the package itself
mkPoetryApplication {
projectDir = src;
patches = [ ./salmon.patch ];
overrides = defaultPoetryOverrides.extend (self: super: {
bencoder-pyx = super.bencoder-pyx.overridePythonAttrs (old: {
buildInputs = (old.buildInputs or []) ++ [ super.setuptools super.cython ];
});
pyimgurapi = super.pyimgurapi.overridePythonAttrs (old: {
buildInputs = (old.buildInputs or []) ++ [ super.poetry ];
});
heybrochecklog = super.heybrochecklog.overridePythonAttrs (old: {
patches = (old.patches or []) ++ [ ./salmon.patch ]; # ffs
buildInputs = (old.buildInputs or []) ++ [ super.setuptools super.poetry ];
});
dottorrent = super.dottorrent.overridePythonAttrs (old: {
buildInputs = (old.buildInputs or []) ++ [ super.setuptools ];
});
bs4 = super.bs4.overridePythonAttrs (old: {
buildInputs = (old.buildInputs or []) ++ [ super.setuptools ];
});
pyimgur = super.pyimgur.overridePythonAttrs (old: {
buildInputs = (old.buildInputs or []) ++ [ super.setuptools ];
});
});
};
this is what I have so far, I tried overriding it together with the other dependencies but it had no effect
| 17:36:02 |
18 Jun 2024 |
| Josefine changed their display name from Jonas Katzke to Josefine. | 07:32:34 |
20 Jun 2024 |
TyberiusPrime (smilodon inopinatus) | Poetry2nix is IDF, right? how do I get a dependency on that IDF?
I'm trying a wild thing, where I teach poetry mercurial by prefetching the mercurial repo (&rev) into the nix store, and rewriting the lock files a bit, but I can only build it in impure mode since even if I stick the fetchhg into the build inputs of the python package, that's not there when poetry2nix does it's thing (and why would it...) | 09:10:10 |