oj-toolkit 0.2.1__tar.gz → 0.2.2__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 (35) hide show
  1. {oj_toolkit-0.2.1 → oj_toolkit-0.2.2}/PKG-INFO +7 -1
  2. {oj_toolkit-0.2.1 → oj_toolkit-0.2.2}/README.md +6 -0
  3. {oj_toolkit-0.2.1 → oj_toolkit-0.2.2}/oj_toolkit/console/terminal.py +17 -13
  4. {oj_toolkit-0.2.1 → oj_toolkit-0.2.2}/oj_toolkit.egg-info/PKG-INFO +7 -1
  5. {oj_toolkit-0.2.1 → oj_toolkit-0.2.2}/pyproject.toml +1 -1
  6. {oj_toolkit-0.2.1 → oj_toolkit-0.2.2}/LICENSE +0 -0
  7. {oj_toolkit-0.2.1 → oj_toolkit-0.2.2}/oj_toolkit/__init__.py +0 -0
  8. {oj_toolkit-0.2.1 → oj_toolkit-0.2.2}/oj_toolkit/asynchronous/__init__.py +0 -0
  9. {oj_toolkit-0.2.1 → oj_toolkit-0.2.2}/oj_toolkit/asynchronous/async_chunks.py +0 -0
  10. {oj_toolkit-0.2.1 → oj_toolkit-0.2.2}/oj_toolkit/asynchronous/decorators.py +0 -0
  11. {oj_toolkit-0.2.1 → oj_toolkit-0.2.2}/oj_toolkit/console/__init__.py +0 -0
  12. {oj_toolkit-0.2.1 → oj_toolkit-0.2.2}/oj_toolkit/console/box.py +0 -0
  13. {oj_toolkit-0.2.1 → oj_toolkit-0.2.2}/oj_toolkit/console/colored_text.py +0 -0
  14. {oj_toolkit-0.2.1 → oj_toolkit-0.2.2}/oj_toolkit/console/colors.py +0 -0
  15. {oj_toolkit-0.2.1 → oj_toolkit-0.2.2}/oj_toolkit/console/status.py +0 -0
  16. {oj_toolkit-0.2.1 → oj_toolkit-0.2.2}/oj_toolkit/console/streams.py +0 -0
  17. {oj_toolkit-0.2.1 → oj_toolkit-0.2.2}/oj_toolkit/console/table.py +0 -0
  18. {oj_toolkit-0.2.1 → oj_toolkit-0.2.2}/oj_toolkit/console/text.py +0 -0
  19. {oj_toolkit-0.2.1 → oj_toolkit-0.2.2}/oj_toolkit/data/__init__.py +0 -0
  20. {oj_toolkit-0.2.1 → oj_toolkit-0.2.2}/oj_toolkit/data/flex.py +0 -0
  21. {oj_toolkit-0.2.1 → oj_toolkit-0.2.2}/oj_toolkit/diagnostics.py +0 -0
  22. {oj_toolkit-0.2.1 → oj_toolkit-0.2.2}/oj_toolkit/logging/__init__.py +0 -0
  23. {oj_toolkit-0.2.1 → oj_toolkit-0.2.2}/oj_toolkit/logging/config.py +0 -0
  24. {oj_toolkit-0.2.1 → oj_toolkit-0.2.2}/oj_toolkit/logging/consts.py +0 -0
  25. {oj_toolkit-0.2.1 → oj_toolkit-0.2.2}/oj_toolkit/logging/decorators.py +0 -0
  26. {oj_toolkit-0.2.1 → oj_toolkit-0.2.2}/oj_toolkit/logging/formatters.py +0 -0
  27. {oj_toolkit-0.2.1 → oj_toolkit-0.2.2}/oj_toolkit/logging/handlers.py +0 -0
  28. {oj_toolkit-0.2.1 → oj_toolkit-0.2.2}/oj_toolkit/parsing/__init__.py +0 -0
  29. {oj_toolkit-0.2.1 → oj_toolkit-0.2.2}/oj_toolkit/parsing/consts.py +0 -0
  30. {oj_toolkit-0.2.1 → oj_toolkit-0.2.2}/oj_toolkit/parsing/types.py +0 -0
  31. {oj_toolkit-0.2.1 → oj_toolkit-0.2.2}/oj_toolkit.egg-info/SOURCES.txt +0 -0
  32. {oj_toolkit-0.2.1 → oj_toolkit-0.2.2}/oj_toolkit.egg-info/dependency_links.txt +0 -0
  33. {oj_toolkit-0.2.1 → oj_toolkit-0.2.2}/oj_toolkit.egg-info/requires.txt +0 -0
  34. {oj_toolkit-0.2.1 → oj_toolkit-0.2.2}/oj_toolkit.egg-info/top_level.txt +0 -0
  35. {oj_toolkit-0.2.1 → oj_toolkit-0.2.2}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: oj-toolkit
3
- Version: 0.2.1
3
+ Version: 0.2.2
4
4
  Summary: Centralized shared utilities for ownjoo-org projects: standardized logging config, type validation, data parsing, console output, and async utilities
5
5
  Author-email: Speedy <speedy@ownjoo.org>
6
6
  License: MIT
@@ -719,6 +719,12 @@ else:
719
719
 
720
720
  Returns `True` if the terminal likely supports Unicode characters. Used internally to choose between ASCII and Unicode box/table borders.
721
721
 
722
+ Checks `NO_COLOR`/`CI`/`TERM` env vars first, then verifies `sys.stdout.encoding` can actually
723
+ encode a box-drawing character -- this catches Windows consoles that default to a codepage
724
+ (`cp1252`, `cp437`, etc.) that can't, even though the platform/terminal is otherwise
725
+ Unicode-capable. Set `PYTHONIOENCODING=utf-8` (or use Windows Terminal with a UTF-8 codepage)
726
+ to get Unicode borders on Windows instead of the ASCII fallback.
727
+
722
728
  ### `parsing` Module
723
729
 
724
730
  #### `validate(v, exp=None, default=None, converter=None, validator=None, pattern=None, **kwargs)`
@@ -684,6 +684,12 @@ else:
684
684
 
685
685
  Returns `True` if the terminal likely supports Unicode characters. Used internally to choose between ASCII and Unicode box/table borders.
686
686
 
687
+ Checks `NO_COLOR`/`CI`/`TERM` env vars first, then verifies `sys.stdout.encoding` can actually
688
+ encode a box-drawing character -- this catches Windows consoles that default to a codepage
689
+ (`cp1252`, `cp437`, etc.) that can't, even though the platform/terminal is otherwise
690
+ Unicode-capable. Set `PYTHONIOENCODING=utf-8` (or use Windows Terminal with a UTF-8 codepage)
691
+ to get Unicode borders on Windows instead of the ASCII fallback.
692
+
687
693
  ### `parsing` Module
688
694
 
689
695
  #### `validate(v, exp=None, default=None, converter=None, validator=None, pattern=None, **kwargs)`
@@ -48,13 +48,18 @@ def detect_unicode_support() -> bool:
48
48
  """Detect if terminal supports Unicode characters.
49
49
 
50
50
  Checks environment variables and terminal type to determine if the terminal
51
- can display Unicode characters (for pretty borders, etc.).
51
+ can display Unicode characters (for pretty borders, etc.), then verifies
52
+ sys.stdout's actual encoding can render them.
52
53
 
53
54
  Environment checks:
54
55
  - NO_COLOR: If set, disables colors/Unicode for accessibility
55
56
  - TERM: Terminal type (vt100, xterm, etc.)
56
57
  - CI: If in CI environment, assume Unicode support
57
- - Platform: Windows console has limited Unicode, *nix terminals usually support it
58
+ - stdout encoding: Windows consoles commonly default to a codepage (cp1252,
59
+ cp437, etc.) that can't encode box-drawing characters even when the
60
+ platform/terminal is otherwise capable -- this is checked directly rather
61
+ than assumed from sys.platform, since PYTHONIOENCODING/chcp/Windows
62
+ Terminal all change what's actually possible independent of the OS.
58
63
 
59
64
  Returns:
60
65
  True if terminal likely supports Unicode, False otherwise.
@@ -78,20 +83,19 @@ def detect_unicode_support() -> bool:
78
83
  if term in ("dumb", "vt100", "vt220"):
79
84
  return False
80
85
 
81
- # Windows console (cmd.exe, PowerShell) has limited Unicode support
82
- # but modern versions and Windows Terminal support it
83
- if sys.platform == "win32":
84
- # Assume modern Windows (10+) or Windows Terminal supports Unicode
85
- # Could be more conservative here if needed
86
+ # Verify stdout can actually encode a representative box-drawing character.
87
+ # Windows consoles commonly default to a codepage (cp1252, cp437, etc.) that
88
+ # can't, even when the platform/terminal is otherwise Unicode-capable.
89
+ try:
90
+ "─".encode(sys.stdout.encoding)
86
91
  return True
87
-
88
- # *nix terminals typically support Unicode
89
- if sys.platform in ("linux", "darwin"):
92
+ except UnicodeEncodeError:
93
+ return False
94
+ except (AttributeError, TypeError, LookupError):
95
+ # stdout has no usable encoding (e.g. a mock/capture stream in tests) --
96
+ # can't verify either way, so don't penalize it.
90
97
  return True
91
98
 
92
- # Default: attempt Unicode
93
- return True
94
-
95
99
 
96
100
  def select_style(
97
101
  style: str,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: oj-toolkit
3
- Version: 0.2.1
3
+ Version: 0.2.2
4
4
  Summary: Centralized shared utilities for ownjoo-org projects: standardized logging config, type validation, data parsing, console output, and async utilities
5
5
  Author-email: Speedy <speedy@ownjoo.org>
6
6
  License: MIT
@@ -719,6 +719,12 @@ else:
719
719
 
720
720
  Returns `True` if the terminal likely supports Unicode characters. Used internally to choose between ASCII and Unicode box/table borders.
721
721
 
722
+ Checks `NO_COLOR`/`CI`/`TERM` env vars first, then verifies `sys.stdout.encoding` can actually
723
+ encode a box-drawing character -- this catches Windows consoles that default to a codepage
724
+ (`cp1252`, `cp437`, etc.) that can't, even though the platform/terminal is otherwise
725
+ Unicode-capable. Set `PYTHONIOENCODING=utf-8` (or use Windows Terminal with a UTF-8 codepage)
726
+ to get Unicode borders on Windows instead of the ASCII fallback.
727
+
722
728
  ### `parsing` Module
723
729
 
724
730
  #### `validate(v, exp=None, default=None, converter=None, validator=None, pattern=None, **kwargs)`
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "oj-toolkit"
7
- version = "0.2.1"
7
+ version = "0.2.2"
8
8
  description = "Centralized shared utilities for ownjoo-org projects: standardized logging config, type validation, data parsing, console output, and async utilities"
9
9
  authors = [
10
10
  { name = "Speedy", email = "speedy@ownjoo.org" }
File without changes
File without changes