noaa-jetstream 0.1.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 (50) hide show
  1. noaa_jetstream-0.1.2/LICENSE.md +1 -0
  2. noaa_jetstream-0.1.2/MANIFEST.in +19 -0
  3. noaa_jetstream-0.1.2/PKG-INFO +223 -0
  4. noaa_jetstream-0.1.2/README.md +170 -0
  5. noaa_jetstream-0.1.2/jetstream/__init__.py +22 -0
  6. noaa_jetstream-0.1.2/jetstream/cli.py +92 -0
  7. noaa_jetstream-0.1.2/jetstream/config.py +55 -0
  8. noaa_jetstream-0.1.2/jetstream/database.py +258 -0
  9. noaa_jetstream-0.1.2/jetstream/main.py +212 -0
  10. noaa_jetstream-0.1.2/jetstream/models.py +171 -0
  11. noaa_jetstream-0.1.2/jetstream/routers/__init__.py +1 -0
  12. noaa_jetstream-0.1.2/jetstream/routers/analytics.py +177 -0
  13. noaa_jetstream-0.1.2/jetstream/routers/cloud_analyzer.py +330 -0
  14. noaa_jetstream-0.1.2/jetstream/routers/folders.py +146 -0
  15. noaa_jetstream-0.1.2/jetstream/routers/queue.py +62 -0
  16. noaa_jetstream-0.1.2/jetstream/routers/settings.py +55 -0
  17. noaa_jetstream-0.1.2/jetstream/routers/stats.py +98 -0
  18. noaa_jetstream-0.1.2/jetstream/routers/uploads.py +376 -0
  19. noaa_jetstream-0.1.2/jetstream/scheduler.py +202 -0
  20. noaa_jetstream-0.1.2/jetstream/services.py +763 -0
  21. noaa_jetstream-0.1.2/jetstream/shortcuts.py +241 -0
  22. noaa_jetstream-0.1.2/jetstream/static/analytics.html +135 -0
  23. noaa_jetstream-0.1.2/jetstream/static/cloud.html +140 -0
  24. noaa_jetstream-0.1.2/jetstream/static/css/styles.css +1092 -0
  25. noaa_jetstream-0.1.2/jetstream/static/icon.ico +0 -0
  26. noaa_jetstream-0.1.2/jetstream/static/icon.png +0 -0
  27. noaa_jetstream-0.1.2/jetstream/static/index.html +150 -0
  28. noaa_jetstream-0.1.2/jetstream/static/jetstream_logo.png +0 -0
  29. noaa_jetstream-0.1.2/jetstream/static/jetstream_logo_d.png +0 -0
  30. noaa_jetstream-0.1.2/jetstream/static/jetstream_logo_w.png +0 -0
  31. noaa_jetstream-0.1.2/jetstream/static/jobs.html +112 -0
  32. noaa_jetstream-0.1.2/jetstream/static/js/analytics.js +299 -0
  33. noaa_jetstream-0.1.2/jetstream/static/js/cloud.js +287 -0
  34. noaa_jetstream-0.1.2/jetstream/static/js/home.js +22 -0
  35. noaa_jetstream-0.1.2/jetstream/static/js/jobs.js +113 -0
  36. noaa_jetstream-0.1.2/jetstream/static/js/settings.js +127 -0
  37. noaa_jetstream-0.1.2/jetstream/static/js/shared.js +475 -0
  38. noaa_jetstream-0.1.2/jetstream/static/js/uploads.js +251 -0
  39. noaa_jetstream-0.1.2/jetstream/static/settings.html +161 -0
  40. noaa_jetstream-0.1.2/jetstream/static/uploads.html +210 -0
  41. noaa_jetstream-0.1.2/noaa_jetstream.egg-info/PKG-INFO +223 -0
  42. noaa_jetstream-0.1.2/noaa_jetstream.egg-info/SOURCES.txt +48 -0
  43. noaa_jetstream-0.1.2/noaa_jetstream.egg-info/dependency_links.txt +1 -0
  44. noaa_jetstream-0.1.2/noaa_jetstream.egg-info/entry_points.txt +5 -0
  45. noaa_jetstream-0.1.2/noaa_jetstream.egg-info/requires.txt +27 -0
  46. noaa_jetstream-0.1.2/noaa_jetstream.egg-info/top_level.txt +1 -0
  47. noaa_jetstream-0.1.2/pyproject.toml +83 -0
  48. noaa_jetstream-0.1.2/requirements.txt +26 -0
  49. noaa_jetstream-0.1.2/setup.cfg +4 -0
  50. noaa_jetstream-0.1.2/setup.py +75 -0
@@ -0,0 +1 @@
1
+ Software code created by U.S. Government employees is not subject to copyright in the United States (17 U.S.C. ยง105). The United States/Department of Commerce reserve all rights to seek and obtain copyright protection in countries other than the United States for Software authored in its entirety by the Department of Commerce. To this end, the Department of Commerce hereby grants to Recipient a royalty-free, nonexclusive license to use, copy, and create derivative works of the Software outside of the United States.
@@ -0,0 +1,19 @@
1
+ # Include documentation
2
+ include README.md
3
+ include LICENSE.md
4
+ include requirements.txt
5
+
6
+ # Include static web files from package
7
+ recursive-include jetstream/static *.html *.css *.js
8
+
9
+ # Include logs directory structure (empty)
10
+ recursive-include logs .gitkeep
11
+
12
+ # Exclude unnecessary files
13
+ global-exclude __pycache__
14
+ global-exclude *.py[co]
15
+ global-exclude .DS_Store
16
+ global-exclude *.swp
17
+ global-exclude .gitignore
18
+ global-exclude *.db
19
+ global-exclude *.log
@@ -0,0 +1,223 @@
1
+ Metadata-Version: 2.4
2
+ Name: noaa-jetstream
3
+ Version: 0.1.2
4
+ Summary: JetStream: Cloud Data Manager - A comprehensive tool for managing local-to-cloud uploads with queue management, statistics, and folder analysis
5
+ Home-page: https://github.com/MichaelAkridge-NOAA/jetstream
6
+ Author: Michael Akridge
7
+ Author-email:
8
+ License: MIT
9
+ Project-URL: Homepage, https://github.com/MichaelAkridge-NOAA/jetstream
10
+ Project-URL: Documentation, https://github.com/MichaelAkridge-NOAA/jetstream#readme
11
+ Project-URL: Repository, https://github.com/MichaelAkridge-NOAA/jetstream
12
+ Project-URL: Bug Tracker, https://github.com/MichaelAkridge-NOAA/jetstream/issues
13
+ Keywords: cloud,upload,gcs,google-cloud,data-management,queue,noaa
14
+ Classifier: Development Status :: 3 - Alpha
15
+ Classifier: Intended Audience :: Science/Research
16
+ Classifier: Topic :: Scientific/Engineering
17
+ Classifier: Topic :: Internet :: WWW/HTTP :: HTTP Servers
18
+ Classifier: Programming Language :: Python :: 3
19
+ Classifier: Programming Language :: Python :: 3.9
20
+ Classifier: Programming Language :: Python :: 3.10
21
+ Classifier: Programming Language :: Python :: 3.11
22
+ Classifier: Programming Language :: Python :: 3.12
23
+ Classifier: Operating System :: OS Independent
24
+ Requires-Python: >=3.9
25
+ Description-Content-Type: text/markdown
26
+ License-File: LICENSE.md
27
+ Requires-Dist: fastapi>=0.109.0
28
+ Requires-Dist: fastapi-cli>=0.0.20
29
+ Requires-Dist: uvicorn[standard]>=0.27.0
30
+ Requires-Dist: python-multipart>=0.0.6
31
+ Requires-Dist: sqlalchemy>=2.0.25
32
+ Requires-Dist: alembic>=1.13.0
33
+ Requires-Dist: pydantic>=2.7.0
34
+ Requires-Dist: pydantic-settings>=2.1.0
35
+ Requires-Dist: aiofiles>=23.2.0
36
+ Requires-Dist: python-dotenv>=1.0.0
37
+ Provides-Extra: cloud
38
+ Requires-Dist: google-cloud-storage>=2.14.0; extra == "cloud"
39
+ Requires-Dist: google-auth>=2.27.0; extra == "cloud"
40
+ Requires-Dist: google-auth-oauthlib>=1.2.0; extra == "cloud"
41
+ Provides-Extra: shortcuts
42
+ Requires-Dist: pyshortcuts>=1.9.0; extra == "shortcuts"
43
+ Provides-Extra: dev
44
+ Requires-Dist: pytest>=7.0.0; extra == "dev"
45
+ Requires-Dist: pytest-asyncio>=0.21.0; extra == "dev"
46
+ Requires-Dist: black>=23.0.0; extra == "dev"
47
+ Requires-Dist: flake8>=6.0.0; extra == "dev"
48
+ Provides-Extra: all
49
+ Requires-Dist: noaa-jetstream[cloud,dev,shortcuts]; extra == "all"
50
+ Dynamic: home-page
51
+ Dynamic: license-file
52
+ Dynamic: requires-python
53
+
54
+ # NOAA JetStream โ€” Cloud Data Management Transfer System
55
+ <img align="right" src="./docs/jetstream_logo_400px.png" alt="jetstream" width="250">
56
+
57
+ A comprehensive web-based application for managing Google Cloud Storage uploads with features including job queuing, real-time analytics, cloud bucket analysis, and batch processing capabilities.
58
+
59
+ ### Features
60
+
61
+ - **Upload Management**
62
+ - **Analytics & Monitoring**
63
+ - **Cloud Bucket Analysis**
64
+ - **File Filtering**
65
+ - **Web Dashboard**
66
+
67
+ ## Screenshots
68
+
69
+ | Dashboard | Upload Jobs | Analytics |
70
+ |-----------|-------------|----------|
71
+ | ![Home](./docs/screenshot_home.png) | ![Uploads](./docs/screenshot_uploads.png) | ![Analytics](./docs/screenshot_analytics.png) |
72
+
73
+ ### Prerequisites
74
+
75
+ - **Python 3.9+**
76
+ - **Google Cloud SDK** (includes gsutil) โ€” for cloud upload features
77
+ - **Permissions** to target GCS buckets
78
+
79
+ **OR** use Docker (see [Docker Installation](#docker-installation) below)
80
+
81
+ ---
82
+
83
+ ### Installation
84
+
85
+ #### Option 1: Install from PyPI (Recommended)
86
+
87
+ ```bash
88
+ # Install core package
89
+ pip install noaa-jetstream
90
+
91
+ # Or install with Google Cloud support
92
+ pip install noaa-jetstream[cloud]
93
+
94
+ # Or install with desktop shortcuts
95
+ pip install noaa-jetstream[shortcuts]
96
+
97
+ # Or install everything
98
+ pip install noaa-jetstream[all]
99
+ ```
100
+
101
+ #### Option 2: Install from Source (Development)
102
+
103
+ ```bash
104
+ # Clone the repository
105
+ git clone https://github.com/MichaelAkridge-NOAA/jetstream.git
106
+ cd jetstream
107
+
108
+ # Install in development mode
109
+ pip install -e .
110
+
111
+ # Or with all optional features
112
+ pip install -e ".[all]"
113
+ ```
114
+ ---
115
+
116
+ ### Google Cloud Setup (Optional)
117
+
118
+ Required only for cloud upload features:
119
+
120
+ ```bash
121
+ # Install Google Cloud SDK
122
+ # Download from: https://cloud.google.com/sdk/docs/install
123
+
124
+ # Authenticate
125
+ gcloud auth login --no-launch-browser
126
+ gcloud auth application-default login --no-launch-browser
127
+
128
+ # Verify access (optional)
129
+ gsutil ls
130
+ gcloud auth list
131
+ ```
132
+
133
+ ---
134
+
135
+ ## Starting the Application
136
+
137
+ ### If Installed via pip
138
+
139
+ ```bash
140
+ # Start the server (opens browser automatically)
141
+ jetstream
142
+
143
+ # With custom options
144
+ jetstream --port 9000
145
+ jetstream --host 127.0.0.1 --port 8080
146
+ jetstream --no-browser
147
+ jetstream --log-level debug
148
+ ```
149
+
150
+ ### If Running from Source
151
+
152
+ ```bash
153
+ # Using the CLI
154
+ python main.py
155
+
156
+ # Or with the diagnostic startup script
157
+ python start.py
158
+
159
+ # Or directly with uvicorn
160
+ python -m uvicorn jetstream.main:app --reload
161
+ ```
162
+
163
+ The application will start on **http://localhost:8000** and automatically open in your default browser.
164
+
165
+ ### Desktop Shortcuts
166
+
167
+ Create desktop and Start Menu shortcuts for easy access:
168
+
169
+ ```bash
170
+ # Install with shortcuts support
171
+ pip install noaa-jetstream[shortcuts]
172
+
173
+ # Create shortcuts
174
+ jetstream-create-shortcuts
175
+
176
+ # Remove shortcuts
177
+ jetstream-remove-shortcuts
178
+ ```
179
+
180
+ ### Troubleshooting Startup Issues
181
+
182
+ **If the server appears to start but you can't connect:**
183
+
184
+ 1. **Run diagnostics:**
185
+ ```bash
186
+ python diagnose.py
187
+ ```
188
+
189
+ 2. **Run with debug logging:**
190
+ ```bash
191
+ jetstream --log-level debug
192
+ # or from source:
193
+ python -m uvicorn jetstream.main:app --reload --log-level debug
194
+ ```
195
+ ---
196
+
197
+ ## Troubleshooting
198
+
199
+ **Cannot connect to GCS:**
200
+ - Verify authentication: `gcloud auth list`
201
+ - Check bucket permissions
202
+ - Ensure Application Default Credentials are set
203
+
204
+ **Jobs stuck in queue:**
205
+ - Check queue status in dashboard
206
+ - Verify no jobs are blocking the queue
207
+ - Restart the application if needed
208
+
209
+ **Database errors:**
210
+ - Delete `jetstream.db` to reset (loses history)
211
+ - Check file permissions in application directory
212
+
213
+ **API not responding:**
214
+ - Check if port 8000 is already in use
215
+ - View logs in terminal for error messages
216
+ - Ensure all dependencies are installed
217
+
218
+ ----------
219
+ #### Disclaimer
220
+ This repository is a scientific product and is not official communication of the National Oceanic and Atmospheric Administration, or the United States Department of Commerce. All NOAA GitHub project content is provided on an 'as is' basis and the user assumes responsibility for its use. Any claims against the Department of Commerce or Department of Commerce bureaus stemming from the use of this GitHub project will be governed by all applicable Federal law. Any reference to specific commercial products, processes, or services by service mark, trademark, manufacturer, or otherwise, does not constitute or imply their endorsement, recommendation or favoring by the Department of Commerce. The Department of Commerce seal and logo, or the seal and logo of a DOC bureau, shall not be used in any manner to imply endorsement of any commercial product or activity by DOC or the United States Government.
221
+
222
+ ## License
223
+ See the [LICENSE.md](./LICENSE.md) for details
@@ -0,0 +1,170 @@
1
+ # NOAA JetStream โ€” Cloud Data Management Transfer System
2
+ <img align="right" src="./docs/jetstream_logo_400px.png" alt="jetstream" width="250">
3
+
4
+ A comprehensive web-based application for managing Google Cloud Storage uploads with features including job queuing, real-time analytics, cloud bucket analysis, and batch processing capabilities.
5
+
6
+ ### Features
7
+
8
+ - **Upload Management**
9
+ - **Analytics & Monitoring**
10
+ - **Cloud Bucket Analysis**
11
+ - **File Filtering**
12
+ - **Web Dashboard**
13
+
14
+ ## Screenshots
15
+
16
+ | Dashboard | Upload Jobs | Analytics |
17
+ |-----------|-------------|----------|
18
+ | ![Home](./docs/screenshot_home.png) | ![Uploads](./docs/screenshot_uploads.png) | ![Analytics](./docs/screenshot_analytics.png) |
19
+
20
+ ### Prerequisites
21
+
22
+ - **Python 3.9+**
23
+ - **Google Cloud SDK** (includes gsutil) โ€” for cloud upload features
24
+ - **Permissions** to target GCS buckets
25
+
26
+ **OR** use Docker (see [Docker Installation](#docker-installation) below)
27
+
28
+ ---
29
+
30
+ ### Installation
31
+
32
+ #### Option 1: Install from PyPI (Recommended)
33
+
34
+ ```bash
35
+ # Install core package
36
+ pip install noaa-jetstream
37
+
38
+ # Or install with Google Cloud support
39
+ pip install noaa-jetstream[cloud]
40
+
41
+ # Or install with desktop shortcuts
42
+ pip install noaa-jetstream[shortcuts]
43
+
44
+ # Or install everything
45
+ pip install noaa-jetstream[all]
46
+ ```
47
+
48
+ #### Option 2: Install from Source (Development)
49
+
50
+ ```bash
51
+ # Clone the repository
52
+ git clone https://github.com/MichaelAkridge-NOAA/jetstream.git
53
+ cd jetstream
54
+
55
+ # Install in development mode
56
+ pip install -e .
57
+
58
+ # Or with all optional features
59
+ pip install -e ".[all]"
60
+ ```
61
+ ---
62
+
63
+ ### Google Cloud Setup (Optional)
64
+
65
+ Required only for cloud upload features:
66
+
67
+ ```bash
68
+ # Install Google Cloud SDK
69
+ # Download from: https://cloud.google.com/sdk/docs/install
70
+
71
+ # Authenticate
72
+ gcloud auth login --no-launch-browser
73
+ gcloud auth application-default login --no-launch-browser
74
+
75
+ # Verify access (optional)
76
+ gsutil ls
77
+ gcloud auth list
78
+ ```
79
+
80
+ ---
81
+
82
+ ## Starting the Application
83
+
84
+ ### If Installed via pip
85
+
86
+ ```bash
87
+ # Start the server (opens browser automatically)
88
+ jetstream
89
+
90
+ # With custom options
91
+ jetstream --port 9000
92
+ jetstream --host 127.0.0.1 --port 8080
93
+ jetstream --no-browser
94
+ jetstream --log-level debug
95
+ ```
96
+
97
+ ### If Running from Source
98
+
99
+ ```bash
100
+ # Using the CLI
101
+ python main.py
102
+
103
+ # Or with the diagnostic startup script
104
+ python start.py
105
+
106
+ # Or directly with uvicorn
107
+ python -m uvicorn jetstream.main:app --reload
108
+ ```
109
+
110
+ The application will start on **http://localhost:8000** and automatically open in your default browser.
111
+
112
+ ### Desktop Shortcuts
113
+
114
+ Create desktop and Start Menu shortcuts for easy access:
115
+
116
+ ```bash
117
+ # Install with shortcuts support
118
+ pip install noaa-jetstream[shortcuts]
119
+
120
+ # Create shortcuts
121
+ jetstream-create-shortcuts
122
+
123
+ # Remove shortcuts
124
+ jetstream-remove-shortcuts
125
+ ```
126
+
127
+ ### Troubleshooting Startup Issues
128
+
129
+ **If the server appears to start but you can't connect:**
130
+
131
+ 1. **Run diagnostics:**
132
+ ```bash
133
+ python diagnose.py
134
+ ```
135
+
136
+ 2. **Run with debug logging:**
137
+ ```bash
138
+ jetstream --log-level debug
139
+ # or from source:
140
+ python -m uvicorn jetstream.main:app --reload --log-level debug
141
+ ```
142
+ ---
143
+
144
+ ## Troubleshooting
145
+
146
+ **Cannot connect to GCS:**
147
+ - Verify authentication: `gcloud auth list`
148
+ - Check bucket permissions
149
+ - Ensure Application Default Credentials are set
150
+
151
+ **Jobs stuck in queue:**
152
+ - Check queue status in dashboard
153
+ - Verify no jobs are blocking the queue
154
+ - Restart the application if needed
155
+
156
+ **Database errors:**
157
+ - Delete `jetstream.db` to reset (loses history)
158
+ - Check file permissions in application directory
159
+
160
+ **API not responding:**
161
+ - Check if port 8000 is already in use
162
+ - View logs in terminal for error messages
163
+ - Ensure all dependencies are installed
164
+
165
+ ----------
166
+ #### Disclaimer
167
+ This repository is a scientific product and is not official communication of the National Oceanic and Atmospheric Administration, or the United States Department of Commerce. All NOAA GitHub project content is provided on an 'as is' basis and the user assumes responsibility for its use. Any claims against the Department of Commerce or Department of Commerce bureaus stemming from the use of this GitHub project will be governed by all applicable Federal law. Any reference to specific commercial products, processes, or services by service mark, trademark, manufacturer, or otherwise, does not constitute or imply their endorsement, recommendation or favoring by the Department of Commerce. The Department of Commerce seal and logo, or the seal and logo of a DOC bureau, shall not be used in any manner to imply endorsement of any commercial product or activity by DOC or the United States Government.
168
+
169
+ ## License
170
+ See the [LICENSE.md](./LICENSE.md) for details
@@ -0,0 +1,22 @@
1
+ """
2
+ NOAA JetStream - Cloud Data Manager
3
+ A comprehensive tool for managing local-to-cloud uploads with queue management,
4
+ statistics, and folder analysis.
5
+ """
6
+
7
+ __version__ = "0.1.2"
8
+ __author__ = "Michael Akridge"
9
+ __description__ = "JetStream: Cloud Data Manager for local-to-cloud uploads"
10
+
11
+ # Lazy import to avoid triggering server initialization on package import
12
+ def _get_app():
13
+ from jetstream.main import app
14
+ return app
15
+
16
+ # For backwards compatibility
17
+ def __getattr__(name):
18
+ if name == "app":
19
+ return _get_app()
20
+ raise AttributeError(f"module '{__name__}' has no attribute '{name}'")
21
+
22
+ __all__ = ["__version__"]
@@ -0,0 +1,92 @@
1
+ """
2
+ Command-line interface for NOAA JetStream
3
+ """
4
+ import sys
5
+ import argparse
6
+ import uvicorn
7
+ import webbrowser
8
+ import threading
9
+ import time
10
+ import os
11
+
12
+
13
+ def open_browser(url, delay=2.0):
14
+ """Open browser after a delay to ensure server is ready"""
15
+ def _open():
16
+ time.sleep(delay)
17
+ print(f"\n๐ŸŒ Opening browser: {url}")
18
+ webbrowser.open(url)
19
+
20
+ thread = threading.Thread(target=_open, daemon=True)
21
+ thread.start()
22
+
23
+
24
+ def main():
25
+ """Start the JetStream server"""
26
+ parser = argparse.ArgumentParser(
27
+ description="NOAA JetStream - Cloud Data Manager"
28
+ )
29
+ parser.add_argument(
30
+ "--host",
31
+ default="0.0.0.0",
32
+ help="Host to bind to (default: 0.0.0.0)"
33
+ )
34
+ parser.add_argument(
35
+ "--port",
36
+ type=int,
37
+ default=8000,
38
+ help="Port to bind to (default: 8000)"
39
+ )
40
+ parser.add_argument(
41
+ "--reload",
42
+ action="store_true",
43
+ help="Enable auto-reload for development"
44
+ )
45
+ parser.add_argument(
46
+ "--no-browser",
47
+ action="store_true",
48
+ help="Don't automatically open browser"
49
+ )
50
+ parser.add_argument(
51
+ "--log-level",
52
+ default="info",
53
+ choices=["debug", "info", "warning", "error"],
54
+ help="Log level (default: info)"
55
+ )
56
+
57
+ args = parser.parse_args()
58
+
59
+ print()
60
+ print("=" * 60)
61
+ print(" ๐Ÿš€ NOAA JetStream - Cloud Data Manager")
62
+ print(" Local-to-Cloud Upload Management System")
63
+ print("=" * 60)
64
+ print()
65
+ print(f"๐Ÿ“‹ Configuration:")
66
+ print(f" Host: {args.host}")
67
+ print(f" Port: {args.port}")
68
+ print(f" Log Level: {args.log_level}")
69
+ print()
70
+ print(f"๐ŸŒ Web Interface: http://localhost:{args.port}")
71
+ print(f"๐Ÿ“š API Documentation: http://localhost:{args.port}/docs")
72
+ print()
73
+ print("Press Ctrl+C to stop the server")
74
+ print()
75
+
76
+ # Open browser automatically unless disabled
77
+ if not args.no_browser:
78
+ url = f"http://localhost:{args.port}"
79
+ open_browser(url, delay=2.0)
80
+
81
+ # Start server
82
+ uvicorn.run(
83
+ "jetstream.main:app",
84
+ host=args.host,
85
+ port=args.port,
86
+ reload=args.reload,
87
+ log_level=args.log_level,
88
+ )
89
+
90
+
91
+ if __name__ == "__main__":
92
+ main()
@@ -0,0 +1,55 @@
1
+ """Configuration settings for JetStream API."""
2
+
3
+ from pydantic_settings import BaseSettings
4
+ from typing import Optional
5
+ import os
6
+
7
+ class Settings(BaseSettings):
8
+ """Application settings."""
9
+
10
+ # Server settings
11
+ HOST: str = "0.0.0.0"
12
+ PORT: int = 8000
13
+ DEBUG: bool = False
14
+ AUTO_OPEN_BROWSER: bool = True # Auto-open browser on startup
15
+
16
+ # Database
17
+ DATABASE_URL: str = "sqlite:///./jetstream.db"
18
+
19
+ # Google Cloud Storage
20
+ GCS_PROJECT_ID: Optional[str] = None
21
+ GCS_CREDENTIALS_PATH: Optional[str] = None
22
+ GCS_BUCKET_NAME: str = "nmfs_odp_pifsc" # Default bucket name
23
+
24
+ # Scanner Performance Settings (Optimized for very large folders)
25
+ MAX_FILES_FOR_DETAILED_SCAN: int = 1000 # Switch to folder-only after this
26
+ MAX_SUBFOLDERS_FOR_DETAILED_SCAN: int = 20 # Switch to folder-only after this
27
+ SCAN_TIMEOUT_SECONDS: int = 60 # Max time for a scan (1 minute)
28
+ ENABLE_FAST_SCAN: bool = True # Use os.scandir instead of os.walk
29
+
30
+ # File filtering (from jetstream.py)
31
+ EXCLUDE_FOLDERS: list = [
32
+ "_archive", "_YEAR", "ISLAND", "SITE-ID", "SITE_PHOTOS",
33
+ "Corrected", "corrected", "uncorrected", "MISC", "DARK",
34
+ "Products", "Thumbs.db", ".DS_Store", "__pycache__"
35
+ ]
36
+
37
+ EXCLUDE_PATTERNS: list = [
38
+ r'.*\.tmp$',
39
+ r'.*\.bak$',
40
+ r'.*~$',
41
+ r'.*\.pyc$',
42
+ ]
43
+
44
+ INCLUDE_PATTERNS: list = [
45
+ r'^.*(?<!\.JPG)$',
46
+ r'^.*\.(jpg|jpeg|png|tiff|tif|raw|cr2|nef|arw|dng)$',
47
+ r'^.*\.(mp4|mov|avi|mkv)$',
48
+ r'^.*\.(txt|csv|json|xml|log)$'
49
+ ]
50
+
51
+ class Config:
52
+ env_file = ".env"
53
+ case_sensitive = True
54
+
55
+ settings = Settings()