secondmate 0.3.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.
Files changed (49) hide show
  1. secondmate-0.3.0/.devcontainer/devcontainer.json +24 -0
  2. secondmate-0.3.0/.github/workflows/ci.yml +68 -0
  3. secondmate-0.3.0/.gitignore +45 -0
  4. secondmate-0.3.0/.python-version +1 -0
  5. secondmate-0.3.0/PKG-INFO +120 -0
  6. secondmate-0.3.0/README.md +109 -0
  7. secondmate-0.3.0/dev.sh +48 -0
  8. secondmate-0.3.0/eslint.config.js +23 -0
  9. secondmate-0.3.0/index.html +13 -0
  10. secondmate-0.3.0/package-lock.json +3341 -0
  11. secondmate-0.3.0/package.json +36 -0
  12. secondmate-0.3.0/public/vite.svg +1 -0
  13. secondmate-0.3.0/pyproject.toml +22 -0
  14. secondmate-0.3.0/secondmate/__init__.py +1 -0
  15. secondmate-0.3.0/secondmate/cli.py +26 -0
  16. secondmate-0.3.0/secondmate/dependencies.py +38 -0
  17. secondmate-0.3.0/secondmate/main.py +264 -0
  18. secondmate-0.3.0/secondmate/providers/__init__.py +1 -0
  19. secondmate-0.3.0/secondmate/providers/local_spark.py +25 -0
  20. secondmate-0.3.0/secondmate/providers/spark_interface.py +7 -0
  21. secondmate-0.3.0/secondmate/static/assets/index-Gyne2P3W.css +1 -0
  22. secondmate-0.3.0/secondmate/static/assets/index-Yr33fHWr.js +126 -0
  23. secondmate-0.3.0/secondmate/static/index.html +14 -0
  24. secondmate-0.3.0/secondmate/static/vite.svg +1 -0
  25. secondmate-0.3.0/src/App.tsx +13 -0
  26. secondmate-0.3.0/src/assets/react.svg +1 -0
  27. secondmate-0.3.0/src/components/Editor/SqlEditor.module.css +6 -0
  28. secondmate-0.3.0/src/components/Editor/SqlEditor.tsx +70 -0
  29. secondmate-0.3.0/src/components/Layout/MainLayout.module.css +44 -0
  30. secondmate-0.3.0/src/components/Layout/MainLayout.tsx +55 -0
  31. secondmate-0.3.0/src/components/Layout/Sidebar.module.css +155 -0
  32. secondmate-0.3.0/src/components/Layout/Sidebar.tsx +227 -0
  33. secondmate-0.3.0/src/components/Layout/Workspace.module.css +124 -0
  34. secondmate-0.3.0/src/components/Layout/Workspace.tsx +98 -0
  35. secondmate-0.3.0/src/components/Results/DataGrid.module.css +50 -0
  36. secondmate-0.3.0/src/components/Results/DataGrid.tsx +44 -0
  37. secondmate-0.3.0/src/components/SteamboatLoader.module.css +149 -0
  38. secondmate-0.3.0/src/components/SteamboatLoader.tsx +47 -0
  39. secondmate-0.3.0/src/index.css +55 -0
  40. secondmate-0.3.0/src/main.tsx +10 -0
  41. secondmate-0.3.0/src/services/api.ts +83 -0
  42. secondmate-0.3.0/tsconfig.app.json +28 -0
  43. secondmate-0.3.0/tsconfig.json +7 -0
  44. secondmate-0.3.0/tsconfig.node.json +26 -0
  45. secondmate-0.3.0/uv.lock +284 -0
  46. secondmate-0.3.0/verify_assets.py +50 -0
  47. secondmate-0.3.0/verify_conditional_data.py +77 -0
  48. secondmate-0.3.0/verify_injection.py +36 -0
  49. secondmate-0.3.0/vite.config.ts +22 -0
@@ -0,0 +1,24 @@
1
+ {
2
+ "name": "Spark SPA Dev",
3
+ "image": "mcr.microsoft.com/devcontainers/python:3.13",
4
+ "features": {
5
+ "ghcr.io/devcontainers/features/git:1": {},
6
+ "ghcr.io/devcontainers/features/node:1": {},
7
+ "ghcr.io/devcontainers/features/jdk:1": {
8
+ "version": "21"
9
+ }
10
+ },
11
+ "containerUser": "vscode",
12
+ "forwardPorts": [
13
+ 5173
14
+ ],
15
+ "customizations": {
16
+ "vscode": {
17
+ "extensions": [
18
+ "dbaeumer.vscode-eslint",
19
+ "esbenp.prettier-vscode"
20
+ ]
21
+ }
22
+ },
23
+ "postCreateCommand": "npm install"
24
+ }
@@ -0,0 +1,68 @@
1
+ name: CI/CD
2
+
3
+ on:
4
+ push:
5
+ branches: [ "main" ]
6
+ tags:
7
+ - 'v*'
8
+ pull_request:
9
+ branches: [ "main" ]
10
+
11
+ jobs:
12
+ build:
13
+ runs-on: ubuntu-latest
14
+
15
+ steps:
16
+ - uses: actions/checkout@v4
17
+
18
+ - name: Set up Node.js
19
+ uses: actions/setup-node@v4
20
+ with:
21
+ node-version: '20'
22
+ cache: 'npm'
23
+
24
+ - name: Install Node dependencies
25
+ run: npm ci
26
+
27
+ - name: Build frontend
28
+ run: npm run build
29
+
30
+ - name: Install uv
31
+ uses: astral-sh/setup-uv@v5
32
+ with:
33
+ version: "latest"
34
+
35
+ - name: Set up Python
36
+ uses: actions/setup-python@v5
37
+ with:
38
+ python-version-file: ".python-version"
39
+
40
+ - name: Build Python package
41
+ run: uv build
42
+
43
+ - name: Upload artifacts
44
+ uses: actions/upload-artifact@v4
45
+ with:
46
+ name: dist-artifacts
47
+ path: dist/
48
+
49
+ publish-to-pypi:
50
+ needs: build
51
+ if: startsWith(github.ref, 'refs/tags/v')
52
+ runs-on: ubuntu-latest
53
+ environment:
54
+ name: pypi
55
+ url: https://pypi.org/p/secondmate
56
+ permissions:
57
+ id-token: write
58
+ contents: read
59
+
60
+ steps:
61
+ - name: Download artifacts
62
+ uses: actions/download-artifact@v4
63
+ with:
64
+ name: dist-artifacts
65
+ path: dist/
66
+
67
+ - name: Publish package
68
+ uses: pypa/gh-action-pypi-publish@release/v1
@@ -0,0 +1,45 @@
1
+ # Logs
2
+ logs
3
+ *.log
4
+ npm-debug.log*
5
+ yarn-debug.log*
6
+ yarn-error.log*
7
+ pnpm-debug.log*
8
+ lerna-debug.log*
9
+
10
+ node_modules
11
+ dist
12
+ dist-ssr
13
+ *.local
14
+
15
+ # Editor directories and files
16
+ .vscode/*
17
+ !.vscode/extensions.json
18
+ .idea
19
+ .DS_Store
20
+ *.suo
21
+ *.ntvs*
22
+ *.njsproj
23
+ *.sln
24
+ *.sw?
25
+
26
+ # Python
27
+ __pycache__/
28
+ *.py[cod]
29
+ *$py.class
30
+ .venv
31
+ venv/
32
+ env/
33
+ .pytest_cache/
34
+ .coverage
35
+ htmlcov/
36
+ .mypy_cache/
37
+ *.egg-info
38
+
39
+ # Spark / Iceberg
40
+ warehouse/
41
+ spark-warehouse/
42
+ metastore_db/
43
+ derby.log
44
+ *.parquet
45
+ *.avro
@@ -0,0 +1 @@
1
+ 3.13
@@ -0,0 +1,120 @@
1
+ Metadata-Version: 2.4
2
+ Name: secondmate
3
+ Version: 0.3.0
4
+ Summary: Add your description here
5
+ Requires-Python: >=3.11
6
+ Requires-Dist: fastapi>=0.128.0
7
+ Requires-Dist: pydantic>=2.12.5
8
+ Requires-Dist: pyspark>=4.1.0
9
+ Requires-Dist: uvicorn>=0.40.0
10
+ Description-Content-Type: text/markdown
11
+
12
+ # SecondMate
13
+
14
+ SecondMate is a modern data catalog and exploration tool built with a high-performance Python backend and a dynamic React frontend. It provides a seamless interface for managing data catalogs, namespaces, and tables, with built-in support for Apache Iceberg and PySpark.
15
+
16
+ ## 🚀 Key Features
17
+
18
+ * **Dynamic Catalog Browser**: Navigate through your data hierarchy (Catalogs -> Namespaces -> Tables) with an intuitive tree view.
19
+ * **Data Preview**: Instantly query and visualize data from your tables.
20
+ * **Integrated Querying**: Built-in support for executing queries against your data lake.
21
+ * **Iceberg Native**: Designed with Apache Iceberg in mind, including automatic sample data initialization.
22
+ * **Modern UI**: Built with React 19, TypeScript, and Vite, featuring a responsive design with resizable panels and a premier dark-mode aesthetic.
23
+
24
+ ## 🛠️ Tech Stack
25
+
26
+ ### Frontend
27
+ * **Framework**: React 19 + TypeScript
28
+ * **Build Tool**: Vite
29
+ * **State Management**: Zustand
30
+ * **Component**: Monaco Editor, React Resizable Panels
31
+ * **Styling**: Lucide React (Icons), CSS Modules
32
+
33
+ ### Backend
34
+ * **Framework**: FastAPI
35
+ * **Data Processing**: PySpark 4.0+ (Development build)
36
+ * **Table Format**: Apache Iceberg
37
+ * **Server**: Uvicorn
38
+
39
+ ## 📦 Installation & Setup
40
+
41
+ ### Prerequisites
42
+ * Node.js (v18+ recommended)
43
+ * Python 3.11+
44
+ * Java 17+ (for PySpark)
45
+ * [uv](https://github.com/astral-sh/uv) (recommended for Python dependency management)
46
+
47
+ ### 1. Development Environment
48
+
49
+ SecondMate includes a unified development script that starts both the FastAPI backend and Vite frontend together.
50
+
51
+ ```bash
52
+ # Clone the repository and enter the directory
53
+ git clone <repository-url>
54
+ cd secondmate
55
+
56
+ # Install frontend dependencies
57
+ npm install
58
+
59
+ # Create a virtual environment and install backend dependencies using uv
60
+ uv venv
61
+ source .venv/bin/activate # On Windows: .venv\Scripts\activate
62
+ uv pip install -e .
63
+
64
+ # Start the development server (runs both backend and frontend)
65
+ ./dev.sh
66
+ ```
67
+
68
+ - The UI will be available at `http://localhost:5173`.
69
+ - The API will be available at `http://localhost:8000`.
70
+ - Automatic API docs at `http://localhost:8000/docs`.
71
+
72
+ ### 2. Manual/Separate Setup
73
+
74
+ **Frontend (Vite Server):**
75
+ ```bash
76
+ npm install
77
+ npm run dev
78
+ ```
79
+
80
+ **Backend (FastAPI Server):**
81
+ ```bash
82
+ uv venv
83
+ source .venv/bin/activate
84
+ uv pip install -e .
85
+ uvicorn secondmate.main:app --reload --host 0.0.0.0 --port 8000
86
+ ```
87
+
88
+ ### 3. Production Build
89
+
90
+ When building for production, the Vite frontend compiles into the Python package (`secondmate/static`), which is then served by FastAPI.
91
+
92
+ ```bash
93
+ # Build the frontend (outputs to secondmate/static)
94
+ npm run build
95
+
96
+ # Install the Python package and run the CLI
97
+ uv pip install -e .
98
+ secondmate --port 4050
99
+ ```
100
+ *The app will be available at `http://localhost:4050` serving both UI and API.*
101
+
102
+ ## 📚 API Endpoints
103
+
104
+ The backend exposes several key endpoints for metadata and data retrieval:
105
+
106
+ * `GET /health`: Service health check.
107
+ * `GET /info`: Spark session and application details.
108
+ * `GET /catalogs`: List all available catalogs.
109
+ * `GET /catalogs/{catalog_name}/namespaces`: List namespaces within a catalog.
110
+ * `GET /catalogs/{catalog_name}/namespaces/{namespace}/tables`: List tables within a namespace.
111
+ * `GET /query`: Execute a sample query (currently fetches `user.ipgeo`).
112
+
113
+ ## 🧪 Sample Data
114
+
115
+ On startup, the backend automatically initializes a local Spark Iceberg environment with the following sample tables:
116
+ * `user.ipgeo` (1000 rows)
117
+ * `user.sales.transactions`
118
+ * `user.finance.budget`
119
+
120
+ Enjoy exploring your data with SecondMate!
@@ -0,0 +1,109 @@
1
+ # SecondMate
2
+
3
+ SecondMate is a modern data catalog and exploration tool built with a high-performance Python backend and a dynamic React frontend. It provides a seamless interface for managing data catalogs, namespaces, and tables, with built-in support for Apache Iceberg and PySpark.
4
+
5
+ ## 🚀 Key Features
6
+
7
+ * **Dynamic Catalog Browser**: Navigate through your data hierarchy (Catalogs -> Namespaces -> Tables) with an intuitive tree view.
8
+ * **Data Preview**: Instantly query and visualize data from your tables.
9
+ * **Integrated Querying**: Built-in support for executing queries against your data lake.
10
+ * **Iceberg Native**: Designed with Apache Iceberg in mind, including automatic sample data initialization.
11
+ * **Modern UI**: Built with React 19, TypeScript, and Vite, featuring a responsive design with resizable panels and a premier dark-mode aesthetic.
12
+
13
+ ## 🛠️ Tech Stack
14
+
15
+ ### Frontend
16
+ * **Framework**: React 19 + TypeScript
17
+ * **Build Tool**: Vite
18
+ * **State Management**: Zustand
19
+ * **Component**: Monaco Editor, React Resizable Panels
20
+ * **Styling**: Lucide React (Icons), CSS Modules
21
+
22
+ ### Backend
23
+ * **Framework**: FastAPI
24
+ * **Data Processing**: PySpark 4.0+ (Development build)
25
+ * **Table Format**: Apache Iceberg
26
+ * **Server**: Uvicorn
27
+
28
+ ## 📦 Installation & Setup
29
+
30
+ ### Prerequisites
31
+ * Node.js (v18+ recommended)
32
+ * Python 3.11+
33
+ * Java 17+ (for PySpark)
34
+ * [uv](https://github.com/astral-sh/uv) (recommended for Python dependency management)
35
+
36
+ ### 1. Development Environment
37
+
38
+ SecondMate includes a unified development script that starts both the FastAPI backend and Vite frontend together.
39
+
40
+ ```bash
41
+ # Clone the repository and enter the directory
42
+ git clone <repository-url>
43
+ cd secondmate
44
+
45
+ # Install frontend dependencies
46
+ npm install
47
+
48
+ # Create a virtual environment and install backend dependencies using uv
49
+ uv venv
50
+ source .venv/bin/activate # On Windows: .venv\Scripts\activate
51
+ uv pip install -e .
52
+
53
+ # Start the development server (runs both backend and frontend)
54
+ ./dev.sh
55
+ ```
56
+
57
+ - The UI will be available at `http://localhost:5173`.
58
+ - The API will be available at `http://localhost:8000`.
59
+ - Automatic API docs at `http://localhost:8000/docs`.
60
+
61
+ ### 2. Manual/Separate Setup
62
+
63
+ **Frontend (Vite Server):**
64
+ ```bash
65
+ npm install
66
+ npm run dev
67
+ ```
68
+
69
+ **Backend (FastAPI Server):**
70
+ ```bash
71
+ uv venv
72
+ source .venv/bin/activate
73
+ uv pip install -e .
74
+ uvicorn secondmate.main:app --reload --host 0.0.0.0 --port 8000
75
+ ```
76
+
77
+ ### 3. Production Build
78
+
79
+ When building for production, the Vite frontend compiles into the Python package (`secondmate/static`), which is then served by FastAPI.
80
+
81
+ ```bash
82
+ # Build the frontend (outputs to secondmate/static)
83
+ npm run build
84
+
85
+ # Install the Python package and run the CLI
86
+ uv pip install -e .
87
+ secondmate --port 4050
88
+ ```
89
+ *The app will be available at `http://localhost:4050` serving both UI and API.*
90
+
91
+ ## 📚 API Endpoints
92
+
93
+ The backend exposes several key endpoints for metadata and data retrieval:
94
+
95
+ * `GET /health`: Service health check.
96
+ * `GET /info`: Spark session and application details.
97
+ * `GET /catalogs`: List all available catalogs.
98
+ * `GET /catalogs/{catalog_name}/namespaces`: List namespaces within a catalog.
99
+ * `GET /catalogs/{catalog_name}/namespaces/{namespace}/tables`: List tables within a namespace.
100
+ * `GET /query`: Execute a sample query (currently fetches `user.ipgeo`).
101
+
102
+ ## 🧪 Sample Data
103
+
104
+ On startup, the backend automatically initializes a local Spark Iceberg environment with the following sample tables:
105
+ * `user.ipgeo` (1000 rows)
106
+ * `user.sales.transactions`
107
+ * `user.finance.budget`
108
+
109
+ Enjoy exploring your data with SecondMate!
@@ -0,0 +1,48 @@
1
+ #!/bin/bash
2
+
3
+ # Store PIDs
4
+ BACKEND_PID=""
5
+ FRONTEND_PID=""
6
+
7
+ # Function to kill child processes
8
+ cleanup() {
9
+ echo ""
10
+ echo "Stopping all services..."
11
+ if [ -n "$BACKEND_PID" ]; then
12
+ echo "Stopping Backend (PID: $BACKEND_PID)..."
13
+ kill $BACKEND_PID 2>/dev/null
14
+ fi
15
+ if [ -n "$FRONTEND_PID" ]; then
16
+ echo "Stopping Frontend (PID: $FRONTEND_PID)..."
17
+ kill $FRONTEND_PID 2>/dev/null
18
+ fi
19
+ exit 0
20
+ }
21
+
22
+ # Trap SIGINT and SIGTERM
23
+ trap cleanup SIGINT SIGTERM
24
+
25
+ echo "Starting SecondMate Development Environment..."
26
+
27
+ # Start Backend
28
+ echo "Starting Backend (FastAPI)..."
29
+ (
30
+ # Activate virtual environment if it exists
31
+ if [ -d ".venv" ]; then
32
+ source .venv/bin/activate
33
+ elif [ -d "venv" ]; then
34
+ source venv/bin/activate
35
+ fi
36
+ uvicorn secondmate.main:app --reload --host 0.0.0.0
37
+ ) &
38
+ BACKEND_PID=$!
39
+
40
+ # Start Frontend
41
+ echo "Starting Frontend (Vite)..."
42
+ (
43
+ npm run dev
44
+ ) &
45
+ FRONTEND_PID=$!
46
+
47
+ # Wait for processes
48
+ wait $BACKEND_PID $FRONTEND_PID
@@ -0,0 +1,23 @@
1
+ import js from '@eslint/js'
2
+ import globals from 'globals'
3
+ import reactHooks from 'eslint-plugin-react-hooks'
4
+ import reactRefresh from 'eslint-plugin-react-refresh'
5
+ import tseslint from 'typescript-eslint'
6
+ import { defineConfig, globalIgnores } from 'eslint/config'
7
+
8
+ export default defineConfig([
9
+ globalIgnores(['dist']),
10
+ {
11
+ files: ['**/*.{ts,tsx}'],
12
+ extends: [
13
+ js.configs.recommended,
14
+ tseslint.configs.recommended,
15
+ reactHooks.configs.flat.recommended,
16
+ reactRefresh.configs.vite,
17
+ ],
18
+ languageOptions: {
19
+ ecmaVersion: 2020,
20
+ globals: globals.browser,
21
+ },
22
+ },
23
+ ])
@@ -0,0 +1,13 @@
1
+ <!doctype html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8" />
5
+ <link rel="icon" type="image/svg+xml" href="/vite.svg" />
6
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
7
+ <title>secondmate</title>
8
+ </head>
9
+ <body>
10
+ <div id="root"></div>
11
+ <script type="module" src="/src/main.tsx"></script>
12
+ </body>
13
+ </html>