summaryrefslogtreecommitdiff
path: root/pkgs/development/python-modules/cma/default.nix
blob: 23e532bee1089f9280fe1073f932ae0433ff5da7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
{
  lib,
  buildPythonPackage,
  fetchFromGitHub,

  # build-system
  setuptools,

  # dependencies
  numpy,

  # tests
  python,
}:

buildPythonPackage rec {
  pname = "cma";
  version = "4.4.1";
  pyproject = true;

  src = fetchFromGitHub {
    owner = "CMA-ES";
    repo = "pycma";
    tag = "r${version}";
    hash = "sha256-06QPs2hbrIbrPRWidlZYf0jcMGdcDYfg89Ad+4IX/Co=";
  };

  # setuptools.errors.PackageDiscoveryError:
  # Multiple top-level packages discovered in a flat-layout: ['cma', 'notebooks'].
  postPatch = ''
    rm -rf notebooks
  '';

  build-system = [ setuptools ];

  dependencies = [ numpy ];

  pythonImportsCheck = [ "cma" ];

  # At least one doctest fails, thus only limited amount of files is tested
  checkPhase = ''
    ${python.executable} -m cma.test \
      interfaces.py \
      purecma.py \
      logger.py \
      optimization_tools.py \
      transformations.py
  '';

  meta = {
    description = "Library for Covariance Matrix Adaptation Evolution Strategy for non-linear numerical optimization";
    homepage = "https://github.com/CMA-ES/pycma";
    changelog = "https://github.com/CMA-ES/pycma/releases/tag/${src.tag}";
    license = lib.licenses.bsd3;
    maintainers = [ ];
  };
}