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.
Files changed (31) hide show
  1. {ask_shell-0.8.0 → ask_shell-0.9.0}/PKG-INFO +1 -1
  2. {ask_shell-0.8.0 → ask_shell-0.9.0}/ask_shell/__init__.py +1 -1
  3. {ask_shell-0.8.0 → ask_shell-0.9.0}/ask_shell/_internal/_run_env.py +14 -1
  4. {ask_shell-0.8.0 → ask_shell-0.9.0}/ask_shell/console.py +2 -0
  5. {ask_shell-0.8.0 → ask_shell-0.9.0}/ask_shell/settings.py +6 -0
  6. {ask_shell-0.8.0 → ask_shell-0.9.0}/pyproject.toml +1 -1
  7. {ask_shell-0.8.0 → ask_shell-0.9.0}/.gitignore +0 -0
  8. {ask_shell-0.8.0 → ask_shell-0.9.0}/LICENSE +0 -0
  9. {ask_shell-0.8.0 → ask_shell-0.9.0}/README.md +0 -0
  10. {ask_shell-0.8.0 → ask_shell-0.9.0}/ask_shell/__main__.py +0 -0
  11. {ask_shell-0.8.0 → ask_shell-0.9.0}/ask_shell/_internal/__init__.py +0 -0
  12. {ask_shell-0.8.0 → ask_shell-0.9.0}/ask_shell/_internal/_run.py +0 -0
  13. {ask_shell-0.8.0 → ask_shell-0.9.0}/ask_shell/_internal/events.py +0 -0
  14. {ask_shell-0.8.0 → ask_shell-0.9.0}/ask_shell/_internal/global_callbacks.py +0 -0
  15. {ask_shell-0.8.0 → ask_shell-0.9.0}/ask_shell/_internal/interactive.py +0 -0
  16. {ask_shell-0.8.0 → ask_shell-0.9.0}/ask_shell/_internal/models.py +0 -0
  17. {ask_shell-0.8.0 → ask_shell-0.9.0}/ask_shell/_internal/rich_live.py +0 -0
  18. {ask_shell-0.8.0 → ask_shell-0.9.0}/ask_shell/_internal/rich_live_callback.py +0 -0
  19. {ask_shell-0.8.0 → ask_shell-0.9.0}/ask_shell/_internal/rich_progress.py +0 -0
  20. {ask_shell-0.8.0 → ask_shell-0.9.0}/ask_shell/_internal/rich_run_state.py +0 -0
  21. {ask_shell-0.8.0 → ask_shell-0.9.0}/ask_shell/_internal/run_pool.py +0 -0
  22. {ask_shell-0.8.0 → ask_shell-0.9.0}/ask_shell/_internal/typer_command.py +0 -0
  23. {ask_shell-0.8.0 → ask_shell-0.9.0}/ask_shell/ask.py +0 -0
  24. {ask_shell-0.8.0 → ask_shell-0.9.0}/ask_shell/py.typed +0 -0
  25. {ask_shell-0.8.0 → ask_shell-0.9.0}/ask_shell/shell.py +0 -0
  26. {ask_shell-0.8.0 → ask_shell-0.9.0}/ask_shell/shell_events.py +0 -0
  27. {ask_shell-0.8.0 → ask_shell-0.9.0}/ask_shell/test_docs.py +0 -0
  28. {ask_shell-0.8.0 → ask_shell-0.9.0}/examples/apply_live/__init__.py +0 -0
  29. {ask_shell-0.8.0 → ask_shell-0.9.0}/examples/apply_live/cli.py +0 -0
  30. {ask_shell-0.8.0 → ask_shell-0.9.0}/examples/apply_live/stream_handler.py +0 -0
  31. {ask_shell-0.8.0 → ask_shell-0.9.0}/scripts/fix_source_links.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ask-shell
3
- Version: 0.8.0
3
+ Version: 0.9.0
4
4
  Summary: CLIs with prompts, shell runs, and testable flows
5
5
  Author-email: EspenAlbert <espen.albert1@gmail.com>
6
6
  License-Expression: MIT
@@ -7,7 +7,7 @@ from ask_shell import ask
7
7
  from ask_shell.settings import AskShellSettings
8
8
  from ask_shell.settings import ShellRunSummary
9
9
 
10
- VERSION = "0.8.0"
10
+ VERSION = "0.9.0"
11
11
  __all__ = [
12
12
  "shell",
13
13
  "console",
@@ -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
- if AskShellSettings.from_env().force_interactive_shell:
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,
@@ -2,7 +2,7 @@
2
2
 
3
3
  [project]
4
4
  name = "ask-shell"
5
- version = "0.8.0"
5
+ version = "0.9.0"
6
6
  description = "CLIs with prompts, shell runs, and testable flows"
7
7
  requires-python = ">=3.13"
8
8
  license = "MIT"
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes