我有一个shell.nix文件我在Python开发中使用的代码如下所示:
with import <nixpkgs> {};
((
python37.withPackages (ps: with ps; [
matplotlib
spacy
pandas
spacy_models.en_core_web_lg
plotly
])).override({ignoreCollisions=true; })).env
它对这些软件包工作得很好。问题是,我还想使用colormath,它似乎不在nixpkgs中。我怎样才能导入那个包裹?你知道吗
我可以用pypi2nix -V python3 -e colormath
生成一个requirements.nix
,我试着用如下方式导入它:
with import <nixpkgs> {};
let colormath = import ./requirements.nix { inherit pkgs; }
in ((
python37.withPackages (ps: with ps; [
matplotlib
spacy
...
colormath
])).override({ignoreCollisions=true; })).env
编辑:here's a gist of the output of requirements.nix。你知道吗
我也尝试过制作一个python包nix表达式,就像在Nixpkgs中一样,它似乎构建得很好:
{ buildPythonPackage
, fetchPypi
, networkx
, numpy
, lib
, pytest
}:
buildPythonPackage rec {
pname = "colormath";
version = "3.0.0";
src = fetchPypi {
inherit version;
inherit pname;
sha256 = "3d4605af344527da0e4f9f504fad7ddbebda35322c566a6c72e28edb1ff31217";
};
checkInputs = [ pytest ];
checkPhase = ''
pytest
'';
# Tests seem to hang
# doCheck = false;
propagatedBuildInputs = [ networkx numpy ];
meta = {
homepage = "https://github.com/gtaylor/python-colormath";
license = lib.licenses.bsd2;
description = "Color math and conversion library.";
};
}
(我甚至提出了一个pull请求。)但是我不知道如何将它导入到我的开发环境中。你知道吗
我还没走。有没有一种简单的方法来组合nixpkgs和非nixpkgs python模块?你知道吗
我确实解决了类似的问题:
可能还有改进的余地,但这对我很有效。你知道吗
相关问题 更多 >
编程相关推荐