hydev 3.2.0__tar.gz → 4.1.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.
@@ -1,12 +1,12 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: hydev
3
- Version: 3.2.0
3
+ Version: 4.1.0
4
4
  Summary: Common tooling and configuration for pythonic development
5
5
  Project-URL: Repository, https://gitlab.com/hoverhell/hydev
6
6
  Author-email: hoverhell <hoverhell@gmail.com>
7
7
  License-Expression: MIT
8
8
  License-File: LICENSE
9
- Requires-Python: ~=3.11
9
+ Requires-Python: <4,>=3.11
10
10
  Requires-Dist: autoflake<3,>=2.3.1
11
11
  Requires-Dist: black<26,>=25.1.0
12
12
  Requires-Dist: click<9,>=8.1.8
@@ -22,8 +22,6 @@ Requires-Dist: humanfriendly>=10.0
22
22
  Requires-Dist: ipdb<0.14,>=0.13.13
23
23
  Requires-Dist: isort<7,>=6.0.1
24
24
  Requires-Dist: mypy<2,>=1.15.0
25
- Requires-Dist: poetry-plugin-up>=0.9.0
26
- Requires-Dist: poetry<3,>=2.1.2
27
25
  Requires-Dist: pre-commit<5,>=4.2.0
28
26
  Requires-Dist: pytest-asyncio<0.27,>=0.26.0
29
27
  Requires-Dist: pytest-blockage<0.3,>=0.2.4
@@ -1,16 +1,15 @@
1
1
  [project]
2
2
  name = "hydev"
3
- version = "3.2.0"
3
+ version = "4.1.0"
4
4
  description = "Common tooling and configuration for pythonic development"
5
5
  authors = [{ name = "hoverhell", email = "hoverhell@gmail.com" }]
6
- requires-python = "~=3.11"
6
+ requires-python = ">=3.11,<4"
7
7
  readme = "README.md"
8
8
  license = "MIT"
9
9
  dependencies = [
10
10
  "click>=8.1.8,<9",
11
11
  "pyyaml>=6.0.2,<7",
12
12
  "toml>=0.10.2,<0.11",
13
- "poetry>=2.1.2,<3",
14
13
  "pre-commit>=4.2.0,<5",
15
14
  "coloredlogs>=15.0.1,<16",
16
15
  "ipdb>=0.13.13,<0.14",
@@ -32,7 +31,6 @@ dependencies = [
32
31
  "pytest-deadfixtures>=2.2.1,<3",
33
32
  "pytest-env>=1.1.5,<2",
34
33
  "pytest-timeout>=2.3.1,<3",
35
- "poetry-plugin-up>=0.9.0",
36
34
  "ruff>=0.11.6",
37
35
  "uv>=0.6.14",
38
36
  "humanfriendly>=10.0",
@@ -1,5 +1,6 @@
1
1
  #!/usr/bin/env python3
2
2
 
3
+ import argparse
3
4
  import contextlib
4
5
  import json
5
6
  import os
@@ -104,11 +105,13 @@ def preprocess_line(line: bytes | str) -> bytes | str | dict[str, Any]:
104
105
  class ColoredFormatterHelper:
105
106
  log_fmt: str = LOG_FMT
106
107
 
107
- def __init__(self, out_stream: Any) -> None:
108
- self.coloredlogs_formatter = coloredlogs.ColoredFormatter()
109
- self.use_colors = (
110
- not os.environ.get("NO_COLOR") and terminal_supports_colors(out_stream) and enable_ansi_support()
108
+ def __init__(self, out_stream: Any, *, no_color: bool = False, force_color: bool = False) -> None:
109
+ self.no_color = no_color
110
+ self.force_color = force_color
111
+ self.use_colors = self.force_color or (
112
+ not self.no_color and terminal_supports_colors(out_stream) and enable_ansi_support()
111
113
  )
114
+ self.coloredlogs_formatter = coloredlogs.ColoredFormatter()
112
115
  self.log_fmt_colorized = (
113
116
  self.coloredlogs_formatter.colorize_format(self.log_fmt) if self.use_colors else self.log_fmt
114
117
  )
@@ -122,9 +125,9 @@ class ColoredFormatterHelper:
122
125
  return self.log_fmt_colorized % data
123
126
 
124
127
 
125
- def main_inner(log: Iterable[str]) -> None:
128
+ def main_inner(log: Iterable[str], *, no_color: bool = False, force_color: bool = False) -> None:
126
129
  out_stream = sys.stdout
127
- formatter_helper = ColoredFormatterHelper(out_stream=out_stream)
130
+ formatter_helper = ColoredFormatterHelper(out_stream=out_stream, no_color=no_color, force_color=force_color)
128
131
  for line in log:
129
132
  output: str | None = None
130
133
 
@@ -145,8 +148,25 @@ def _stdin_has_data(timeout_sec: float = 0.05) -> bool:
145
148
  return bool(ready)
146
149
 
147
150
 
151
+ CLI_PARSER = argparse.ArgumentParser(description="Format `hyapp` json logs for the eyes")
152
+ CLI_PARSER.add_argument("source", nargs="?", default="-", help=("File to read (defaults to '-' i.e. read from stdin)"))
153
+ CLI_PARSER.add_argument(
154
+ "-c",
155
+ "--color",
156
+ action="store_true",
157
+ help="Force color output regardless of the terminal",
158
+ )
159
+ CLI_PARSER.add_argument(
160
+ "--no-color",
161
+ action="store_true",
162
+ help="Disable color output regardless of the terminal",
163
+ )
164
+
165
+
148
166
  def main() -> None:
149
- filepath = sys.argv[1] if len(sys.argv) > 1 else "-"
167
+ params = CLI_PARSER.parse_args(sys.argv[1:])
168
+ filepath = params.source
169
+
150
170
  with contextlib.ExitStack() as cm:
151
171
  if filepath == "-":
152
172
  if not _stdin_has_data():
@@ -156,7 +176,7 @@ def main() -> None:
156
176
  fileobj = sys.stdin
157
177
  else:
158
178
  fileobj = cm.enter_context(Path(filepath).open())
159
- main_inner(fileobj)
179
+ main_inner(fileobj, force_color=params.color, no_color=params.no_color or bool(os.environ.get("NO_COLOR")))
160
180
 
161
181
 
162
182
  if __name__ == "__main__":
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes