[med-svn] [Git][med-team/nipype][master] release

Alexandre Detiste (@detiste-guest) gitlab at salsa.debian.org
Sat Feb 8 21:42:04 GMT 2025



Alexandre Detiste pushed to branch master at Debian Med / nipype


Commits:
1dcb941e by Alexandre Detiste at 2025-02-08T22:41:55+01:00
release

- - - - -


5 changed files:

- debian/changelog
- + debian/clean
- + debian/patches/acres.patch
- − debian/patches/fixup-strict-digraph-test.patch
- debian/patches/series


Changes:

=====================================
debian/changelog
=====================================
@@ -1,3 +1,11 @@
+nipype (1.9.2-1) unstable; urgency=medium
+
+  * Team Upload
+  * New upstream version 1.9.2 (Closes: #1095029)
+  * Refresh patch
+
+ -- Alexandre Detiste <tchet at debian.org>  Sat, 08 Feb 2025 22:11:53 +0100
+
 nipype (1.9.0-1) unstable; urgency=medium
 
   [ Alexandre Detiste ]


=====================================
debian/clean
=====================================
@@ -0,0 +1 @@
+nipype/.pytest_cache/


=====================================
debian/patches/acres.patch
=====================================
@@ -0,0 +1,237 @@
+--- /dev/null
++++ b/nipype/acres.py
+@@ -0,0 +1,212 @@
++# Copyright The NiPreps Developers <nipreps at gmail.com>
++#
++# Licensed under the Apache License, Version 2.0 (the "License");
++# you may not use this file except in compliance with the License.
++# You may obtain a copy of the License at
++#
++#     http://www.apache.org/licenses/LICENSE-2.0
++#
++# Unless required by applicable law or agreed to in writing, software
++# distributed under the License is distributed on an "AS IS" BASIS,
++# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
++# See the License for the specific language governing permissions and
++# limitations under the License.
++#
++# We support and encourage derived works from this project, please read
++# about our expectations at
++#
++#     https://www.nipreps.org/community/licensing/
++#
++#
++# This package was adapted from the fmriprep.data module released in 24.0.0,
++# which evolved from an implementation in the Nibabies project,
++# introduced in the following commit: https://github.com/nipreps/nibabies/commit/45a63a6
++#
++# Changes as of the fork (2024 July 15):
++#   - This implementation uses a global ExitStack and resource cache,
++#     to avoid `Loader` instances from containing self-references and
++#     potentially leaking memory.
++#
++# Future modifications will be tracked in the change log.
++"""Data loading utility for Python packages.
++
++This module provides a class that wraps :mod:`importlib.resources` to
++provide resource retrieval functions with commonly-needed scoping,
++including interpreter-lifetime caching.
++"""
++
++from __future__ import annotations
++
++import atexit
++import sys
++from contextlib import AbstractContextManager, ExitStack
++from functools import cached_property
++from pathlib import Path
++from types import ModuleType
++
++if sys.version_info >= (3, 9):
++    from functools import cache
++else:
++    from functools import lru_cache as cache
++
++if sys.version_info >= (3, 11):
++    from importlib.resources import as_file, files
++    from importlib.resources.abc import Traversable
++else:
++    from importlib_resources import as_file, files
++    from importlib_resources.abc import Traversable
++
++__all__ = ['Loader']
++
++
++# Use one global exit stack
++EXIT_STACK = ExitStack()
++atexit.register(EXIT_STACK.close)
++
++
++ at cache
++def _cache_resource(anchor: str | ModuleType, segments: tuple[str]) -> Path:
++    # PY310(importlib_resources): no-any-return, PY311+(importlib.resources): unused-ignore
++    return EXIT_STACK.enter_context(as_file(files(anchor).joinpath(*segments)))  # type: ignore[no-any-return,unused-ignore]
++
++
++class Loader:
++    """A loader for package files relative to a module
++
++    This class wraps :mod:`importlib.resources` to provide a getter
++    function with an interpreter-lifetime scope. For typical packages
++    it simply passes through filesystem paths as :class:`~pathlib.Path`
++    objects. For zipped distributions, it will unpack the files into
++    a temporary directory that is cleaned up on interpreter exit.
++
++    This loader accepts a fully-qualified module name or a module
++    object.
++
++    Expected usage::
++
++        '''Data package
++
++        .. autofunction:: load_data
++
++        .. automethod:: load_data.readable
++
++        .. automethod:: load_data.as_path
++
++        .. automethod:: load_data.cached
++        '''
++
++        from acres import Loader
++
++        load_data = Loader(__spec__.name)
++
++    :class:`~Loader` objects implement the :func:`callable` interface
++    and generate a docstring, and are intended to be treated and documented
++    as functions.
++
++    For greater flexibility and improved readability over the ``importlib.resources``
++    interface, explicit methods are provided to access resources.
++
++    +---------------+----------------+------------------+
++    | On-filesystem | Lifetime       | Method           |
++    +---------------+----------------+------------------+
++    | `True`        | Interpreter    | :meth:`cached`   |
++    +---------------+----------------+------------------+
++    | `True`        | `with` context | :meth:`as_path`  |
++    +---------------+----------------+------------------+
++    | `False`       | n/a            | :meth:`readable` |
++    +---------------+----------------+------------------+
++
++    It is also possible to use ``Loader`` directly::
++
++        from acres import Loader
++
++        Loader(other_package).readable('data/resource.ext').read_text()
++
++        with Loader(other_package).as_path('data') as pkgdata:
++            # Call function that requires full Path implementation
++            func(pkgdata)
++
++        # contrast to
++
++        from importlib_resources import files, as_file
++
++        files(other_package).joinpath('data/resource.ext').read_text()
++
++        with as_file(files(other_package) / 'data') as pkgdata:
++            func(pkgdata)
++
++    .. automethod:: readable
++
++    .. automethod:: as_path
++
++    .. automethod:: cached
++    """
++
++    def __init__(self, anchor: str | ModuleType):
++        self._anchor = anchor
++        self.files = files(anchor)
++        # Allow class to have a different docstring from instances
++        self.__doc__ = self._doc
++
++    @cached_property
++    def _doc(self) -> str:
++        """Construct docstring for instances
++
++        Lists the public top-level paths inside the location, where
++        non-public means has a `.` or `_` prefix or is a 'tests'
++        directory.
++        """
++        top_level = sorted(
++            f'{p.name}/' if p.is_dir() else p.name
++            for p in self.files.iterdir()
++            if p.name[0] not in ('.', '_') and p.name != 'tests'
++        )
++        doclines = [
++            f'Load package files relative to ``{self._anchor}``.',
++            '',
++            'This package contains the following (top-level) files/directories:',
++            '',
++            *(f'* ``{path}``' for path in top_level),
++        ]
++
++        return '\n'.join(doclines)
++
++    def readable(self, *segments: str) -> Traversable:
++        """Provide read access to a resource through a Path-like interface.
++
++        This file may or may not exist on the filesystem, and may be
++        efficiently used for read operations, including directory traversal.
++
++        This result is not cached or copied to the filesystem in cases where
++        that would be necessary.
++        """
++        # PY310(importlib_resources): no-any-return, PY311+(importlib.resources): unused-ignore
++        return self.files.joinpath(*segments)  # type: ignore[no-any-return,unused-ignore]
++
++    def as_path(self, *segments: str) -> AbstractContextManager[Path]:
++        """Ensure data is available as a :class:`~pathlib.Path`.
++
++        This method generates a context manager that yields a Path when
++        entered.
++
++        This result is not cached, and any temporary files that are created
++        are deleted when the context is exited.
++        """
++        # PY310(importlib_resources): no-any-return, PY311+(importlib.resources): unused-ignore
++        return as_file(self.files.joinpath(*segments))  # type: ignore[no-any-return,unused-ignore]
++
++    def cached(self, *segments: str) -> Path:
++        """Ensure data resource is available as a :class:`~pathlib.Path`.
++
++        Any temporary files that are created remain available throughout
++        the duration of the program, and are deleted when Python exits.
++
++        Results are cached so that multiple calls do not unpack the same
++        data multiple times, but directories and their contents being
++        requested separately may result in some duplication.
++        """
++        # Use self._anchor and segments to ensure the cache does not depend on id(self.files)
++        # PY310(importlib_resources): unused-ignore, PY311+(importlib.resources) arg-type
++        return _cache_resource(self._anchor, segments)  # type: ignore[arg-type,unused-ignore]
++
++    __call__ = cached
+--- a/nipype/interfaces/base/tests/test_support.py
++++ b/nipype/interfaces/base/tests/test_support.py
+@@ -3,7 +3,7 @@
+ import os
+ import pytest
+ 
+-import acres
++from .... import acres
+ 
+ from ....utils.filemanip import md5
+ from ... import base as nib
+--- a/nipype/interfaces/fsl/model.py
++++ b/nipype/interfaces/fsl/model.py
+@@ -9,7 +9,7 @@
+ from shutil import rmtree
+ from string import Template
+ 
+-import acres
++from ... import acres
+ import numpy as np
+ from looseversion import LooseVersion
+ from nibabel import load


=====================================
debian/patches/fixup-strict-digraph-test.patch deleted
=====================================
@@ -1,24 +0,0 @@
-Description: adjust expected test output.
- For some reason, the construction of the dot file results in a
- duplicate space between "start digraph" and the opening parenthesis.
- This results in test failures.
- .
- It is unclear whether the issue is in nipype or Debian, so hesitate to
- feedback upstream.   But the test does seem somewhat fragile.
-
-Author: Étienne Mollier <emollier at debian.org>
-Forwarded: no
-Last-Update: 2024-11-04
----
-This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
---- nipype.orig/nipype/pipeline/engine/tests/test_engine.py
-+++ nipype/nipype/pipeline/engine/tests/test_engine.py
-@@ -482,7 +482,7 @@
- 
- # examples of dot files used in the following test
- dotfile_orig = [
--    "strict digraph {\n",
-+    "strict digraph  {\n",
-     '"mod1 (engine)";\n',
-     '"mod2 (engine)";\n',
-     '"mod1 (engine)" -> "mod2 (engine)";\n',


=====================================
debian/patches/series
=====================================
@@ -9,4 +9,4 @@ sphinx.patch
 fix-transpose.patch
 reproducible-build.patch
 fix-privacy-breaches.patch
-fixup-strict-digraph-test.patch
+acres.patch



View it on GitLab: https://salsa.debian.org/med-team/nipype/-/commit/1dcb941e68cf011d4345d921f4f114ec62d41d79

-- 
View it on GitLab: https://salsa.debian.org/med-team/nipype/-/commit/1dcb941e68cf011d4345d921f4f114ec62d41d79
You're receiving this email because of your account on salsa.debian.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/debian-med-commit/attachments/20250208/42927958/attachment-0001.htm>


More information about the debian-med-commit mailing list