python3Packages.fava-portfolio-returns: init at 2.3.0 (#461734)

This commit is contained in:
Sandro
2026-01-02 20:03:17 +00:00
committed by GitHub
2 changed files with 99 additions and 0 deletions
@@ -0,0 +1,97 @@
{
lib,
buildPythonPackage,
buildNpmPackage,
fetchFromGitHub,
stdenv,
fava,
hatch-vcs,
hatchling,
numpy,
pandas,
protobuf,
pytestCheckHook,
scipy,
}:
let
pname = "fava-portfolio-returns";
version = "2.3.0";
src = fetchFromGitHub {
owner = "andreasgerstmayr";
repo = "fava-portfolio-returns";
rev = "v${version}";
hash = "sha256-NM+0gcgSztcgzYj0nCe9DOK90lrzE0TOzH30WvTKsUA=";
};
frontend = buildNpmPackage (finalAttrs: {
pname = "${pname}-frontend";
inherit version;
src = "${src}/frontend";
npmDepsHash = "sha256-MDoZC5IAR9puWMLBhLb5HRoagBPyNiyJ+0879ljCNUo=";
postPatch = ''
substituteInPlace package.json \
--replace-fail '"name": "fava-portfolio-returns",' '"name": "fava-portfolio-returns", "version": "${finalAttrs.version}",'
'';
installPhase = ''
runHook preInstall
mkdir -p $out
cp ../src/fava_portfolio_returns/FavaPortfolioReturns.js $out/
runHook postInstall
'';
});
in
buildPythonPackage {
inherit pname version src;
pyproject = true;
build-system = [
hatchling
hatch-vcs
];
dependencies = [
fava
numpy
pandas
protobuf
scipy
];
preInstall = ''
cp ${frontend}/FavaPortfolioReturns.js src/fava_portfolio_returns/
'';
nativeCheckInputs = [ pytestCheckHook ];
pythonImportsCheck = [ "fava_portfolio_returns" ];
# Stay in the root of the repository, so that relative paths to example files
# loaded by tests stay correct.
# Remove `src` to avoid `PYTHONPATH` issues related to `pytestCheckHook` ([1])
# [1]: https://github.com/NixOS/nixpkgs/issues/255262
preCheck = ''
rm -rf src
'';
pytestFlags = [
"${placeholder "out"}"
];
passthru = {
inherit frontend;
};
meta = {
description = "Show portfolio returns in Fava";
homepage = "https://github.com/andreasgerstmayr/fava-portfolio-returns";
changelog = "https://github.com/andreasgerstmayr/fava-portfolio-returns/blob/main/CHANGELOG.md";
license = lib.licenses.gpl2Only;
maintainers = with lib.maintainers; [ ambroisie ];
};
}
+2
View File
@@ -5328,6 +5328,8 @@ self: super: with self; {
fava-investor = callPackage ../development/python-modules/fava-investor { };
fava-portfolio-returns = callPackage ../development/python-modules/fava-portfolio-returns { };
favicon = callPackage ../development/python-modules/favicon { };
fe25519 = callPackage ../development/python-modules/fe25519 { };