arionxiv 1.0.32__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.
Files changed (69) hide show
  1. arionxiv/__init__.py +40 -0
  2. arionxiv/__main__.py +10 -0
  3. arionxiv/arxiv_operations/__init__.py +0 -0
  4. arionxiv/arxiv_operations/client.py +225 -0
  5. arionxiv/arxiv_operations/fetcher.py +173 -0
  6. arionxiv/arxiv_operations/searcher.py +122 -0
  7. arionxiv/arxiv_operations/utils.py +293 -0
  8. arionxiv/cli/__init__.py +4 -0
  9. arionxiv/cli/commands/__init__.py +1 -0
  10. arionxiv/cli/commands/analyze.py +587 -0
  11. arionxiv/cli/commands/auth.py +365 -0
  12. arionxiv/cli/commands/chat.py +714 -0
  13. arionxiv/cli/commands/daily.py +482 -0
  14. arionxiv/cli/commands/fetch.py +217 -0
  15. arionxiv/cli/commands/library.py +295 -0
  16. arionxiv/cli/commands/preferences.py +426 -0
  17. arionxiv/cli/commands/search.py +254 -0
  18. arionxiv/cli/commands/settings_unified.py +1407 -0
  19. arionxiv/cli/commands/trending.py +41 -0
  20. arionxiv/cli/commands/welcome.py +168 -0
  21. arionxiv/cli/main.py +407 -0
  22. arionxiv/cli/ui/__init__.py +1 -0
  23. arionxiv/cli/ui/global_theme_manager.py +173 -0
  24. arionxiv/cli/ui/logo.py +127 -0
  25. arionxiv/cli/ui/splash.py +89 -0
  26. arionxiv/cli/ui/theme.py +32 -0
  27. arionxiv/cli/ui/theme_system.py +391 -0
  28. arionxiv/cli/utils/__init__.py +54 -0
  29. arionxiv/cli/utils/animations.py +522 -0
  30. arionxiv/cli/utils/api_client.py +583 -0
  31. arionxiv/cli/utils/api_config.py +505 -0
  32. arionxiv/cli/utils/command_suggestions.py +147 -0
  33. arionxiv/cli/utils/db_config_manager.py +254 -0
  34. arionxiv/github_actions_runner.py +206 -0
  35. arionxiv/main.py +23 -0
  36. arionxiv/prompts/__init__.py +9 -0
  37. arionxiv/prompts/prompts.py +247 -0
  38. arionxiv/rag_techniques/__init__.py +8 -0
  39. arionxiv/rag_techniques/basic_rag.py +1531 -0
  40. arionxiv/scheduler_daemon.py +139 -0
  41. arionxiv/server.py +1000 -0
  42. arionxiv/server_main.py +24 -0
  43. arionxiv/services/__init__.py +73 -0
  44. arionxiv/services/llm_client.py +30 -0
  45. arionxiv/services/llm_inference/__init__.py +58 -0
  46. arionxiv/services/llm_inference/groq_client.py +469 -0
  47. arionxiv/services/llm_inference/llm_utils.py +250 -0
  48. arionxiv/services/llm_inference/openrouter_client.py +564 -0
  49. arionxiv/services/unified_analysis_service.py +872 -0
  50. arionxiv/services/unified_auth_service.py +457 -0
  51. arionxiv/services/unified_config_service.py +456 -0
  52. arionxiv/services/unified_daily_dose_service.py +823 -0
  53. arionxiv/services/unified_database_service.py +1633 -0
  54. arionxiv/services/unified_llm_service.py +366 -0
  55. arionxiv/services/unified_paper_service.py +604 -0
  56. arionxiv/services/unified_pdf_service.py +522 -0
  57. arionxiv/services/unified_prompt_service.py +344 -0
  58. arionxiv/services/unified_scheduler_service.py +589 -0
  59. arionxiv/services/unified_user_service.py +954 -0
  60. arionxiv/utils/__init__.py +51 -0
  61. arionxiv/utils/api_helpers.py +200 -0
  62. arionxiv/utils/file_cleanup.py +150 -0
  63. arionxiv/utils/ip_helper.py +96 -0
  64. arionxiv-1.0.32.dist-info/METADATA +336 -0
  65. arionxiv-1.0.32.dist-info/RECORD +69 -0
  66. arionxiv-1.0.32.dist-info/WHEEL +5 -0
  67. arionxiv-1.0.32.dist-info/entry_points.txt +4 -0
  68. arionxiv-1.0.32.dist-info/licenses/LICENSE +21 -0
  69. arionxiv-1.0.32.dist-info/top_level.txt +1 -0
@@ -0,0 +1,173 @@
1
+ """Global Theme Manager for ArionXiv CLI
2
+
3
+ This module manages theme state globally across the entire application.
4
+ It fetches user theme preferences from the database and ensures consistent
5
+ theming throughout all components.
6
+ """
7
+
8
+ import asyncio
9
+ import logging
10
+ import json
11
+ from pathlib import Path
12
+ from typing import Dict, Any, Optional
13
+
14
+ logger = logging.getLogger(__name__)
15
+
16
+ class GlobalThemeManager:
17
+ """Global theme manager that maintains theme state across the application"""
18
+
19
+ _instance = None
20
+ _current_theme = None
21
+ _user_theme_preference = None
22
+ _initialized = False
23
+ _local_config_loaded = False
24
+
25
+ def __new__(cls):
26
+ if cls._instance is None:
27
+ cls._instance = super().__new__(cls)
28
+ return cls._instance
29
+
30
+ def __init__(self):
31
+ if not self._initialized:
32
+ self._current_theme = None # Will be loaded on first access
33
+ self._user_theme_preference = None
34
+ self._initialized = True
35
+ self._local_config_loaded = False
36
+
37
+ def _load_from_local_config_sync(self) -> str:
38
+ """Synchronously load theme from local config file"""
39
+ if self._local_config_loaded and self._current_theme:
40
+ return self._current_theme
41
+
42
+ try:
43
+ config_file = Path.home() / ".arionxiv" / "local_config.json"
44
+ if config_file.exists():
45
+ with open(config_file, 'r') as f:
46
+ config = json.load(f)
47
+ theme_color = config.get("display", {}).get("theme_color", "blue")
48
+ self._current_theme = theme_color
49
+ self._local_config_loaded = True
50
+ logger.debug(f"Theme loaded from local config (sync): {theme_color}")
51
+ return theme_color
52
+ except Exception as e:
53
+ logger.debug(f"Could not load local config: {e}")
54
+
55
+ # Default fallback
56
+ self._current_theme = 'blue'
57
+ self._local_config_loaded = True
58
+ return 'blue'
59
+
60
+ async def initialize_user_theme(self, user_id: str) -> str:
61
+ """Initialize theme from user preferences in database"""
62
+ try:
63
+ # Import here to avoid circular imports
64
+ from arionxiv.services.unified_user_service import unified_user_service
65
+ from arionxiv.services.unified_database_service import unified_database_service
66
+
67
+ if unified_database_service.db is None:
68
+ logger.debug("Database not available, using local config")
69
+ return await self._load_from_local_config()
70
+
71
+ # Fetch user preferences from database
72
+ user_result = await unified_database_service.get_user_by_id(user_id)
73
+ if user_result["success"]:
74
+ user_data = user_result["user"]
75
+ preferences = user_data.get("preferences", {})
76
+ theme_color = preferences.get("theme_color", "blue")
77
+
78
+ self._user_theme_preference = theme_color
79
+ self._current_theme = theme_color
80
+
81
+ logger.info(f"User theme loaded from database: {theme_color}")
82
+ return theme_color
83
+ else:
84
+ logger.warning("Failed to fetch user from database, using local config")
85
+ return await self._load_from_local_config()
86
+
87
+ except Exception as e:
88
+ logger.debug(f"Theme initialization fallback to local: {e}")
89
+ return await self._load_from_local_config()
90
+
91
+ async def _load_from_local_config(self) -> str:
92
+ """Fallback to local config if database is unavailable"""
93
+ try:
94
+ from arionxiv.cli.utils.db_config_manager import db_config_manager
95
+ await db_config_manager.load_config()
96
+ theme_color = db_config_manager.get_theme_color()
97
+
98
+ self._current_theme = theme_color
99
+ self._local_config_loaded = True
100
+ logger.debug(f"Theme loaded from local config: {theme_color}")
101
+ return theme_color
102
+ except Exception as e:
103
+ logger.debug(f"Using default theme: {e}")
104
+ self._current_theme = 'blue'
105
+ return 'blue'
106
+
107
+ def get_current_theme(self) -> str:
108
+ """Get the current theme color - loads from local config if not set"""
109
+ if self._current_theme is None:
110
+ # Synchronously load from local config on first access
111
+ return self._load_from_local_config_sync()
112
+ return self._current_theme
113
+
114
+ def set_theme(self, theme_color: str) -> None:
115
+ """Set the current theme color"""
116
+ self._current_theme = theme_color
117
+ self._user_theme_preference = theme_color
118
+ logger.debug(f"Theme updated to: {theme_color}")
119
+
120
+ async def update_user_theme_in_database(self, user_id: str, theme_color: str) -> bool:
121
+ """Update user theme preference in database"""
122
+ try:
123
+ from arionxiv.services.unified_database_service import unified_database_service
124
+
125
+ if unified_database_service.db is None:
126
+ logger.debug("Database not available, saving to local config only")
127
+ return await self._save_to_local_config(theme_color)
128
+
129
+ # Update user preferences in database
130
+ update_data = {
131
+ "preferences.theme_color": theme_color,
132
+ "updated_at": asyncio.get_event_loop().time()
133
+ }
134
+
135
+ result = await unified_database_service.update_user(user_id, update_data)
136
+ if result["success"]:
137
+ self.set_theme(theme_color)
138
+ logger.debug(f"User theme updated in database: {theme_color}")
139
+ return True
140
+ else:
141
+ logger.debug("Failed to update user theme in database")
142
+ return False
143
+
144
+ except Exception as e:
145
+ logger.debug(f"Theme update fallback to local: {e}")
146
+ return await self._save_to_local_config(theme_color)
147
+
148
+ async def _save_to_local_config(self, theme_color: str) -> bool:
149
+ """Fallback to save in local config"""
150
+ try:
151
+ from arionxiv.cli.utils.db_config_manager import db_config_manager
152
+ await db_config_manager.load_config()
153
+ success = await db_config_manager.set_theme_color(theme_color)
154
+ if success:
155
+ self.set_theme(theme_color)
156
+ logger.debug(f"Theme saved to local config: {theme_color}")
157
+ return success
158
+ except Exception as e:
159
+ logger.debug(f"Error saving to local config: {e}")
160
+ return False
161
+
162
+ def is_initialized(self) -> bool:
163
+ """Check if theme has been initialized from user preferences"""
164
+ return self._user_theme_preference is not None
165
+
166
+ def reload_from_config(self) -> str:
167
+ """Force reload theme from local config"""
168
+ self._local_config_loaded = False
169
+ self._current_theme = None
170
+ return self._load_from_local_config_sync()
171
+
172
+ # Global singleton instance
173
+ global_theme_manager = GlobalThemeManager()
@@ -0,0 +1,127 @@
1
+ """ArionXiv ASCII Logo and Branding"""
2
+
3
+ from rich.console import Console
4
+ from rich.panel import Panel
5
+ from rich.text import Text
6
+ from rich.align import Align
7
+ import shutil
8
+
9
+ def get_ascii_logo():
10
+ """Returns the ArionXiv ASCII logo"""
11
+ return """
12
+ ╔═══════════════════════════════════════════════════════════════╗
13
+ ║ ║
14
+ ║ █████╗ ██████╗ ██╗ ██████╗ ███╗ ██╗██╗ ██╗██╗██╗ ██╗ ║
15
+ ║ ██╔══██╗██╔══██╗██║██╔═══██╗████╗ ██║╚██╗██╔╝██║██║ ██║ ║
16
+ ║ ███████║██████╔╝██║██║ ██║██╔██╗ ██║ ╚███╔╝ ██║██║ ██║ ║
17
+ ║ ██╔══██║██╔══██╗██║██║ ██║██║╚██╗██║ ██╔██╗ ██║╚██╗ ██╔╝ ║
18
+ ║ ██║ ██║██║ ██║██║╚██████╔╝██║ ╚████║██╔╝ ██╗██║ ╚████╔╝ ║
19
+ ║ ╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═════╝ ╚═╝ ╚═══╝╚═╝ ╚═╝╚═╝ ╚═══╝ ║
20
+ ║ ║
21
+ ║ Don't read papers manually anymore! ║
22
+ ║ ║
23
+ ╚═══════════════════════════════════════════════════════════════╝
24
+ """
25
+
26
+ def get_mini_logo():
27
+ """Returns a mini version of ArionXiv for headers"""
28
+ return "ARIONXIV"
29
+
30
+ def get_header_bar(console: Console):
31
+ """Create a header bar with mini logo on the right"""
32
+ from .theme import get_theme_colors
33
+ colors = get_theme_colors()
34
+
35
+ terminal_width = shutil.get_terminal_size().columns
36
+ logo = get_mini_logo()
37
+ padding = " " * (terminal_width - len(logo) - 2)
38
+
39
+ header_text = Text()
40
+ header_text.append(padding, style="")
41
+ header_text.append(logo, style=f"bold {colors['primary']}")
42
+
43
+ return header_text
44
+
45
+ def display_header(console: Console):
46
+ """Display the persistent header with mini logo"""
47
+ from .theme import get_theme_colors
48
+ colors = get_theme_colors()
49
+
50
+ header = get_header_bar(console)
51
+ console.print(header)
52
+ console.print("─" * shutil.get_terminal_size().columns, style=f"bold {colors['primary']}")
53
+
54
+ def get_simple_logo():
55
+ """Returns a simpler version of the logo"""
56
+ return """
57
+ ╔══════════════════════════════════════════╗
58
+ ║ ║
59
+ ║ A R I O N X I V ║
60
+ ║ ║
61
+ ║ Avoid reading papers manually! ║
62
+ ║ ║
63
+ ╚══════════════════════════════════════════╝
64
+ """
65
+
66
+ def display_logo(console: Console, simple: bool = False):
67
+ """Display the ArionXiv logo"""
68
+ from .theme import get_theme_colors
69
+ colors = get_theme_colors()
70
+
71
+ logo = get_simple_logo() if simple else get_ascii_logo()
72
+
73
+ # Create rich text with current theme color
74
+ text = Text(logo)
75
+ text.stylize(f"bold {colors['primary']}", 0, len(logo))
76
+
77
+ console.print()
78
+ console.print(text)
79
+ console.print()
80
+
81
+ def display_welcome_message(console: Console):
82
+ """Display welcome message for first-time users"""
83
+ from .theme import get_theme_colors
84
+ colors = get_theme_colors()
85
+
86
+ welcome_text = """
87
+ Welcome to ArionXiv CLI!
88
+
89
+ ArionXiv is a powerful terminal-based research paper analysis platform
90
+ that helps researchers discover, analyze, and interact with academic papers.
91
+
92
+ Key Features:
93
+ • Search and discover research papers from arXiv
94
+ • Download and extract text from PDFs
95
+ • AI-powered paper analysis and insights
96
+ • Interactive chat with papers
97
+ • Personal research library management
98
+
99
+ Get started with: arionxiv search "your research topic"
100
+ For help: arionxiv --help
101
+ """
102
+
103
+ panel = Panel(
104
+ welcome_text.strip(),
105
+ title=f"[bold {colors['primary']}]Welcome to ArionXiv[/bold {colors['primary']}]",
106
+ border_style=f"bold {colors['primary']}",
107
+ padding=(1, 2)
108
+ )
109
+
110
+ console.print(panel)
111
+ console.print()
112
+
113
+ def display_startup_info(console: Console):
114
+ """Display startup information"""
115
+ from .theme import get_theme_colors
116
+ colors = get_theme_colors()
117
+
118
+ startup_text = Text()
119
+ startup_text.append("ArionXiv CLI", style=f"bold {colors['primary']}")
120
+ startup_text.append(" - Research Paper Analysis Platform\n\n")
121
+ startup_text.append("Type ", style="")
122
+ startup_text.append("'arionxiv --help'", style=f"bold {colors['primary']}")
123
+ startup_text.append(" to see all available commands\n")
124
+ startup_text.append("Visit our documentation for advanced usage tips")
125
+
126
+ console.print(startup_text)
127
+ console.print()
@@ -0,0 +1,89 @@
1
+ """Splash screen for ArionXiv CLI"""
2
+
3
+ from rich.console import Console
4
+ from rich.panel import Panel
5
+ from rich.text import Text
6
+ from rich.align import Align
7
+ from rich.table import Table
8
+ from .theme import get_theme_colors
9
+
10
+ console = Console()
11
+
12
+ def show_splash():
13
+ """Display the ArionXiv CLI splash screen"""
14
+ colors = get_theme_colors()
15
+ primary = colors['primary']
16
+
17
+ # ASCII Art Logo
18
+ logo = """
19
+ ╔═══════════════════════════════════════════════════════════════════════╗
20
+ ║ ║
21
+ ║ █████╗ ██████╗ ██╗ ██████╗ ███╗ ██╗██╗ ██╗██╗██╗ ██╗ ║
22
+ ║ ██╔══██╗██╔══██╗██║██╔═══██╗████╗ ██║╚██╗██╔╝██║██║ ██║ ║
23
+ ║ ███████║██████╔╝██║██║ ██║██╔██╗ ██║ ╚███╔╝ ██║██║ ██║ ║
24
+ ║ ██╔══██║██╔══██╗██║██║ ██║██║╚██╗██║ ██╔██╗ ██║╚██╗ ██╔╝ ║
25
+ ║ ██║ ██║██║ ██║██║╚██████╔╝██║ ╚████║██╔╝ ██╗██║ ╚████╔╝ ║
26
+ ║ ╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═════╝ ╚═╝ ╚═══╝╚═╝ ╚═╝╚═╝ ╚═══╝ ║
27
+ ║ ║
28
+ ║ AI-Powered Research Paper Analysis ║
29
+ ║ ║
30
+ ╚═══════════════════════════════════════════════════════════════════════╝
31
+ """
32
+
33
+ console.print(logo, style=f"bold {primary}")
34
+
35
+ # Feature highlights
36
+ features = Table(title="Key Features", show_header=False, box=None)
37
+ features.add_column("Icon", style="bold white")
38
+ features.add_column("Feature", style="white")
39
+
40
+ features.add_row("*", "Smart Paper Search & Discovery")
41
+ features.add_row("*", "AI-Powered Paper Analysis")
42
+ features.add_row("*", "Interactive Chat with Papers")
43
+ features.add_row("*", "Daily Intelligence Reports")
44
+ features.add_row("*", "Personal Research Library")
45
+ features.add_row("*", "Trending Papers & Insights")
46
+
47
+ console.print()
48
+ console.print(Align.center(features))
49
+
50
+ # Quick start
51
+ quick_start = Panel(
52
+ f"""[bold {colors['primary']}]Quick Start:[/bold {colors['primary']}]
53
+
54
+ [bold]arionxiv search[/bold] "machine learning" - Search for papers
55
+ [bold]arionxiv daily[/bold] - Get daily recommendations
56
+ [bold]arionxiv trending[/bold] - See trending papers
57
+ [bold]arionxiv config[/bold] - Configure preferences
58
+
59
+ [white]Type [bold]arionxiv <command> --help[/bold] for detailed usage[/white]""",
60
+ title="Get Started",
61
+ border_style=f"bold {colors['primary']}"
62
+ )
63
+
64
+ console.print()
65
+ console.print(quick_start)
66
+
67
+ # Status info
68
+ status_text = Text()
69
+ status_text.append("Version: ", style="white")
70
+ status_text.append("1.0.0", style=f"bold {colors['primary']}")
71
+ status_text.append(" | Mode: ", style="white")
72
+ status_text.append("Terminal", style=f"bold {primary}")
73
+ status_text.append(" | Ready: ", style="white")
74
+ status_text.append("YES", style=f"bold {colors['primary']}")
75
+
76
+ console.print()
77
+ console.print(Align.center(status_text))
78
+
79
+ def show_welcome_message():
80
+ """Show a brief welcome message"""
81
+ colors = get_theme_colors()
82
+ welcome = Panel(
83
+ "[bold green]Welcome to ArionXiv CLI![/bold green]\n\n"
84
+ "Your AI-powered research companion in the terminal.\n"
85
+ "Type [bold]arionxiv --help[/bold] to get started.",
86
+ title="Welcome",
87
+ border_style=f"bold {colors['primary']}"
88
+ )
89
+ console.print(welcome)
@@ -0,0 +1,32 @@
1
+ """ArionXiv CLI Theme Configuration - Compatibility layer for theme_system.py"""
2
+
3
+ # Import everything from the new consolidated theme system
4
+ from .theme_system import *
5
+
6
+ # Maintain backwards compatibility by re-exporting all functions
7
+ from .theme_system import (
8
+ AVAILABLE_THEMES,
9
+ THEME_COLORS,
10
+ get_current_theme_color,
11
+ set_theme_colors,
12
+ get_theme_colors,
13
+ create_themed_console,
14
+ create_themed_table,
15
+ create_themed_panel,
16
+ print_header,
17
+ print_success,
18
+ print_error,
19
+ print_warning,
20
+ print_info,
21
+ style_text,
22
+ display_theme_preview,
23
+ show_all_themes,
24
+ show_themes_table,
25
+ get_theme_choice,
26
+ run_theme_selection,
27
+ quick_theme_select,
28
+ is_valid_theme,
29
+ get_theme_info,
30
+ list_available_themes,
31
+ get_theme_names_and_descriptions
32
+ )