[med-svn] [Git][med-team/nipype][master] python3-acres is now packaged
Alexandre Detiste (@detiste-guest)
gitlab at salsa.debian.org
Wed Jun 25 13:15:27 BST 2025
Alexandre Detiste pushed to branch master at Debian Med / nipype
Commits:
24ac9db6 by Alexandre Detiste at 2025-06-25T13:23:27+02:00
python3-acres is now packaged
- - - - -
3 changed files:
- debian/control
- − debian/patches/acres.patch
- debian/patches/series
Changes:
=====================================
debian/control
=====================================
@@ -9,6 +9,7 @@ Build-Depends: debhelper-compat (= 13),
dh-sequence-python3,
pybuild-plugin-pyproject,
python3-setuptools,
+ python3-acres,
python3-all,
python3-sphinx,
python3-sphinxcontrib.apidoc,
@@ -51,6 +52,7 @@ Section: python
Depends: ${python3:Depends},
${shlibs:Depends},
${misc:Depends},
+ python3-acres,
python3-click,
python3-dateutil,
python3-dipy,
=====================================
debian/patches/acres.patch deleted
=====================================
@@ -1,237 +0,0 @@
---- /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/series
=====================================
@@ -9,5 +9,4 @@ sphinx.patch
fix-transpose.patch
reproducible-build.patch
fix-privacy-breaches.patch
-acres.patch
sphinx_8.2.1.patch
View it on GitLab: https://salsa.debian.org/med-team/nipype/-/commit/24ac9db6014913555570fd876110e82c862bc6bd
--
View it on GitLab: https://salsa.debian.org/med-team/nipype/-/commit/24ac9db6014913555570fd876110e82c862bc6bd
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/20250625/5ba0c5e0/attachment-0001.htm>
More information about the debian-med-commit
mailing list