Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion datalad_next/annexremotes/tests/test_archivist.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from .. import UnsupportedRequest
from ..archivist import ArchivistRemote
from datalad_next.datasets import Dataset
from datalad_next.runners import CommandError
from datalad_core.runners import CommandError

from datalad_next.tests import assert_result_count

Expand Down
2 changes: 1 addition & 1 deletion datalad_next/constraints/git.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""Constraints for Git-related concepts and parameters"""
from __future__ import annotations

from datalad_next.runners import (
from datalad_core.runners import (
CommandError,
call_git,
call_git_oneline,
Expand Down
9 changes: 8 additions & 1 deletion datalad_next/consts/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,13 @@
``True`` if executed on the Windows platform.
"""

__all__ = [
'COPY_BUFSIZE',
'PRE_INIT_COMMIT_SHA',
'on_linux',
'on_windows',
]

# import from "utils", but these really are constants
from datalad.utils import (
on_linux,
Expand All @@ -29,4 +36,4 @@
# from PY3.10
COPY_BUFSIZE = 1024 * 1024 if on_windows else 64 * 1024

from datalad.consts import PRE_INIT_COMMIT_SHA
from datalad_core.consts import PRE_INIT_COMMIT_SHA
2 changes: 1 addition & 1 deletion datalad_next/gitremotes/datalad_annex.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@
LegacyGitRepo as GitRepo,
)
from datalad_next.exceptions import CapturedException
from datalad_next.runners import (
from datalad_core.runners import (
CommandError,
call_git,
call_git_oneline,
Expand Down
6 changes: 3 additions & 3 deletions datalad_next/iter_collections/annexworktree.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

from datalad_next.consts import on_windows
from datalad_next.repo_utils import has_initialized_annex
from datalad_next.runners import iter_git_subproc
from datalad_core.runners import iter_git_subproc

from .gitworktree import (
GitWorktreeItem,
Expand Down Expand Up @@ -177,7 +177,7 @@ def iter_annexworktree(
'--batch'],
# intersperse items with newlines to trigger a batch run
# this avoids string operations to append newlines to items
input=intersperse(
inputs=intersperse(
b'\n',
# use `GitWorktree*`-elements yielded by `iter_gitworktree`
# to create an `AnnexWorktreeItem` or
Expand All @@ -200,7 +200,7 @@ def iter_annexworktree(
# get the key properties JSON-lines style
['annex', 'examinekey', '--json', '--batch'],
# use only non-empty keys as input to `git annex examinekey`.
input=intersperse(
inputs=intersperse(
# Add line ending to submit the key to batch processing in
# `git annex examinekey`.
b'\n',
Expand Down
6 changes: 2 additions & 4 deletions datalad_next/iter_collections/gitdiff.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,11 @@

from datalad_next.consts import PRE_INIT_COMMIT_SHA
from datasalad.gitpathspec import GitPathSpecs
from datalad_next.runners import (
from datalad_core.runners import (
CommandError,
iter_git_subproc,
)
from datalad_next.runners import (
call_git,
call_git_oneline,
iter_git_subproc,
)

from .gittree import (
Expand Down
2 changes: 1 addition & 1 deletion datalad_next/iter_collections/gitstatus.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
)

from datalad_next.consts import PRE_INIT_COMMIT_SHA
from datalad_next.runners import (
from datalad_core.runners import (
call_git_lines,
)
from datalad_next.repo_utils import (
Expand Down
2 changes: 1 addition & 1 deletion datalad_next/iter_collections/gittree.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
itemize,
)

from datalad_next.runners import iter_git_subproc
from datalad_core.runners import iter_git_subproc

from .utils import PathBasedItem

Expand Down
2 changes: 1 addition & 1 deletion datalad_next/iter_collections/gitworktree.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
itemize,
)

from datalad_next.runners import iter_git_subproc
from datalad_core.runners import iter_git_subproc
from datasalad.gitpathspec import GitPathSpecs
from .utils import (
FileSystemItem,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import pytest

from datalad_next.datasets import Dataset
from datalad_next.runners import (
from datalad_core.runners import (
call_git_success,
)

Expand Down
15 changes: 12 additions & 3 deletions datalad_next/iterable_subprocess/__init__.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
"""Context manager to communicate with a subprocess using iterables

.. deprecated:: 1.6

This code has been moved to the datasalad library.
Use it from ``datasalad.iterable_subprocess`` instead.
This module is deprecated. It has been migrated to the `datasalad library
<https://pypi.org/project/datasalad>`__. Imports should be adjusted to
``datasalad.iterable_subprocess``.

This offers a higher level interface to subprocesses than Python's built-in
subprocess module, and is particularly helpful when data won't fit in memory
Expand All @@ -22,4 +22,13 @@

__all__ = ['iterable_subprocess']

import warnings

from datasalad.iterable_subprocess import iterable_subprocess

warnings.warn(
'`datalad_next.iterable_subprocess` has been migrated to the datasalad '
'library, adjust imports to `datasalad.iterable_subprocess`',
DeprecationWarning,
stacklevel=1,
)
17 changes: 13 additions & 4 deletions datalad_next/itertools/__init__.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
"""Various iterators, e.g., for subprocess pipelining and output processing

.. deprecated:: 1.6

This code has been moved to the datasalad library.
Use it from ``datasalad.itertools`` instead.
This module is deprecated. It has been migrated to the `datasalad library
<https://pypi.org/project/datasalad>`__. Imports should be adjusted to
``datasalad.itertools``.
"""

__all__ = [
Expand All @@ -17,13 +17,22 @@
'route_out',
]

import warnings

from datasalad.itertools import (
StoreOnly,
align_pattern,
decode_bytes,
itemize,
load_json,
load_json_with_flag,
route_in,
route_out,
StoreOnly,
)

warnings.warn(
'`datalad_next.itertools` has been migrated to the datasalad library, '
'adjust imports to `datasalad.itertools`',
DeprecationWarning,
stacklevel=1,
)
2 changes: 1 addition & 1 deletion datalad_next/patches/replace_sshremoteio.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@

from datalad_next.exceptions import CapturedException
from datalad_next.patches import apply_patch
from datalad_next.runners import CommandError
from datalad_core.runners import CommandError
from datalad_next.shell import (
FixedLengthResponseGeneratorPosix,
shell,
Expand Down
2 changes: 1 addition & 1 deletion datalad_next/repo_utils/annex.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from pathlib import Path

from datalad_next.runners import call_git_success
from datalad_core.runners import call_git_success


def has_initialized_annex(
Expand Down
2 changes: 1 addition & 1 deletion datalad_next/repo_utils/tests/test_head.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import pytest

from datalad_next.runners import call_git
from datalad_core.runners import call_git

from .. import get_worktree_head

Expand Down
2 changes: 1 addition & 1 deletion datalad_next/repo_utils/worktree.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from pathlib import Path

from datalad_next.exceptions import CapturedException
from datalad_next.runners import (
from datalad_core.runners import (
CommandError,
call_git_lines,
)
Expand Down
113 changes: 77 additions & 36 deletions datalad_next/runners/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
"""Execution of subprocesses

.. deprecated:: 1.6
This module is deprecated. It has been partially migrated to the
`datalad-core library <https://pypi.org/project/datalad-core>`__. Imports
should be adjusted to ``datalad_core.runners``.

This module provides all relevant components for subprocess execution. The
main work horse is :func:`~datalad_next.runners.iter_subproc`, a context
manager that enables interaction with a subprocess in the form of an iterable
Expand Down Expand Up @@ -63,59 +68,95 @@
StdOutErrCapture
"""

from .iter_subproc import (
iter_subproc,
)
from .git import (
call_git,
call_git_lines,
call_git_oneline,
call_git_success,
iter_git_subproc,
__all__ = [
'call_git',
'call_git_lines',
'call_git_oneline',
'call_git_success',
'iter_git_subproc',
'iter_subproc',
'CommandError',
'GitRunner',
'KillOutput',
'NoCapture',
'Protocol',
'Runner',
'StdErrCapture',
'StdOutCapture',
'StdOutErrCapture',
'STDERR_FILENO',
'STDOUT_FILENO',
'ThreadedRunner',
'LineSplitter',
'GeneratorMixIn',
'NoCaptureGeneratorProtocol',
'StdOutCaptureGeneratorProtocol',
'DEVNULL',
]

import warnings

# TODO: REMOVE FOR V2.0
from subprocess import (
DEVNULL,
)

# runners
# TODO REMOVE FOR V2.0
from datalad.runner import (
GitRunner,
Runner,
)
# TODO REMOVE FOR V2.0
from datalad.runner.nonasyncrunner import ThreadedRunner
# TODO: REMOVE FOR V2.0
# protocols
# TODO REMOVE FOR V2.0
# TODO: REMOVE FOR V2.0
from datalad.runner import (
GitRunner,
KillOutput,
NoCapture,
Protocol,
StdOutCapture,
Runner,
StdErrCapture,
StdOutCapture,
StdOutErrCapture,
)
# TODO REMOVE FOR V2.0
from datalad.runner.protocol import GeneratorMixIn
# TODO REMOVE FOR V2.0
from .protocols import (
NoCaptureGeneratorProtocol,
StdOutCaptureGeneratorProtocol,
)
# exceptions
# The following import supports legacy code that uses `CommandError` from this
# module. If you are writing new code, please use `CommandError` from
# `datalad.support.exceptions`. We intend to remove this import in the future.
from datalad_next.exceptions import CommandError

# TODO: REMOVE FOR V2.0
# utilities
# TODO REMOVE FOR V2.0
# TODO: REMOVE FOR V2.0
from datalad.runner.nonasyncrunner import (
STDOUT_FILENO,
STDERR_FILENO,
STDOUT_FILENO,
ThreadedRunner,
)
# TODO REMOVE FOR V2.0

# TODO: REMOVE FOR V2.0
from datalad.runner.protocol import GeneratorMixIn

# TODO: REMOVE FOR V2.0
from datalad.runner.utils import (
LineSplitter,
)
# TODO REMOVE FOR V2.0
from subprocess import (
DEVNULL,
from datalad_core.runners import (
call_git,
call_git_lines,
call_git_oneline,
call_git_success,
iter_git_subproc,
iter_subproc,
)

# exceptions
# The following import supports legacy code that uses `CommandError` from this
# module. If you are writing new code, please use `CommandError` from
# `datalad_core.runners`. We intend to remove this import in the future.
from datalad_next.exceptions import CommandError

# TODO: REMOVE FOR V2.0
from .protocols import (
NoCaptureGeneratorProtocol,
StdOutCaptureGeneratorProtocol,
)

warnings.warn(
'`datalad_next.runners` has been partially migrated to the '
'datalad-core library, '
'check docs, and adjust imports to `datalad_core.runners`',
DeprecationWarning,
stacklevel=1,
)
Loading
Loading