diff --git a/pkgs/applications/science/misc/snakemake/default.nix b/pkgs/applications/science/misc/snakemake/default.nix index 7f0e70c64213..68204d0fa41d 100644 --- a/pkgs/applications/science/misc/snakemake/default.nix +++ b/pkgs/applications/science/misc/snakemake/default.nix @@ -1,30 +1,28 @@ { lib -, fetchFromGitHub +, fetchPypi +, fetchpatch , python3 , runtimeShell +, stress }: python3.pkgs.buildPythonApplication rec { pname = "snakemake"; - version = "8.14.0"; + version = "8.20.1"; format = "setuptools"; - src = fetchFromGitHub { - owner = "snakemake"; - repo = pname; - rev = "refs/tags/v${version}"; - hash = "sha256-6oguN4u4OUDXpDsbueSBNwtWgLCaKmgq3w/d/MsMh7Y="; - # https://github.com/python-versioneer/python-versioneer/issues/217 - postFetch = '' - sed -i "$out"/snakemake/_version.py -e 's#git_refnames = ".*"#git_refnames = " (tag: v${version})"#' - ''; + src = fetchPypi { + inherit pname version; + hash = "sha256-adNwIA1z/TwWsa0gQb4hAsUvHInjd30sm1dYKXvvXy8="; }; postPatch = '' patchShebangs --build tests/ - patchShebangs --host snakemake/executors/jobscript.sh - substituteInPlace snakemake/shell.py \ - --replace "/bin/sh" "${runtimeShell}" + substituteInPlace tests/common.py \ + --replace-fail 'os.environ["PYTHONPATH"] = os.getcwd()' "pass" \ + --replace-fail 'del os.environ["PYTHONPATH"]' "pass" + substituteInPlace snakemake/unit_tests/__init__.py \ + --replace-fail '"unit_tests/templates"' '"'"$PWD"'/snakemake/unit_tests/templates"' ''; propagatedBuildInputs = with python3.pkgs; [ @@ -41,6 +39,7 @@ python3.pkgs.buildPythonApplication rec { nbformat psutil pulp + pygments pyyaml requests reretry @@ -66,16 +65,54 @@ python3.pkgs.buildPythonApplication rec { numpy pandas pytestCheckHook + pytest-mock requests-mock snakemake-executor-plugin-cluster-generic + snakemake-storage-plugin-fs + stress ]; - disabledTestPaths = [ - "tests/test_conda_python_3_7_script/test_script.py" + pytestFlagsArray = [ + "tests/tests.py" + "tests/test_expand.py" + "tests/test_io.py" + "tests/test_schema.py" + "tests/test_executor_test_suite.py" + "tests/test_api.py" ]; + # Some will be disabled via https://github.com/snakemake/snakemake/pull/3074 disabledTests = [ + # requires graphviz + "test_filegraph" + # requires s3 + "test_storage" + "test_default_storage" + "test_output_file_cache_storage" + # requires peppy and eido + "test_pep" + "test_modules_peppy" + # requires perl + "test_shadow" + # requires snakemake-storage-plugin-http + "test_ancient" + "test_modules_prefix" + # requires snakemake-storage-plugin-s3 "test_deploy_sources" + # requires modules + "test_env_modules" + # issue with locating template file + "test_generate_unit_tests" + # weird + "test_strict_mode" + "test_issue1256" + "test_issue2574" + "test_github_issue1384" + # future-proofing + "conda" + "singularity" + "apptainer" + "container" ]; pythonImportsCheck = [ diff --git a/pkgs/development/python-modules/snakemake-storage-plugin-fs/default.nix b/pkgs/development/python-modules/snakemake-storage-plugin-fs/default.nix new file mode 100644 index 000000000000..64c6d4b421d2 --- /dev/null +++ b/pkgs/development/python-modules/snakemake-storage-plugin-fs/default.nix @@ -0,0 +1,44 @@ +{ + lib, + buildPythonPackage, + fetchFromGitHub, + poetry-core, + snakemake, + snakemake-interface-storage-plugins, + snakemake-interface-common, + sysrsync, +}: + +buildPythonPackage rec { + pname = "snakemake-storage-plugin-fs"; + version = "1.0.6"; + pyproject = true; + + src = fetchFromGitHub { + owner = "snakemake"; + repo = pname; + rev = "refs/tags/v${version}"; + hash = "sha256-9A2W+V0d9K1Ei4WXqIZfIcOYsWgpGVP7P/ANy8jOGu0="; + }; + + build-system = [ poetry-core ]; + + dependencies = [ + snakemake-interface-storage-plugins + snakemake-interface-common + sysrsync + ]; + + # The current tests are not worth dealing with cyclic dependency on snakemake + doCheck = false; + + # Use nothing due to a cyclic dependency on snakemake + pythonImportsCheck = [ ]; + + meta = with lib; { + description = "A Snakemake storage plugin that reads and writes from a locally mounted filesystem using rsync"; + homepage = "https://github.com/snakemake/snakemake-storage-plugin-fs"; + license = licenses.mit; + maintainers = with maintainers; [ veprbl ]; + }; +} diff --git a/pkgs/development/python-modules/sysrsync/default.nix b/pkgs/development/python-modules/sysrsync/default.nix new file mode 100644 index 000000000000..809ca324cce1 --- /dev/null +++ b/pkgs/development/python-modules/sysrsync/default.nix @@ -0,0 +1,45 @@ +{ + lib, + buildPythonPackage, + fetchFromGitHub, + poetry-core, + setuptools, + rsync, + toml, +}: + +buildPythonPackage rec { + pname = "sysrsync"; + version = "1.1.1"; + pyproject = true; + + src = fetchFromGitHub { + owner = "gchamon"; + repo = pname; + rev = "refs/tags/${version}"; + hash = "sha256-2Sz3JrNmIGOnad+qjRzbAgsFEzDtwBT0KLEFyQKZra4="; + }; + + postPatch = '' + substituteInPlace sysrsync/command_maker.py \ + --replace-fail "'rsync'" "'${rsync}/bin/rsync'" + ''; + + build-system = [ + poetry-core + setuptools + ]; + + dependencies = [ + toml + ]; + + pythonImportsCheck = [ "sysrsync" ]; + + meta = with lib; { + description = "Simple and safe system's rsync wrapper for Python"; + homepage = "https://github.com/gchamon/sysrsync"; + license = licenses.mit; + maintainers = with maintainers; [ veprbl ]; + }; +} diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index 25386df493ff..1390548108c6 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -14384,6 +14384,8 @@ self: super: with self; { snakemake-interface-storage-plugins = callPackage ../development/python-modules/snakemake-interface-storage-plugins { }; + snakemake-storage-plugin-fs = callPackage ../development/python-modules/snakemake-storage-plugin-fs { }; + snakemake-storage-plugin-s3 = callPackage ../development/python-modules/snakemake-storage-plugin-s3 { }; snakemake-storage-plugin-xrootd = callPackage ../development/python-modules/snakemake-storage-plugin-xrootd { }; @@ -15065,6 +15067,8 @@ self: super: with self; { syslog-rfc5424-formatter = callPackage ../development/python-modules/syslog-rfc5424-formatter { }; + sysrsync = callPackage ../development/python-modules/sysrsync { }; + systembridge = callPackage ../development/python-modules/systembridge { }; systembridgeconnector = callPackage ../development/python-modules/systembridgeconnector { };