nixpkgs/pkgs/development/python-modules/prophet/default.nix
Yueh-Shun Li 91b3db1309 treewide: fix sourceRoot for fetchgit-based src
According to Nixpkgs manual[1] and NixOS 23.11 Release Note[2], the
`sourceRoot` attribute passed to `stdenv.mkDerivation` should be
specified as `"${src.name}"` or `"${src.name}/subdir"` when `src` is
produced using `fetchgit`-based fetchers.

`sourceRoot = "source"` or `sourceRoot = "source/subdir"` is based on
the assumption that the `name` attribute of these pre-unpacked fetchers
are always `"source"`, which is not the case. Expecting constant `name`
also makes the source FODs prone to irrelevent hashes during version
bumps.

[1]: https://nixos.org/manual/nixpkgs/unstable/#var-stdenv-sourceRoot
[2]: https://nixos.org/manual/nixos/stable/release-notes#sec-release-23.11
2024-03-09 07:53:25 +08:00

71 lines
1.4 KiB
Nix

{ lib
, buildPythonPackage
, pythonOlder
, fetchFromGitHub
, setuptools
, cmdstanpy
, numpy
, matplotlib
, pandas
, holidays
, tqdm
, importlib-resources
, dask
, distributed
, pytestCheckHook
}:
buildPythonPackage rec {
pname = "prophet";
version = "1.1.5";
pyproject = true;
disabled = pythonOlder "3.7";
src = fetchFromGitHub {
owner = "facebook";
repo = "prophet";
rev = version;
hash = "sha256-liTg5Hm+FPpRQajBnnJKBh3JPGyu0Hflntf0isj1FiQ=";
};
sourceRoot = "${src.name}/python";
env.PROPHET_REPACKAGE_CMDSTAN = "false";
nativeBuildInputs = [ setuptools ];
propagatedBuildInputs = [
cmdstanpy
numpy
matplotlib
pandas
holidays
tqdm
importlib-resources
];
passthru.optional-dependencies.parallel = [ dask distributed ] ++ dask.optional-dependencies.dataframe;
preCheck = ''
# use the generated files from $out for testing
mv prophet/tests .
rm -r prophet
'';
nativeCheckInputs = [ pytestCheckHook ];
pythonImportsCheck = [ "prophet" ];
meta = {
changelog = "https://github.com/facebook/prophet/releases/tag/${src.rev}";
description = "A tool for producing high quality forecasts for time series data that has multiple seasonality with linear or non-linear growth";
homepage = "https://facebook.github.io/prophet/";
license = lib.licenses.mit;
maintainers = with lib.maintainers; [ tomasajt ];
};
}