ask-shell 0.8.0__tar.gz → 0.9.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {ask_shell-0.8.0 → ask_shell-0.9.0}/PKG-INFO +1 -1
- {ask_shell-0.8.0 → ask_shell-0.9.0}/ask_shell/__init__.py +1 -1
- {ask_shell-0.8.0 → ask_shell-0.9.0}/ask_shell/_internal/_run_env.py +14 -1
- {ask_shell-0.8.0 → ask_shell-0.9.0}/ask_shell/console.py +2 -0
- {ask_shell-0.8.0 → ask_shell-0.9.0}/ask_shell/settings.py +6 -0
- {ask_shell-0.8.0 → ask_shell-0.9.0}/pyproject.toml +1 -1
- {ask_shell-0.8.0 → ask_shell-0.9.0}/.gitignore +0 -0
- {ask_shell-0.8.0 → ask_shell-0.9.0}/LICENSE +0 -0
- {ask_shell-0.8.0 → ask_shell-0.9.0}/README.md +0 -0
- {ask_shell-0.8.0 → ask_shell-0.9.0}/ask_shell/__main__.py +0 -0
- {ask_shell-0.8.0 → ask_shell-0.9.0}/ask_shell/_internal/__init__.py +0 -0
- {ask_shell-0.8.0 → ask_shell-0.9.0}/ask_shell/_internal/_run.py +0 -0
- {ask_shell-0.8.0 → ask_shell-0.9.0}/ask_shell/_internal/events.py +0 -0
- {ask_shell-0.8.0 → ask_shell-0.9.0}/ask_shell/_internal/global_callbacks.py +0 -0
- {ask_shell-0.8.0 → ask_shell-0.9.0}/ask_shell/_internal/interactive.py +0 -0
- {ask_shell-0.8.0 → ask_shell-0.9.0}/ask_shell/_internal/models.py +0 -0
- {ask_shell-0.8.0 → ask_shell-0.9.0}/ask_shell/_internal/rich_live.py +0 -0
- {ask_shell-0.8.0 → ask_shell-0.9.0}/ask_shell/_internal/rich_live_callback.py +0 -0
- {ask_shell-0.8.0 → ask_shell-0.9.0}/ask_shell/_internal/rich_progress.py +0 -0
- {ask_shell-0.8.0 → ask_shell-0.9.0}/ask_shell/_internal/rich_run_state.py +0 -0
- {ask_shell-0.8.0 → ask_shell-0.9.0}/ask_shell/_internal/run_pool.py +0 -0
- {ask_shell-0.8.0 → ask_shell-0.9.0}/ask_shell/_internal/typer_command.py +0 -0
- {ask_shell-0.8.0 → ask_shell-0.9.0}/ask_shell/ask.py +0 -0
- {ask_shell-0.8.0 → ask_shell-0.9.0}/ask_shell/py.typed +0 -0
- {ask_shell-0.8.0 → ask_shell-0.9.0}/ask_shell/shell.py +0 -0
- {ask_shell-0.8.0 → ask_shell-0.9.0}/ask_shell/shell_events.py +0 -0
- {ask_shell-0.8.0 → ask_shell-0.9.0}/ask_shell/test_docs.py +0 -0
- {ask_shell-0.8.0 → ask_shell-0.9.0}/examples/apply_live/__init__.py +0 -0
- {ask_shell-0.8.0 → ask_shell-0.9.0}/examples/apply_live/cli.py +0 -0
- {ask_shell-0.8.0 → ask_shell-0.9.0}/examples/apply_live/stream_handler.py +0 -0
- {ask_shell-0.8.0 → ask_shell-0.9.0}/scripts/fix_source_links.py +0 -0
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import logging
|
|
2
|
+
import os
|
|
2
3
|
import sys
|
|
3
4
|
from functools import lru_cache
|
|
4
5
|
from os import getenv
|
|
@@ -26,7 +27,13 @@ def _not_interactive_reason() -> str:
|
|
|
26
27
|
|
|
27
28
|
@lru_cache
|
|
28
29
|
def interactive_shell() -> bool:
|
|
29
|
-
|
|
30
|
+
settings = AskShellSettings.from_env()
|
|
31
|
+
if settings.disable_interactive_shell:
|
|
32
|
+
logger.debug(
|
|
33
|
+
f"Interactive shell disabled by environment variable {settings.ENV_NAME_DISABLE_INTERACTIVE_SHELL}"
|
|
34
|
+
)
|
|
35
|
+
return False
|
|
36
|
+
if settings.force_interactive_shell:
|
|
30
37
|
logger.debug(
|
|
31
38
|
f"Interactive shell forced by environment variable {_global_settings.ENV_NAME_FORCE_INTERACTIVE_SHELL}"
|
|
32
39
|
)
|
|
@@ -37,6 +44,12 @@ def interactive_shell() -> bool:
|
|
|
37
44
|
return True
|
|
38
45
|
|
|
39
46
|
|
|
47
|
+
def disable_interactive_shell() -> None:
|
|
48
|
+
"""Force non-interactive mode for the remainder of this process."""
|
|
49
|
+
os.environ[AskShellSettings.ENV_NAME_DISABLE_INTERACTIVE_SHELL] = "true"
|
|
50
|
+
interactive_shell.cache_clear()
|
|
51
|
+
|
|
52
|
+
|
|
40
53
|
def resolve_terminal_dimensions(
|
|
41
54
|
settings: AskShellSettings | None = None,
|
|
42
55
|
) -> tuple[int | None, int | None]:
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
# Generated by pkg-ext
|
|
2
|
+
from ask_shell._internal._run_env import disable_interactive_shell as _disable_interactive_shell
|
|
2
3
|
from ask_shell._internal._run_env import interactive_shell as _interactive_shell
|
|
3
4
|
from ask_shell._internal.rich_live import RemoveLivePart as _RemoveLivePart
|
|
4
5
|
from ask_shell._internal.rich_live import add_renderable as _add_renderable
|
|
@@ -8,6 +9,7 @@ from ask_shell._internal.rich_live import print_to_live as _print_to_live
|
|
|
8
9
|
from ask_shell._internal.rich_progress import new_task as _new_task
|
|
9
10
|
from ask_shell._internal.typer_command import configure_logging as _configure_logging
|
|
10
11
|
|
|
12
|
+
disable_interactive_shell = _disable_interactive_shell
|
|
11
13
|
interactive_shell = _interactive_shell
|
|
12
14
|
RemoveLivePart = _RemoveLivePart
|
|
13
15
|
add_renderable = _add_renderable
|
|
@@ -106,6 +106,12 @@ class AskShellSettings(StaticSettings):
|
|
|
106
106
|
alias=ENV_NAME_FORCE_INTERACTIVE_SHELL,
|
|
107
107
|
description="Useful for testing",
|
|
108
108
|
)
|
|
109
|
+
ENV_NAME_DISABLE_INTERACTIVE_SHELL: ClassVar[str] = f"{ENV_PREFIX}DISABLE_INTERACTIVE_SHELL"
|
|
110
|
+
disable_interactive_shell: bool = Field(
|
|
111
|
+
default=False,
|
|
112
|
+
alias=ENV_NAME_DISABLE_INTERACTIVE_SHELL,
|
|
113
|
+
description="Force non-interactive mode for long-running servers and automation",
|
|
114
|
+
)
|
|
109
115
|
ENV_NAME_THREAD_COUNT: ClassVar[str] = f"{ENV_PREFIX}THREAD_COUNT"
|
|
110
116
|
thread_count: int = Field(
|
|
111
117
|
default=100,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|