diff --git a/changelogs/fragments/119-nosh.yaml b/changelogs/fragments/119-nosh.yaml new file mode 100644 index 0000000..e5e71bb --- /dev/null +++ b/changelogs/fragments/119-nosh.yaml @@ -0,0 +1,6 @@ +--- +removed_features: + - "Remove dependency on ``sh`` + (https://github.com/ansible-community/antsibull-core/pull/119)." + - "``venv`` - remove ``get_command()`` method from ``VenvRunner`` and ``FakeVenvRunner`` + (https://github.com/ansible-community/antsibull-core/pull/119)." diff --git a/pyproject.toml b/pyproject.toml index 415a676..20babf6 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -38,9 +38,6 @@ dependencies = [ "pydantic >= 1.0.0, < 2.0.0", "PyYAML", "semantic_version", - # sh v2 has breaking changes. - # https://github.com/ansible-community/antsibull-core/issues/34 - "sh >= 1.0.0, < 2.0.0", # 0.5.0 introduces dict_config "twiggy >= 0.5.0", ] diff --git a/src/antsibull_core/venv.py b/src/antsibull_core/venv.py index cccf5ce..cacf218 100644 --- a/src/antsibull_core/venv.py +++ b/src/antsibull_core/venv.py @@ -14,8 +14,6 @@ from collections.abc import Sequence from typing import TYPE_CHECKING, NoReturn -import sh # type: ignore[import] - from antsibull_core import subprocess_util if TYPE_CHECKING: @@ -41,10 +39,9 @@ class VenvRunner: """ Makes running a command in a venv easy. - Combines venv functionality with sh. + Combines venv functionality with ``antsibull_core.subprocess_util``. .. seealso:: - * `sh `_ * :python:mod:`venv` """ @@ -71,19 +68,6 @@ def __init__(self, name: str, top_dir: StrPath) -> None: self.log_run(["pip", "install", "--upgrade", "pip"]) - def get_command(self, executable_name) -> sh.Command: - """ - Return an :sh:obj:`sh.Command` for the given program installed within the venv. - - :arg executable_name: Program to return a command for. - :returns: An :obj:`sh.Command` that will invoke the program. - - .. deprecated:: 2.0.0 - This method is deprecated in favor of :method:`asnyc_log_run` and - :method:`log_run`. It will be removed in antsibull_core 3.0.0. - """ - return sh.Command(os.path.join(self.venv_dir, "bin", executable_name)) - def install_package(self, package_name: str) -> subprocess.CompletedProcess: """ Install a python package into the venv. @@ -161,7 +145,6 @@ class FakeVenvRunner: Simply runs commands. .. seealso:: - * `sh `_ * :python:mod:`venv` """ @@ -220,20 +203,6 @@ def log_run( ) ) - @staticmethod - def get_command(executable_name) -> sh.Command: - """ - Return an :sh:obj:`sh.Command` for the given program installed within the venv. - - :arg executable_name: Program to return a command for. - :returns: An :obj:`sh.Command` that will invoke the program. - - .. deprecated:: 2.0.0 - This function is deprecated in favor of :method:`asnyc_log_run` and - :method:`log_run`. It will be removed in antsibull_core 3.0.0. - """ - return sh.Command(executable_name) - @staticmethod def install_package(package_name: str) -> NoReturn: """