From 29012eed1171803bb4e22a606c45bad37371e55d Mon Sep 17 00:00:00 2001 From: Tony Narlock Date: Sun, 15 May 2022 09:44:23 -0500 Subject: [PATCH 1/2] refactor!: cmd.core -> utils.run --- docs/cmd/core.md | 8 -------- docs/cmd/index.md | 1 - docs/internals/index.md | 1 + docs/internals/run.md | 9 +++++++++ libvcs/__init__.py | 2 +- libvcs/cmd/git.py | 2 +- libvcs/cmd/hg.py | 2 +- libvcs/cmd/svn.py | 2 +- libvcs/conftest.py | 2 +- libvcs/projects/base.py | 2 +- libvcs/{cmd/core.py => utils/run.py} | 0 tests/cmd/test_core.py | 2 +- tests/projects/test_conftest.py | 2 +- tests/projects/test_git.py | 2 +- tests/projects/test_hg.py | 2 +- tests/projects/test_svn.py | 2 +- 16 files changed, 21 insertions(+), 20 deletions(-) delete mode 100644 docs/cmd/core.md create mode 100644 docs/internals/run.md rename libvcs/{cmd/core.py => utils/run.py} (100%) diff --git a/docs/cmd/core.md b/docs/cmd/core.md deleted file mode 100644 index de0875f30..000000000 --- a/docs/cmd/core.md +++ /dev/null @@ -1,8 +0,0 @@ -# `libvcs.cmd.core` - -```{eval-rst} -.. autoapimodule:: libvcs.cmd.core - :members: - :show-inheritance: - :undoc-members: -``` diff --git a/docs/cmd/index.md b/docs/cmd/index.md index 967222d5e..4e495cb08 100644 --- a/docs/cmd/index.md +++ b/docs/cmd/index.md @@ -19,5 +19,4 @@ versions. git hg svn -core ``` diff --git a/docs/internals/index.md b/docs/internals/index.md index d216703a2..734aa2a79 100644 --- a/docs/internals/index.md +++ b/docs/internals/index.md @@ -14,5 +14,6 @@ exc types dataclasses query_list +run subprocess ``` diff --git a/docs/internals/run.md b/docs/internals/run.md new file mode 100644 index 000000000..c8ebcb208 --- /dev/null +++ b/docs/internals/run.md @@ -0,0 +1,9 @@ +# `libvcs.utils.run` + +```{eval-rst} +.. autoapimodule:: libvcs.utils.run + :members: + :show-inheritance: + :undoc-members: + :exclude-members: StrOrBytesPath, StrPath, logger +``` diff --git a/libvcs/__init__.py b/libvcs/__init__.py index bbbda7d74..7d769aab2 100644 --- a/libvcs/__init__.py +++ b/libvcs/__init__.py @@ -1,7 +1,7 @@ """Project package for libvcs.""" import logging -from .cmd.core import CmdLoggingAdapter +from .utils.run import CmdLoggingAdapter from .projects.base import BaseProject from .projects.git import GitProject from .projects.hg import MercurialProject diff --git a/libvcs/cmd/git.py b/libvcs/cmd/git.py index bc753b498..66c71b6cd 100644 --- a/libvcs/cmd/git.py +++ b/libvcs/cmd/git.py @@ -3,7 +3,7 @@ from typing import Any, Literal, Optional, Sequence, Union from ..types import StrOrBytesPath, StrPath -from .core import run +from libvcs.utils.run import run _CMD = Union[StrOrBytesPath, Sequence[StrOrBytesPath]] diff --git a/libvcs/cmd/hg.py b/libvcs/cmd/hg.py index 736f2338a..38c0e6399 100644 --- a/libvcs/cmd/hg.py +++ b/libvcs/cmd/hg.py @@ -3,7 +3,7 @@ from typing import Optional, Sequence, Union from ..types import StrOrBytesPath, StrPath -from .core import run +from libvcs.utils.run import run _CMD = Union[StrOrBytesPath, Sequence[StrOrBytesPath]] diff --git a/libvcs/cmd/svn.py b/libvcs/cmd/svn.py index 4a6ce0b12..f44bb0642 100644 --- a/libvcs/cmd/svn.py +++ b/libvcs/cmd/svn.py @@ -2,7 +2,7 @@ from typing import Literal, Optional, Sequence, Union from ..types import StrOrBytesPath, StrPath -from .core import run +from libvcs.utils.run import run _CMD = Union[StrOrBytesPath, Sequence[StrOrBytesPath]] diff --git a/libvcs/conftest.py b/libvcs/conftest.py index 2aac2615b..71d6502bb 100644 --- a/libvcs/conftest.py +++ b/libvcs/conftest.py @@ -10,7 +10,7 @@ from faker import Faker -from libvcs.cmd.core import run, which +from libvcs.utils.run import run, which from libvcs.projects.git import GitProject, GitRemoteDict skip_if_git_missing = pytest.mark.skipif( diff --git a/libvcs/projects/base.py b/libvcs/projects/base.py index 0c972d8d7..df1522e9e 100644 --- a/libvcs/projects/base.py +++ b/libvcs/projects/base.py @@ -4,7 +4,7 @@ from typing import NamedTuple from urllib import parse as urlparse -from libvcs.cmd.core import CmdLoggingAdapter, mkdir_p, run +from libvcs.utils.run import CmdLoggingAdapter, mkdir_p, run from libvcs.types import StrPath logger = logging.getLogger(__name__) diff --git a/libvcs/cmd/core.py b/libvcs/utils/run.py similarity index 100% rename from libvcs/cmd/core.py rename to libvcs/utils/run.py diff --git a/tests/cmd/test_core.py b/tests/cmd/test_core.py index 5b7f4c2c9..62461e831 100644 --- a/tests/cmd/test_core.py +++ b/tests/cmd/test_core.py @@ -2,7 +2,7 @@ import pytest -from libvcs.cmd.core import mkdir_p, which +from libvcs.utils.run import mkdir_p, which def test_mkdir_p(tmp_path: pathlib.Path): diff --git a/tests/projects/test_conftest.py b/tests/projects/test_conftest.py index d1c0ac4ae..03c765bec 100644 --- a/tests/projects/test_conftest.py +++ b/tests/projects/test_conftest.py @@ -2,7 +2,7 @@ import pytest -from libvcs.cmd.core import which +from libvcs.utils.run import which from libvcs.conftest import CreateProjectCallbackFixtureProtocol diff --git a/tests/projects/test_git.py b/tests/projects/test_git.py index 184dce41a..f72700400 100644 --- a/tests/projects/test_git.py +++ b/tests/projects/test_git.py @@ -10,7 +10,7 @@ from pytest_mock import MockerFixture from libvcs import exc -from libvcs.cmd.core import run, which +from libvcs.utils.run import run, which from libvcs.conftest import CreateProjectCallbackFixtureProtocol from libvcs.projects.git import ( GitFullRemoteDict, diff --git a/tests/projects/test_hg.py b/tests/projects/test_hg.py index 4d5ef7a9d..ff38bd27e 100644 --- a/tests/projects/test_hg.py +++ b/tests/projects/test_hg.py @@ -3,7 +3,7 @@ import pytest -from libvcs.cmd.core import run, which +from libvcs.utils.run import run, which from libvcs.shortcuts import create_project, create_project_from_pip_url if not which("hg"): diff --git a/tests/projects/test_svn.py b/tests/projects/test_svn.py index df4c55469..3f099ff5f 100644 --- a/tests/projects/test_svn.py +++ b/tests/projects/test_svn.py @@ -4,7 +4,7 @@ import pytest -from libvcs.cmd.core import which +from libvcs.utils.run import which from libvcs.conftest import CreateProjectCallbackFixtureProtocol from libvcs.projects.svn import SubversionProject from libvcs.shortcuts import create_project_from_pip_url From 85dba41931347e254b76791ce99786828319dfaa Mon Sep 17 00:00:00 2001 From: Tony Narlock Date: Sun, 15 May 2022 09:52:46 -0500 Subject: [PATCH 2/2] docs(CHANGES): Note moving of API --- CHANGES | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CHANGES b/CHANGES index b10967917..17a9b01fb 100644 --- a/CHANGES +++ b/CHANGES @@ -13,6 +13,11 @@ $ pip install --user --upgrade --pre libvcs - _Add your latest changes from PRs here_ +### Breaking changes + +- {issue}`343`: `libvcs.cmd.core` (including {func}`~libvcs.utils.run.run`) have been moved to + `libvcs.utils.run`. It will be supported as an unstable, internal API. + ### Internals - `StrOrPath` -> `StrPath`