diff --git a/maintainers/maintainer-list.nix b/maintainers/maintainer-list.nix index 16d039e7d2f..14e1e751afb 100644 --- a/maintainers/maintainer-list.nix +++ b/maintainers/maintainer-list.nix @@ -813,6 +813,12 @@ fingerprint = "B422 CFB1 C9EF 73F7 E1E2 698D F53E 3233 42F7 A6D3A"; }]; }; + alxsimon = { + email = "alexis.simon@normalesup.org"; + github = "alxsimon"; + githubId = 9567176; + name = "Alexis Simon"; + }; alyaeanyx = { email = "alyaeanyx@mailbox.org"; github = "alyaeanyx"; diff --git a/pkgs/development/python-modules/demes/default.nix b/pkgs/development/python-modules/demes/default.nix new file mode 100644 index 00000000000..986bb7f9ac9 --- /dev/null +++ b/pkgs/development/python-modules/demes/default.nix @@ -0,0 +1,58 @@ +{ lib +, buildPythonPackage +, fetchPypi +, setuptools-scm +, ruamel-yaml +, attrs +, pythonOlder +, pytestCheckHook +, pytest-xdist +, numpy +}: + +buildPythonPackage rec { + pname = "demes"; + version = "0.2.3"; + format = "pyproject"; + disabled = pythonOlder "3.7"; + + src = fetchPypi { + inherit pname version; + hash = "sha256-nmE7ZbR126J3vKdR3h83qJ/V602Fa6J3M6IJnIqCNhc="; + }; + + nativeBuildInputs = [ + setuptools-scm + ]; + + propagatedBuildInputs = [ + ruamel-yaml + attrs + ]; + + postPatch = '' + # remove coverage arguments to pytest + sed -i '/--cov/d' setup.cfg + ''; + + nativeCheckInputs = [ + pytestCheckHook + pytest-xdist + numpy + ]; + + disabledTestPaths = [ + "tests/test_spec.py" + ]; + + pythonImportsCheck = [ + "demes" + ]; + + meta = with lib; { + description = "Tools for describing and manipulating demographic models"; + homepage = "https://github.com/popsim-consortium/demes-python"; + license = licenses.isc; + maintainers = with maintainers; [ alxsimon ]; + }; +} diff --git a/pkgs/development/python-modules/demesdraw/default.nix b/pkgs/development/python-modules/demesdraw/default.nix new file mode 100644 index 00000000000..42e9fdc4c5f --- /dev/null +++ b/pkgs/development/python-modules/demesdraw/default.nix @@ -0,0 +1,63 @@ +{ lib +, stdenv +, buildPythonPackage +, fetchPypi +, setuptools-scm +, demes +, matplotlib +, numpy +, scipy +, pythonOlder +, pytestCheckHook +, pytest-xdist +, mpmath +}: + +buildPythonPackage rec { + pname = "demesdraw"; + version = "0.4.0"; + format = "pyproject"; + disabled = pythonOlder "3.7"; + + src = fetchPypi { + inherit pname version; + hash = "sha256-n7dz+kYf2yyr66TBx452W6z4qT6bT81u0J4aMAYuGCc="; + }; + + nativeBuildInputs = [ + setuptools-scm + ]; + + propagatedBuildInputs = [ + demes + matplotlib + numpy + scipy + ]; + + postPatch = '' + # remove coverage arguments to pytest + sed -i '/--cov/d' setup.cfg + ''; + + # This variable is needed to suppress the "Trace/BPT trap: 5" error in Darwin's checkPhase. + # Not sure of the details, but we can avoid it by changing the matplotlib backend during testing. + env.MPLBACKEND = lib.optionalString stdenv.isDarwin "Agg"; + + nativeCheckInputs = [ + pytestCheckHook + pytest-xdist + mpmath + ]; + + pythonImportsCheck = [ + "demesdraw" + ]; + + meta = with lib; { + description = "Drawing functions for Demes demographic models"; + homepage = "https://github.com/grahamgower/demesdraw"; + license = licenses.isc; + maintainers = with maintainers; [ alxsimon ]; + }; +} diff --git a/pkgs/development/python-modules/msprime/default.nix b/pkgs/development/python-modules/msprime/default.nix new file mode 100644 index 00000000000..d33adc13080 --- /dev/null +++ b/pkgs/development/python-modules/msprime/default.nix @@ -0,0 +1,81 @@ +{ lib +, buildPythonPackage +, fetchPypi +, setuptools-scm +, pythonOlder +, gsl +, numpy +, newick +, tskit +, demes +, pytest +, pytest-xdist +, scipy +}: + +buildPythonPackage rec { + pname = "msprime"; + version = "1.2.0"; + format = "pyproject"; + disabled = pythonOlder "3.8"; + + src = fetchPypi { + inherit pname version; + hash = "sha256-YAJa2f0w2CenKubnYLbP8HodDhabLB2hAkyw/CPkp6o="; + }; + + nativeBuildInputs = [ + setuptools-scm + gsl + ]; + + buildInputs = [ + gsl + ]; + + propagatedBuildInputs = [ + numpy + newick + tskit + demes + ]; + + nativeCheckInputs = [ + pytest + pytest-xdist + scipy + ]; + + checkPhase = '' + runHook preCheck + + # avoid adding the current directory to sys.path + # https://docs.pytest.org/en/7.1.x/explanation/pythonpath.html#invoking-pytest-versus-python-m-pytest + # need pythonPackages.stdpopsim + # need pythonPackages.bintrees + # need pythonPachages.python_jsonschema_objects + # ModuleNotFoundError: No module named 'lwt_interface.dict_encoding_testlib' + # fails for python311 + # fails for python311 + pytest -v --import-mode append \ + --ignore=tests/test_demography.py \ + --ignore=tests/test_algorithms.py \ + --ignore=tests/test_provenance.py \ + --ignore=tests/test_dict_encoding.py \ + --deselect=tests/test_ancestry.py::TestSimulator::test_debug_logging \ + --deselect=tests/test_ancestry.py::TestSimulator::test_debug_logging_dtwf + + runHook postCheck + ''; + + pythonImportsCheck = [ + "msprime" + ]; + + meta = with lib; { + description = "Simulate genealogical trees and genomic sequence data using population genetic models"; + homepage = "https://github.com/tskit-dev/msprime"; + license = licenses.gpl3Plus; + maintainers = with maintainers; [ alxsimon ]; + }; +} diff --git a/pkgs/development/python-modules/newick/default.nix b/pkgs/development/python-modules/newick/default.nix new file mode 100644 index 00000000000..317a9c582b3 --- /dev/null +++ b/pkgs/development/python-modules/newick/default.nix @@ -0,0 +1,45 @@ +{ lib +, buildPythonPackage +, fetchFromGitHub +, setuptools-scm +, pythonOlder +, pytestCheckHook +}: + +buildPythonPackage rec { + pname = "newick"; + version = "1.9.0"; + format = "pyproject"; + disabled = pythonOlder "3.7"; + + src = fetchFromGitHub { + owner = "dlce-eva"; + repo = "python-newick"; + rev = "v${version}"; + hash = "sha256-TxyR6RYvy2oIcDNZnHrExtPYGspyWOtZqNy488OmWwk="; + }; + + nativeBuildInputs = [ + setuptools-scm + ]; + + postPatch = '' + # remove coverage arguments to pytest + sed -i '/--cov/d' setup.cfg + ''; + + nativeCheckInputs = [ + pytestCheckHook + ]; + + pythonImportsCheck = [ + "newick" + ]; + + meta = with lib; { + description = "A python package to read and write the Newick format"; + homepage = "https://github.com/dlce-eva/python-newick"; + license = licenses.asl20; + maintainers = with maintainers; [ alxsimon ]; + }; +} diff --git a/pkgs/development/python-modules/pyslim/default.nix b/pkgs/development/python-modules/pyslim/default.nix new file mode 100644 index 00000000000..fcb53da4a4f --- /dev/null +++ b/pkgs/development/python-modules/pyslim/default.nix @@ -0,0 +1,45 @@ +{ lib +, buildPythonPackage +, fetchPypi +, setuptools-scm +, pythonOlder +, msprime +, numpy +, tskit +}: + +buildPythonPackage rec { + pname = "pyslim"; + version = "1.0.3"; + format = "pyproject"; + disabled = pythonOlder "3.7"; + + src = fetchPypi { + inherit pname version; + hash = "sha256-BRfv5AcdRpnvk7zGeYYWweh+foFEOSZjz3pTjX8KOnA="; + }; + + nativeBuildInputs = [ + setuptools-scm + ]; + + propagatedBuildInputs = [ + msprime + tskit + numpy + ]; + + # Requires non-packaged software SLiM + doCheck = false; + + pythonImportsCheck = [ + "pyslim" + ]; + + meta = with lib; { + description = "Tools for dealing with tree sequences coming to and from SLiM"; + homepage = "https://github.com/tskit-dev/pyslim"; + license = licenses.mit; + maintainers = with maintainers; [ alxsimon ]; + }; +} diff --git a/pkgs/development/python-modules/tskit/default.nix b/pkgs/development/python-modules/tskit/default.nix new file mode 100644 index 00000000000..bb5139b425b --- /dev/null +++ b/pkgs/development/python-modules/tskit/default.nix @@ -0,0 +1,46 @@ +{ lib +, buildPythonPackage +, fetchPypi +, setuptools-scm +, pythonOlder +, numpy +, jsonschema +, svgwrite +}: + +buildPythonPackage rec { + pname = "tskit"; + version = "0.5.5"; + format = "pyproject"; + disabled = pythonOlder "3.7"; + + src = fetchPypi { + inherit pname version; + hash = "sha256-phhBTAHAPlBnmzSiLmPYDMg1Mui85NZacni3WuYAc6c="; + }; + + nativeBuildInputs = [ + setuptools-scm + ]; + + propagatedBuildInputs = [ + numpy + jsonschema + svgwrite + ]; + + # Pypi does not include test folder and too complex to compile from GitHub source + # will ask upstream to include tests in pypi + doCheck = false; + + pythonImportsCheck = [ + "tskit" + ]; + + meta = with lib; { + description = "The tree sequence toolkit"; + homepage = "https://github.com/tskit-dev/tskit"; + license = licenses.mit; + maintainers = with maintainers; [ alxsimon ]; + }; +} diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index 6c25c8ef703..40e90c95567 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -2517,6 +2517,10 @@ self: super: with self; { deluge-client = callPackage ../development/python-modules/deluge-client { }; + demes = callPackage ../development/python-modules/demes { }; + + demesdraw = callPackage ../development/python-modules/demesdraw { }; + demetriek = callPackage ../development/python-modules/demetriek { }; demjson3 = callPackage ../development/python-modules/demjson3 { }; @@ -6586,6 +6590,8 @@ self: super: with self; { msoffcrypto-tool = callPackage ../development/python-modules/msoffcrypto-tool { }; + msprime = callPackage ../development/python-modules/msprime { }; + mss = callPackage ../development/python-modules/mss { }; msrestazure = callPackage ../development/python-modules/msrestazure { }; @@ -6830,6 +6836,8 @@ self: super: with self; { newversion = callPackage ../development/python-modules/newversion { }; + newick = callPackage ../development/python-modules/newick { }; + nexia = callPackage ../development/python-modules/nexia { }; nextcloudmonitor = callPackage ../development/python-modules/nextcloudmonitor { }; @@ -9540,6 +9548,8 @@ self: super: with self; { pysingleton = callPackage ../development/python-modules/pysingleton { }; + pyslim = callPackage ../development/python-modules/pyslim { }; + pyslurm = callPackage ../development/python-modules/pyslurm { inherit (pkgs) slurm; }; @@ -12609,6 +12619,8 @@ self: super: with self; { trytond = callPackage ../development/python-modules/trytond { }; + tskit = callPackage ../development/python-modules/tskit { }; + ttach = callPackage ../development/python-modules/ttach { }; ttls = callPackage ../development/python-modules/ttls { };