bear-utils 0.8.4__tar.gz → 0.8.6__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 (109) hide show
  1. {bear_utils-0.8.4 → bear_utils-0.8.6}/.bumpversion.cfg +1 -1
  2. {bear_utils-0.8.4 → bear_utils-0.8.6}/AGENTS.md +1 -1
  3. {bear_utils-0.8.4 → bear_utils-0.8.6}/PKG-INFO +2 -2
  4. {bear_utils-0.8.4 → bear_utils-0.8.6}/README.md +1 -1
  5. {bear_utils-0.8.4 → bear_utils-0.8.6}/pyproject.toml +19 -7
  6. {bear_utils-0.8.4 → bear_utils-0.8.6}/src/bear_utils/cli/shell/_base_command.py +15 -6
  7. {bear_utils-0.8.4 → bear_utils-0.8.6}/src/bear_utils/cli/shell/_base_shell.py +4 -4
  8. {bear_utils-0.8.4 → bear_utils-0.8.6}/src/bear_utils/extras/responses/function_response.py +4 -4
  9. {bear_utils-0.8.4 → bear_utils-0.8.6}/.gitignore +0 -0
  10. {bear_utils-0.8.4 → bear_utils-0.8.6}/.python-version +0 -0
  11. {bear_utils-0.8.4 → bear_utils-0.8.6}/config/coverage.ini +0 -0
  12. {bear_utils-0.8.4 → bear_utils-0.8.6}/config/default.toml +0 -0
  13. {bear_utils-0.8.4 → bear_utils-0.8.6}/config/git-changelog.toml +0 -0
  14. {bear_utils-0.8.4 → bear_utils-0.8.6}/config/pytest.ini +0 -0
  15. {bear_utils-0.8.4 → bear_utils-0.8.6}/config/ruff.toml +0 -0
  16. {bear_utils-0.8.4 → bear_utils-0.8.6}/config/vscode/launch.json +0 -0
  17. {bear_utils-0.8.4 → bear_utils-0.8.6}/config/vscode/settings.json +0 -0
  18. {bear_utils-0.8.4 → bear_utils-0.8.6}/config/vscode/tasks.json +0 -0
  19. {bear_utils-0.8.4 → bear_utils-0.8.6}/directory_structure.txt +0 -0
  20. {bear_utils-0.8.4 → bear_utils-0.8.6}/maskfile.md +0 -0
  21. {bear_utils-0.8.4 → bear_utils-0.8.6}/noxfile.py +0 -0
  22. {bear_utils-0.8.4 → bear_utils-0.8.6}/src/bear_utils/__init__.py +0 -0
  23. {bear_utils-0.8.4 → bear_utils-0.8.6}/src/bear_utils/__main__.py +0 -0
  24. {bear_utils-0.8.4 → bear_utils-0.8.6}/src/bear_utils/_internal/__init__.py +0 -0
  25. {bear_utils-0.8.4 → bear_utils-0.8.6}/src/bear_utils/_internal/cli.py +0 -0
  26. {bear_utils-0.8.4 → bear_utils-0.8.6}/src/bear_utils/_internal/debug.py +0 -0
  27. {bear_utils-0.8.4 → bear_utils-0.8.6}/src/bear_utils/ai/__init__.py +0 -0
  28. {bear_utils-0.8.4 → bear_utils-0.8.6}/src/bear_utils/ai/ai_helpers/__init__.py +0 -0
  29. {bear_utils-0.8.4 → bear_utils-0.8.6}/src/bear_utils/ai/ai_helpers/_common.py +0 -0
  30. {bear_utils-0.8.4 → bear_utils-0.8.6}/src/bear_utils/ai/ai_helpers/_config.py +0 -0
  31. {bear_utils-0.8.4 → bear_utils-0.8.6}/src/bear_utils/ai/ai_helpers/_parsers.py +0 -0
  32. {bear_utils-0.8.4 → bear_utils-0.8.6}/src/bear_utils/ai/ai_helpers/_types.py +0 -0
  33. {bear_utils-0.8.4 → bear_utils-0.8.6}/src/bear_utils/cache/__init__.py +0 -0
  34. {bear_utils-0.8.4 → bear_utils-0.8.6}/src/bear_utils/cli/__init__.py +0 -0
  35. {bear_utils-0.8.4 → bear_utils-0.8.6}/src/bear_utils/cli/commands.py +0 -0
  36. {bear_utils-0.8.4 → bear_utils-0.8.6}/src/bear_utils/cli/prompt_helpers.py +0 -0
  37. {bear_utils-0.8.4 → bear_utils-0.8.6}/src/bear_utils/cli/shell/__init__.py +0 -0
  38. {bear_utils-0.8.4 → bear_utils-0.8.6}/src/bear_utils/cli/shell/_common.py +0 -0
  39. {bear_utils-0.8.4 → bear_utils-0.8.6}/src/bear_utils/config/__init__.py +0 -0
  40. {bear_utils-0.8.4 → bear_utils-0.8.6}/src/bear_utils/config/config_manager.py +0 -0
  41. {bear_utils-0.8.4 → bear_utils-0.8.6}/src/bear_utils/config/dir_manager.py +0 -0
  42. {bear_utils-0.8.4 → bear_utils-0.8.6}/src/bear_utils/config/settings_manager.py +0 -0
  43. {bear_utils-0.8.4 → bear_utils-0.8.6}/src/bear_utils/constants/__init__.py +0 -0
  44. {bear_utils-0.8.4 → bear_utils-0.8.6}/src/bear_utils/constants/_exceptions.py +0 -0
  45. {bear_utils-0.8.4 → bear_utils-0.8.6}/src/bear_utils/constants/_lazy_typing.py +0 -0
  46. {bear_utils-0.8.4 → bear_utils-0.8.6}/src/bear_utils/constants/date_related.py +0 -0
  47. {bear_utils-0.8.4 → bear_utils-0.8.6}/src/bear_utils/constants/logger_protocol.py +0 -0
  48. {bear_utils-0.8.4 → bear_utils-0.8.6}/src/bear_utils/constants/time_related.py +0 -0
  49. {bear_utils-0.8.4 → bear_utils-0.8.6}/src/bear_utils/database/__init__.py +0 -0
  50. {bear_utils-0.8.4 → bear_utils-0.8.6}/src/bear_utils/database/_db_manager.py +0 -0
  51. {bear_utils-0.8.4 → bear_utils-0.8.6}/src/bear_utils/events/__init__.py +0 -0
  52. {bear_utils-0.8.4 → bear_utils-0.8.6}/src/bear_utils/events/events_class.py +0 -0
  53. {bear_utils-0.8.4 → bear_utils-0.8.6}/src/bear_utils/events/events_module.py +0 -0
  54. {bear_utils-0.8.4 → bear_utils-0.8.6}/src/bear_utils/extras/__init__.py +0 -0
  55. {bear_utils-0.8.4 → bear_utils-0.8.6}/src/bear_utils/extras/_async_helpers.py +0 -0
  56. {bear_utils-0.8.4 → bear_utils-0.8.6}/src/bear_utils/extras/_tools.py +0 -0
  57. {bear_utils-0.8.4 → bear_utils-0.8.6}/src/bear_utils/extras/platform_utils.py +0 -0
  58. {bear_utils-0.8.4 → bear_utils-0.8.6}/src/bear_utils/extras/responses/__init__.py +0 -0
  59. {bear_utils-0.8.4 → bear_utils-0.8.6}/src/bear_utils/extras/wrappers/__init__.py +0 -0
  60. {bear_utils-0.8.4 → bear_utils-0.8.6}/src/bear_utils/extras/wrappers/add_methods.py +0 -0
  61. {bear_utils-0.8.4 → bear_utils-0.8.6}/src/bear_utils/files/__init__.py +0 -0
  62. {bear_utils-0.8.4 → bear_utils-0.8.6}/src/bear_utils/files/file_handlers/__init__.py +0 -0
  63. {bear_utils-0.8.4 → bear_utils-0.8.6}/src/bear_utils/files/file_handlers/_base_file_handler.py +0 -0
  64. {bear_utils-0.8.4 → bear_utils-0.8.6}/src/bear_utils/files/file_handlers/file_handler_factory.py +0 -0
  65. {bear_utils-0.8.4 → bear_utils-0.8.6}/src/bear_utils/files/file_handlers/json_file_handler.py +0 -0
  66. {bear_utils-0.8.4 → bear_utils-0.8.6}/src/bear_utils/files/file_handlers/log_file_handler.py +0 -0
  67. {bear_utils-0.8.4 → bear_utils-0.8.6}/src/bear_utils/files/file_handlers/toml_file_handler.py +0 -0
  68. {bear_utils-0.8.4 → bear_utils-0.8.6}/src/bear_utils/files/file_handlers/txt_file_handler.py +0 -0
  69. {bear_utils-0.8.4 → bear_utils-0.8.6}/src/bear_utils/files/file_handlers/yaml_file_handler.py +0 -0
  70. {bear_utils-0.8.4 → bear_utils-0.8.6}/src/bear_utils/files/ignore_parser.py +0 -0
  71. {bear_utils-0.8.4 → bear_utils-0.8.6}/src/bear_utils/graphics/__init__.py +0 -0
  72. {bear_utils-0.8.4 → bear_utils-0.8.6}/src/bear_utils/graphics/bear_gradient.py +0 -0
  73. {bear_utils-0.8.4 → bear_utils-0.8.6}/src/bear_utils/graphics/image_helpers.py +0 -0
  74. {bear_utils-0.8.4 → bear_utils-0.8.6}/src/bear_utils/gui/__init__.py +0 -0
  75. {bear_utils-0.8.4 → bear_utils-0.8.6}/src/bear_utils/gui/gui_tools/__init__.py +0 -0
  76. {bear_utils-0.8.4 → bear_utils-0.8.6}/src/bear_utils/gui/gui_tools/_settings.py +0 -0
  77. {bear_utils-0.8.4 → bear_utils-0.8.6}/src/bear_utils/gui/gui_tools/_types.py +0 -0
  78. {bear_utils-0.8.4 → bear_utils-0.8.6}/src/bear_utils/gui/gui_tools/qt_app.py +0 -0
  79. {bear_utils-0.8.4 → bear_utils-0.8.6}/src/bear_utils/gui/gui_tools/qt_color_picker.py +0 -0
  80. {bear_utils-0.8.4 → bear_utils-0.8.6}/src/bear_utils/gui/gui_tools/qt_file_handler.py +0 -0
  81. {bear_utils-0.8.4 → bear_utils-0.8.6}/src/bear_utils/gui/gui_tools/qt_input_dialog.py +0 -0
  82. {bear_utils-0.8.4 → bear_utils-0.8.6}/src/bear_utils/logger_manager/__init__.py +0 -0
  83. {bear_utils-0.8.4 → bear_utils-0.8.6}/src/bear_utils/logger_manager/_common.py +0 -0
  84. {bear_utils-0.8.4 → bear_utils-0.8.6}/src/bear_utils/logger_manager/_console_junk.py +0 -0
  85. {bear_utils-0.8.4 → bear_utils-0.8.6}/src/bear_utils/logger_manager/_styles.py +0 -0
  86. {bear_utils-0.8.4 → bear_utils-0.8.6}/src/bear_utils/logger_manager/loggers/__init__.py +0 -0
  87. {bear_utils-0.8.4 → bear_utils-0.8.6}/src/bear_utils/logger_manager/loggers/_base_logger.py +0 -0
  88. {bear_utils-0.8.4 → bear_utils-0.8.6}/src/bear_utils/logger_manager/loggers/_base_logger.pyi +0 -0
  89. {bear_utils-0.8.4 → bear_utils-0.8.6}/src/bear_utils/logger_manager/loggers/_buffer_logger.py +0 -0
  90. {bear_utils-0.8.4 → bear_utils-0.8.6}/src/bear_utils/logger_manager/loggers/_console_logger.py +0 -0
  91. {bear_utils-0.8.4 → bear_utils-0.8.6}/src/bear_utils/logger_manager/loggers/_console_logger.pyi +0 -0
  92. {bear_utils-0.8.4 → bear_utils-0.8.6}/src/bear_utils/logger_manager/loggers/_file_logger.py +0 -0
  93. {bear_utils-0.8.4 → bear_utils-0.8.6}/src/bear_utils/logger_manager/loggers/_level_sin.py +0 -0
  94. {bear_utils-0.8.4 → bear_utils-0.8.6}/src/bear_utils/logger_manager/loggers/_logger.py +0 -0
  95. {bear_utils-0.8.4 → bear_utils-0.8.6}/src/bear_utils/logger_manager/loggers/_sub_logger.py +0 -0
  96. {bear_utils-0.8.4 → bear_utils-0.8.6}/src/bear_utils/logger_manager/loggers/_sub_logger.pyi +0 -0
  97. {bear_utils-0.8.4 → bear_utils-0.8.6}/src/bear_utils/monitoring/__init__.py +0 -0
  98. {bear_utils-0.8.4 → bear_utils-0.8.6}/src/bear_utils/monitoring/_common.py +0 -0
  99. {bear_utils-0.8.4 → bear_utils-0.8.6}/src/bear_utils/monitoring/host_monitor.py +0 -0
  100. {bear_utils-0.8.4 → bear_utils-0.8.6}/src/bear_utils/time/__init__.py +0 -0
  101. {bear_utils-0.8.4 → bear_utils-0.8.6}/tests/__init__.py +0 -0
  102. {bear_utils-0.8.4 → bear_utils-0.8.6}/tests/test_add_ord_suffix.py +0 -0
  103. {bear_utils-0.8.4 → bear_utils-0.8.6}/tests/test_clipboard.py +0 -0
  104. {bear_utils-0.8.4 → bear_utils-0.8.6}/tests/test_default_shell.py +0 -0
  105. {bear_utils-0.8.4 → bear_utils-0.8.6}/tests/test_function_response.py +0 -0
  106. {bear_utils-0.8.4 → bear_utils-0.8.6}/tests/test_gradient.py +0 -0
  107. {bear_utils-0.8.4 → bear_utils-0.8.6}/tests/test_logger.py +0 -0
  108. {bear_utils-0.8.4 → bear_utils-0.8.6}/tests/test_platform_utils.py +0 -0
  109. {bear_utils-0.8.4 → bear_utils-0.8.6}/uv.lock +0 -0
@@ -1,5 +1,5 @@
1
1
  [bumpversion]
2
- current_version = 0.8.4
2
+ current_version = 0.8.6
3
3
 
4
4
  [bumpversion:file:pyproject.toml]
5
5
 
@@ -5,7 +5,7 @@
5
5
  - Python Version and Typing: Assume Python 3.12 or higher is being used. Because of that we SHOULD use the latest typing features available in Python 3.12 and later. Never use `Optional`, `Union`, or `Dict, List, Tuple` from `typing` module. Instead, use the built-in types directly, e.g., `list`, `dict`, `tuple`, and use `|` for union types. This is not an exhaustive list, so be thoughtful about any potentially deprecated types you might use. If you are not sure about something, ask the user.
6
6
  - Type Annotations: Use type annotations as often as possible. If a function has no return value, use `None` as the return type. If a function returns a value, use the appropriate type annotation but don't bend over backwards to make it perfect. If you are not sure about the type, use `Any` as a fallback but use this sparingly, see it as a failure and you should endeavor to avoid using `Any` as much as possible.
7
7
  - Docstrings: Use docstrings for most (95%) public functions and classes. The docstring should describe the purpose of the function or class, its parameters, and its return value. Use the Google style for docstrings. Because of this it is highly preferred to not use comments in the code unless absolutely necessary. If you feel like you need to use a comment, consider if the code can be refactored to make it more readable instead.
8
- - Imports: Use relative imports for everything (beyond the obvious imports for external packages) in this current package. Keep imports clean using `isort src tests` and `black src tests -l 120` to format the code in that order.
8
+ - Imports: Use relative imports for everything (beyond the obvious imports for external packages) in this current package. Keep imports clean using `nox -s ruff_fix` to automatically fix import order and unused imports. If you are not sure about the import order, use `nox -s ruff_check` to check the import order and unused imports. If you are not sure about a specific import, ask the user.
9
9
  - Endeavor to use a TDD approach when writing new code. Write tests first, then write the code to make the tests pass and then refactor the code to make it cleaner and more readable.
10
10
  - There is a `directory_structure.txt` file in the root of the repository that describes the directory structure of the project. Use this as a quick way to understand the project structure and where to place new files or modules.
11
11
  - While projects might partially use Poetry, UV is generally the preferred tool for managing dependencies and virtual environments. It is taking me some time to get used to it, so please bear with me. If you are not sure about something, ask the user. If a dependency is not available, then you will need to request the user to add it to the `pyproject.toml` file.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: bear-utils
3
- Version: 0.8.4
3
+ Version: 0.8.6
4
4
  Summary: Various utilities for Bear programmers, including a rich logging utility, a disk cache, and a SQLite database wrapper amongst other things.
5
5
  Author-email: chaz <bright.lid5647@fastmail.com>
6
6
  Requires-Python: >=3.12
@@ -20,7 +20,7 @@ Requires-Dist: tinydb>=4.8.2
20
20
  Requires-Dist: toml>=0.10.2
21
21
  Description-Content-Type: text/markdown
22
22
 
23
- # Bear Utils v# Bear Utils v0.8.4
23
+ # Bear Utils v# Bear Utils v0.8.6
24
24
 
25
25
  Personal set of tools and utilities for Python projects, focusing on modularity and ease of use. This library includes components for caching, database management, logging, time handling, file operations, CLI prompts, image processing, clipboard interaction, gradient utilities, event systems, and async helpers.
26
26
 
@@ -1,4 +1,4 @@
1
- # Bear Utils v# Bear Utils v0.8.4
1
+ # Bear Utils v# Bear Utils v0.8.6
2
2
 
3
3
  Personal set of tools and utilities for Python projects, focusing on modularity and ease of use. This library includes components for caching, database management, logging, time handling, file operations, CLI prompts, image processing, clipboard interaction, gradient utilities, event systems, and async helpers.
4
4
 
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "bear-utils"
3
- version = "0.8.4"
3
+ version = "0.8.6"
4
4
  description = "Various utilities for Bear programmers, including a rich logging utility, a disk cache, and a SQLite database wrapper amongst other things."
5
5
  authors = [{ name = "chaz", email = "bright.lid5647@fastmail.com" }]
6
6
  readme = "README.md"
@@ -27,19 +27,31 @@ requires = ["hatchling"]
27
27
  build-backend = "hatchling.build"
28
28
 
29
29
  [dependency-groups]
30
- dev = [
31
- "bump2version>=1.0.1",
32
- "coverage>=7.9.2",
33
- "isort>=6.0.1",
30
+ maintain = [
31
+ "git-changelog>=2.5",
32
+ "yore>=0.3.3",
33
+ "griffe>=1.7.3",
34
+ ]
35
+ ci = [
36
+ "ruff>=0.4",
37
+ "pytest>=8.2",
38
+ "pytest-cov>=5.0",
39
+ "pytest-randomly>=3.15",
40
+ "pytest-xdist>=3.6",
41
+ "pyright>=1.1",
42
+ "types-markdown>=3.6",
43
+ "types-pyyaml>=6.0",
34
44
  "nox>=2025.5.1",
35
- "pytest>=8.3.5",
36
- "pytest-cov>=6.2.1",
45
+ "bump2version>=1.0.1",
37
46
  "twine>=6.1.0",
38
47
  ]
39
48
  gui = [
40
49
  "pyqt6>=6.9.0",
41
50
  ]
42
51
 
52
+ [tool.uv]
53
+ default-groups = ["maintain", "ci"]
54
+
43
55
  [tool.pytest.ini_options]
44
56
  testpaths = ["tests"]
45
57
  pythonpath = ["src"]
@@ -1,4 +1,5 @@
1
- from typing import TYPE_CHECKING, Any, ClassVar, LiteralString, Self, cast
1
+ from subprocess import CompletedProcess
2
+ from typing import TYPE_CHECKING, Any, ClassVar, Self
2
3
 
3
4
  if TYPE_CHECKING:
4
5
  from subprocess import CompletedProcess
@@ -49,9 +50,9 @@ class BaseShellCommand[T: str]:
49
50
  @property
50
51
  def cmd(self) -> str:
51
52
  """Return the full command as a string"""
52
- cmd_parts = [self.command_name, self.sub_command, *self.args]
53
- cmd_parts = [part for part in cmd_parts if part]
54
- joined: LiteralString = " ".join(cmd_parts).strip()
53
+ cmd_parts: list[str] = [self.command_name, self.sub_command, *self.args]
54
+ cmd_parts: list[str] = [part for part in cmd_parts if part]
55
+ joined: str = " ".join(cmd_parts).strip()
55
56
  if self.suffix:
56
57
  return f"{joined} {self.suffix}"
57
58
  return joined
@@ -61,11 +62,19 @@ class BaseShellCommand[T: str]:
61
62
  from ._base_shell import shell_session # noqa: PLC0415
62
63
 
63
64
  with shell_session(**kwargs) as session:
64
- result = session.add(self.cmd).run()
65
+ result: CompletedProcess[str] = session.add(self.cmd).run()
65
66
  if result is not None:
66
- self.result = cast("CompletedProcess[str]", result)
67
+ self.result = result
67
68
  return self
68
69
 
70
+ def get_result(self) -> CompletedProcess[str]:
71
+ """Get the result of the command execution"""
72
+ if self.result is None:
73
+ self.do()
74
+ if self.result is None:
75
+ raise RuntimeError("Command execution failed for some reason.")
76
+ return self.result
77
+
69
78
  def get(self) -> str:
70
79
  """Get the result of the command execution"""
71
80
  if self.result is None:
@@ -147,7 +147,7 @@ class SimpleShellSession:
147
147
  self.cmd_buffer.write(str(c))
148
148
  return self
149
149
 
150
- def _run(self, command: str) -> CompletedProcess[str] | Process:
150
+ def _run(self, command: str) -> CompletedProcess[str]:
151
151
  """Internal method to run the accumulated command"""
152
152
  self.logger.verbose(f"Executing: {command}")
153
153
  self.next_cmd()
@@ -180,7 +180,7 @@ class SimpleShellSession:
180
180
  self.reset_buffer()
181
181
  return self.result
182
182
 
183
- def run(self, cmd: str | BaseShellCommand | None = None, *args) -> CompletedProcess[str] | Process:
183
+ def run(self, cmd: str | BaseShellCommand | None = None, *args) -> CompletedProcess[str]:
184
184
  """Run the accumulated command history"""
185
185
  if self.empty_history and cmd is None:
186
186
  raise ValueError("No commands to run")
@@ -191,12 +191,12 @@ class SimpleShellSession:
191
191
  )
192
192
 
193
193
  if self.has_history and cmd is None:
194
- result: CompletedProcess[str] | Process = self._run(self.cmd)
194
+ result: CompletedProcess[str] = self._run(self.cmd)
195
195
  elif self.empty_history and cmd is not None:
196
196
  self.cmd_buffer.write(f"{cmd} ")
197
197
  if args:
198
198
  self.cmd_buffer.write(" ".join(map(str, args)))
199
- result: CompletedProcess[str] | Process = self._run(self.cmd)
199
+ result: CompletedProcess[str] = self._run(self.cmd)
200
200
  else:
201
201
  raise ValueError("Unexpected state")
202
202
  self.reset_buffer()
@@ -269,15 +269,15 @@ class FunctionResponse(BaseModel):
269
269
  if content is not None and error is None:
270
270
  if isinstance(content, list):
271
271
  for item in content:
272
- logger.info(message=f"{self.name}: {item}" if self.name else item)
272
+ logger.info(f"{self.name}: {item}" if self.name else item)
273
273
  elif isinstance(content, str):
274
- logger.info(message=f"{self.name}: {content}" if self.name else content)
274
+ logger.info(f"{self.name}: {content}" if self.name else content)
275
275
  elif error is not None and content is None:
276
276
  if isinstance(error, list):
277
277
  for err in error:
278
- logger.error(message=f"{self.name}: {err}" if self.name else err)
278
+ logger.error(f"{self.name}: {err}" if self.name else err)
279
279
  elif isinstance(error, str):
280
- logger.error(message=f"{self.name}: {error}" if self.name else error)
280
+ logger.error(f"{self.name}: {error}" if self.name else error)
281
281
 
282
282
  @overload
283
283
  def done(self, to_dict: Literal[True], suppress: list[str] | None = None) -> dict[str, Any]: ...
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes