Question of packaging python package with poetry and Makefile

I am trying to package GitHub - langchain-ai/langchainplus-sdk: LangChainPlus Client Implementations as a python package. The unusual thing here is that it relies on Makefile which in turn calls poetry (the command) to build. As of 23.05, the only dependency I can introduce in packaging a python package is poetry-core which does not come with the binary bin/poetry. This makes my current attempt (see below) fail:

{ lib
, buildPythonPackage
, fetchFromGitHub
, poetry-core
, pydantic
, requests
, tenacity
}:

buildPythonPackage rec {
  pname = "langchainplus-sdk";
  version = "0.0.17";

  src = fetchFromGitHub {
    owner = "langchain-ai";
    repo = "langchainplus-sdk";
    rev = "v${version}";
    hash = "sha256-yeMNAsAcAU91qPwmv268ikZ7EHzW00c0nt1Zj8AJzgo=";
  };

  sourceRoot = "source/python";

  format = "pyptorject";

  nativeBuildInputs = [
    poetry-core
  ];

  propagatedBuildInputs = [
    pydantic
    requests
    tenacity
  ];

  doCheck = false;
}

Can anyone more familiar with python package give some insights?

Thanks a lot!

poetry is a top-level package, so you should be able to include it. Just replace poetry-core with poetry.

Also, you’ve got a misspelling: pyptorject should be pyproject.

Ah yep, the problem is actually I mispelled pyproject. Thanks!

As for poetry, I think starting from 23.05, putting poetry in nativeBuildInput is prohibited.

Ok, that makes sense. I’m glad you got it figured out!

1 Like