lixplore-cli 1.0.0__py3-none-any.whl

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.
lixplore/__init__.py ADDED
File without changes
lixplore/__main__.py ADDED
@@ -0,0 +1,10 @@
1
+ #!/usr/bin/env python3
2
+
3
+ """
4
+ Entry point for running lixplore as a module: python -m lixplore
5
+ """
6
+
7
+ from lixplore.cli import main
8
+
9
+ if __name__ == "__main__":
10
+ main()
lixplore/cli.py ADDED
@@ -0,0 +1,57 @@
1
+ #!/usr/bin/env python3
2
+
3
+ import argparse
4
+ import sys
5
+ from . import commands
6
+ from lixplore.utils.cache import cleanup_cache # import correctly
7
+
8
+
9
+ def _configure_stdio():
10
+ """Ensure stdout/stderr won't crash on Windows consoles.
11
+
12
+ Prefer UTF-8, but at minimum avoid UnicodeEncodeError by replacing
13
+ unencodable characters. This helps when running under cp1252 on
14
+ GitHub Actions Windows runners.
15
+ """
16
+ try:
17
+ if hasattr(sys.stdout, "reconfigure"):
18
+ try:
19
+ # Try UTF-8 first
20
+ sys.stdout.reconfigure(encoding="utf-8", errors="replace")
21
+ sys.stderr.reconfigure(encoding="utf-8", errors="replace")
22
+ except Exception:
23
+ # Fallback to current encoding with replacement
24
+ sys.stdout.reconfigure(errors="replace")
25
+ sys.stderr.reconfigure(errors="replace")
26
+ else:
27
+ import io
28
+ sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding="utf-8", errors="replace")
29
+ sys.stderr = io.TextIOWrapper(sys.stderr.buffer, encoding="utf-8", errors="replace")
30
+ except Exception:
31
+ # Last resort: ignore failures, but keep running
32
+ pass
33
+
34
+
35
+ def main():
36
+ # Ensure safe I/O early
37
+ _configure_stdio()
38
+
39
+ # run cleanup first
40
+ cleanup_cache(days=7)
41
+
42
+ parser = argparse.ArgumentParser(
43
+ description="Lixplore Literature CLI Tool",
44
+ formatter_class=argparse.ArgumentDefaultsHelpFormatter
45
+ )
46
+ commands.add_commands(parser)
47
+ args = parser.parse_args()
48
+
49
+ if hasattr(args, "func"):
50
+ args.func(args)
51
+ else:
52
+ parser.print_help()
53
+
54
+
55
+ if __name__ == "__main__":
56
+ main()
57
+