phlo-observatory 0.1.1__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 (156) hide show
  1. phlo_observatory-0.1.1/PKG-INFO +15 -0
  2. phlo_observatory-0.1.1/README.md +61 -0
  3. phlo_observatory-0.1.1/pyproject.toml +55 -0
  4. phlo_observatory-0.1.1/setup.cfg +4 -0
  5. phlo_observatory-0.1.1/src/phlo_observatory/Dockerfile +44 -0
  6. phlo_observatory-0.1.1/src/phlo_observatory/README.md +305 -0
  7. phlo_observatory-0.1.1/src/phlo_observatory/__init__.py +25 -0
  8. phlo_observatory-0.1.1/src/phlo_observatory/components.json +24 -0
  9. phlo_observatory-0.1.1/src/phlo_observatory/eslint.config.js +21 -0
  10. phlo_observatory-0.1.1/src/phlo_observatory/extensions.py +66 -0
  11. phlo_observatory-0.1.1/src/phlo_observatory/manifest.py +72 -0
  12. phlo_observatory-0.1.1/src/phlo_observatory/observatory_ext.py +41 -0
  13. phlo_observatory-0.1.1/src/phlo_observatory/package-lock.json +12586 -0
  14. phlo_observatory-0.1.1/src/phlo_observatory/package.json +62 -0
  15. phlo_observatory-0.1.1/src/phlo_observatory/plugin.py +29 -0
  16. phlo_observatory-0.1.1/src/phlo_observatory/prettier.config.js +10 -0
  17. phlo_observatory-0.1.1/src/phlo_observatory/public/favicon.ico +0 -0
  18. phlo_observatory-0.1.1/src/phlo_observatory/public/logo192.png +0 -0
  19. phlo_observatory-0.1.1/src/phlo_observatory/public/logo512.png +0 -0
  20. phlo_observatory-0.1.1/src/phlo_observatory/public/manifest.json +25 -0
  21. phlo_observatory-0.1.1/src/phlo_observatory/public/robots.txt +3 -0
  22. phlo_observatory-0.1.1/src/phlo_observatory/public/tanstack-circle-logo.png +0 -0
  23. phlo_observatory-0.1.1/src/phlo_observatory/public/tanstack-word-logo-white.svg +1 -0
  24. phlo_observatory-0.1.1/src/phlo_observatory/service.yaml +67 -0
  25. phlo_observatory-0.1.1/src/phlo_observatory/settings.py +24 -0
  26. phlo_observatory-0.1.1/src/phlo_observatory/settings_service.py +124 -0
  27. phlo_observatory-0.1.1/src/phlo_observatory/src/components/AppSidebar.test.ts +23 -0
  28. phlo_observatory-0.1.1/src/phlo_observatory/src/components/AppSidebar.tsx +141 -0
  29. phlo_observatory-0.1.1/src/phlo_observatory/src/components/CommandPalette.tsx +300 -0
  30. phlo_observatory-0.1.1/src/phlo_observatory/src/components/GraphCanvas.tsx +414 -0
  31. phlo_observatory-0.1.1/src/phlo_observatory/src/components/NodeInfoPanel.tsx +303 -0
  32. phlo_observatory-0.1.1/src/phlo_observatory/src/components/ThemeToggle.tsx +67 -0
  33. phlo_observatory-0.1.1/src/phlo_observatory/src/components/data/BookmarkButton.tsx +95 -0
  34. phlo_observatory-0.1.1/src/phlo_observatory/src/components/data/BranchSelector.tsx +75 -0
  35. phlo_observatory-0.1.1/src/phlo_observatory/src/components/data/DataPreview.tsx +224 -0
  36. phlo_observatory-0.1.1/src/phlo_observatory/src/components/data/LogViewer.tsx +277 -0
  37. phlo_observatory-0.1.1/src/phlo_observatory/src/components/data/ObservatoryTable.tsx +398 -0
  38. phlo_observatory-0.1.1/src/phlo_observatory/src/components/data/QueryEditor.tsx +196 -0
  39. phlo_observatory-0.1.1/src/phlo_observatory/src/components/data/QueryResults.tsx +96 -0
  40. phlo_observatory-0.1.1/src/phlo_observatory/src/components/data/RowJourney.tsx +852 -0
  41. phlo_observatory-0.1.1/src/phlo_observatory/src/components/data/SaveQueryDialog.tsx +135 -0
  42. phlo_observatory-0.1.1/src/phlo_observatory/src/components/data/SavedQueriesPanel.tsx +234 -0
  43. phlo_observatory-0.1.1/src/phlo_observatory/src/components/data/StageDiff.tsx +444 -0
  44. phlo_observatory-0.1.1/src/phlo_observatory/src/components/data/TableBrowserVirtualized.tsx +362 -0
  45. phlo_observatory-0.1.1/src/phlo_observatory/src/components/flow/JourneyNode.tsx +101 -0
  46. phlo_observatory-0.1.1/src/phlo_observatory/src/components/flow/nodeTypes.ts +10 -0
  47. phlo_observatory-0.1.1/src/phlo_observatory/src/components/hub/ServiceCard.tsx +288 -0
  48. phlo_observatory-0.1.1/src/phlo_observatory/src/components/provenance/DataJourney.tsx +231 -0
  49. phlo_observatory-0.1.1/src/phlo_observatory/src/components/provenance/MaterializationTimeline.tsx +224 -0
  50. phlo_observatory-0.1.1/src/phlo_observatory/src/components/ui/badge.tsx +53 -0
  51. phlo_observatory-0.1.1/src/phlo_observatory/src/components/ui/breadcrumb.tsx +122 -0
  52. phlo_observatory-0.1.1/src/phlo_observatory/src/components/ui/button.tsx +57 -0
  53. phlo_observatory-0.1.1/src/phlo_observatory/src/components/ui/card.tsx +103 -0
  54. phlo_observatory-0.1.1/src/phlo_observatory/src/components/ui/collapsible.tsx +19 -0
  55. phlo_observatory-0.1.1/src/phlo_observatory/src/components/ui/command.tsx +190 -0
  56. phlo_observatory-0.1.1/src/phlo_observatory/src/components/ui/dialog.tsx +156 -0
  57. phlo_observatory-0.1.1/src/phlo_observatory/src/components/ui/dropdown-menu.tsx +262 -0
  58. phlo_observatory-0.1.1/src/phlo_observatory/src/components/ui/input-group.tsx +158 -0
  59. phlo_observatory-0.1.1/src/phlo_observatory/src/components/ui/input.tsx +20 -0
  60. phlo_observatory-0.1.1/src/phlo_observatory/src/components/ui/label.tsx +20 -0
  61. phlo_observatory-0.1.1/src/phlo_observatory/src/components/ui/scroll-area.tsx +51 -0
  62. phlo_observatory-0.1.1/src/phlo_observatory/src/components/ui/select.tsx +199 -0
  63. phlo_observatory-0.1.1/src/phlo_observatory/src/components/ui/separator.tsx +23 -0
  64. phlo_observatory-0.1.1/src/phlo_observatory/src/components/ui/sheet.tsx +132 -0
  65. phlo_observatory-0.1.1/src/phlo_observatory/src/components/ui/sidebar.tsx +724 -0
  66. phlo_observatory-0.1.1/src/phlo_observatory/src/components/ui/skeleton.tsx +13 -0
  67. phlo_observatory-0.1.1/src/phlo_observatory/src/components/ui/table.tsx +114 -0
  68. phlo_observatory-0.1.1/src/phlo_observatory/src/components/ui/tabs.tsx +83 -0
  69. phlo_observatory-0.1.1/src/phlo_observatory/src/components/ui/textarea.tsx +18 -0
  70. phlo_observatory-0.1.1/src/phlo_observatory/src/components/ui/toaster.tsx +37 -0
  71. phlo_observatory-0.1.1/src/phlo_observatory/src/components/ui/tooltip.tsx +68 -0
  72. phlo_observatory-0.1.1/src/phlo_observatory/src/extensions/registry.tsx +289 -0
  73. phlo_observatory-0.1.1/src/phlo_observatory/src/hooks/use-mobile.ts +26 -0
  74. phlo_observatory-0.1.1/src/phlo_observatory/src/hooks/use-toast.ts +150 -0
  75. phlo_observatory-0.1.1/src/phlo_observatory/src/hooks/useBookmarks.ts +145 -0
  76. phlo_observatory-0.1.1/src/phlo_observatory/src/hooks/useObservatorySettings.tsx +112 -0
  77. phlo_observatory-0.1.1/src/phlo_observatory/src/hooks/useRealtimePolling.ts +98 -0
  78. phlo_observatory-0.1.1/src/phlo_observatory/src/hooks/useSavedQueries.ts +153 -0
  79. phlo_observatory-0.1.1/src/phlo_observatory/src/lib/api.ts +595 -0
  80. phlo_observatory-0.1.1/src/phlo_observatory/src/lib/observatorySettings.ts +116 -0
  81. phlo_observatory-0.1.1/src/phlo_observatory/src/lib/savedQueries.ts +329 -0
  82. phlo_observatory-0.1.1/src/phlo_observatory/src/lib/utils.ts +7 -0
  83. phlo_observatory-0.1.1/src/phlo_observatory/src/logo.svg +12 -0
  84. phlo_observatory-0.1.1/src/phlo_observatory/src/routeTree.gen.ts +451 -0
  85. phlo_observatory-0.1.1/src/phlo_observatory/src/router.tsx +15 -0
  86. phlo_observatory-0.1.1/src/phlo_observatory/src/routes/__root.tsx +228 -0
  87. phlo_observatory-0.1.1/src/phlo_observatory/src/routes/assets/$assetId.tsx +692 -0
  88. phlo_observatory-0.1.1/src/phlo_observatory/src/routes/assets/index.tsx +273 -0
  89. phlo_observatory-0.1.1/src/phlo_observatory/src/routes/branches/$branchName.tsx +515 -0
  90. phlo_observatory-0.1.1/src/phlo_observatory/src/routes/branches/index.tsx +805 -0
  91. phlo_observatory-0.1.1/src/phlo_observatory/src/routes/data/$branchName/$schema/$table/$rowId.tsx +236 -0
  92. phlo_observatory-0.1.1/src/phlo_observatory/src/routes/data/$branchName/$schema.$table.tsx +496 -0
  93. phlo_observatory-0.1.1/src/phlo_observatory/src/routes/data/$branchName/index.tsx +107 -0
  94. phlo_observatory-0.1.1/src/phlo_observatory/src/routes/data/$branchName.tsx +140 -0
  95. phlo_observatory-0.1.1/src/phlo_observatory/src/routes/data/$schema.$table.tsx +24 -0
  96. phlo_observatory-0.1.1/src/phlo_observatory/src/routes/data/index.tsx +19 -0
  97. phlo_observatory-0.1.1/src/phlo_observatory/src/routes/extensions/$extensionName.tsx +155 -0
  98. phlo_observatory-0.1.1/src/phlo_observatory/src/routes/graph/index.tsx +223 -0
  99. phlo_observatory-0.1.1/src/phlo_observatory/src/routes/hub/index.tsx +257 -0
  100. phlo_observatory-0.1.1/src/phlo_observatory/src/routes/hub/plugins.tsx +219 -0
  101. phlo_observatory-0.1.1/src/phlo_observatory/src/routes/index.tsx +350 -0
  102. phlo_observatory-0.1.1/src/phlo_observatory/src/routes/logs.tsx +435 -0
  103. phlo_observatory-0.1.1/src/phlo_observatory/src/routes/quality/index.tsx +943 -0
  104. phlo_observatory-0.1.1/src/phlo_observatory/src/routes/settings.tsx +555 -0
  105. phlo_observatory-0.1.1/src/phlo_observatory/src/server/auth.server.ts +130 -0
  106. phlo_observatory-0.1.1/src/phlo_observatory/src/server/cache.server.ts +23 -0
  107. phlo_observatory-0.1.1/src/phlo_observatory/src/server/cache.test.ts +167 -0
  108. phlo_observatory-0.1.1/src/phlo_observatory/src/server/cache.ts +317 -0
  109. phlo_observatory-0.1.1/src/phlo_observatory/src/server/contributing.server.test.ts +56 -0
  110. phlo_observatory-0.1.1/src/phlo_observatory/src/server/contributing.server.ts +552 -0
  111. phlo_observatory-0.1.1/src/phlo_observatory/src/server/dagster.server.ts +285 -0
  112. phlo_observatory-0.1.1/src/phlo_observatory/src/server/diff.server.ts +361 -0
  113. phlo_observatory-0.1.1/src/phlo_observatory/src/server/docker-labels.test.ts +35 -0
  114. phlo_observatory-0.1.1/src/phlo_observatory/src/server/docker-labels.ts +32 -0
  115. phlo_observatory-0.1.1/src/phlo_observatory/src/server/extension-settings.server.ts +38 -0
  116. phlo_observatory-0.1.1/src/phlo_observatory/src/server/extensions.server.ts +107 -0
  117. phlo_observatory-0.1.1/src/phlo_observatory/src/server/graph.server.ts +366 -0
  118. phlo_observatory-0.1.1/src/phlo_observatory/src/server/iceberg.server.ts +229 -0
  119. phlo_observatory-0.1.1/src/phlo_observatory/src/server/lineage.server.ts +156 -0
  120. phlo_observatory-0.1.1/src/phlo_observatory/src/server/logger.server.ts +85 -0
  121. phlo_observatory-0.1.1/src/phlo_observatory/src/server/loki.server.test.ts +140 -0
  122. phlo_observatory-0.1.1/src/phlo_observatory/src/server/loki.server.ts +274 -0
  123. phlo_observatory-0.1.1/src/phlo_observatory/src/server/maintenance.server.ts +102 -0
  124. phlo_observatory-0.1.1/src/phlo_observatory/src/server/nessie.server.ts +332 -0
  125. phlo_observatory-0.1.1/src/phlo_observatory/src/server/observatory-settings.server.ts +38 -0
  126. phlo_observatory-0.1.1/src/phlo_observatory/src/server/phlo-api.ts +95 -0
  127. phlo_observatory-0.1.1/src/phlo_observatory/src/server/plugins.server.test.ts +120 -0
  128. phlo_observatory-0.1.1/src/phlo_observatory/src/server/plugins.server.ts +153 -0
  129. phlo_observatory-0.1.1/src/phlo_observatory/src/server/quality.dagster.test.ts +120 -0
  130. phlo_observatory-0.1.1/src/phlo_observatory/src/server/quality.dagster.ts +430 -0
  131. phlo_observatory-0.1.1/src/phlo_observatory/src/server/quality.server.ts +262 -0
  132. phlo_observatory-0.1.1/src/phlo_observatory/src/server/quality.types.ts +53 -0
  133. phlo_observatory-0.1.1/src/phlo_observatory/src/server/queryGuardrails.test.ts +85 -0
  134. phlo_observatory-0.1.1/src/phlo_observatory/src/server/queryGuardrails.ts +271 -0
  135. phlo_observatory-0.1.1/src/phlo_observatory/src/server/search.server.ts +107 -0
  136. phlo_observatory-0.1.1/src/phlo_observatory/src/server/search.types.ts +47 -0
  137. phlo_observatory-0.1.1/src/phlo_observatory/src/server/services.server.ts +907 -0
  138. phlo_observatory-0.1.1/src/phlo_observatory/src/server/settings.server.ts +21 -0
  139. phlo_observatory-0.1.1/src/phlo_observatory/src/server/trino.server.ts +372 -0
  140. phlo_observatory-0.1.1/src/phlo_observatory/src/styles.css +169 -0
  141. phlo_observatory-0.1.1/src/phlo_observatory/src/utils/caseTransform.ts +56 -0
  142. phlo_observatory-0.1.1/src/phlo_observatory/src/utils/dateFormat.ts +15 -0
  143. phlo_observatory-0.1.1/src/phlo_observatory/src/utils/effectiveSettings.ts +9 -0
  144. phlo_observatory-0.1.1/src/phlo_observatory/src/utils/sqlIdentifiers.ts +18 -0
  145. phlo_observatory-0.1.1/src/phlo_observatory/src/utils/sqlParser.test.ts +107 -0
  146. phlo_observatory-0.1.1/src/phlo_observatory/src/utils/sqlParser.ts +891 -0
  147. phlo_observatory-0.1.1/src/phlo_observatory/tsconfig.json +35 -0
  148. phlo_observatory-0.1.1/src/phlo_observatory/vite.config.ts +40 -0
  149. phlo_observatory-0.1.1/src/phlo_observatory.egg-info/PKG-INFO +15 -0
  150. phlo_observatory-0.1.1/src/phlo_observatory.egg-info/SOURCES.txt +154 -0
  151. phlo_observatory-0.1.1/src/phlo_observatory.egg-info/dependency_links.txt +1 -0
  152. phlo_observatory-0.1.1/src/phlo_observatory.egg-info/entry_points.txt +2 -0
  153. phlo_observatory-0.1.1/src/phlo_observatory.egg-info/requires.txt +6 -0
  154. phlo_observatory-0.1.1/src/phlo_observatory.egg-info/top_level.txt +1 -0
  155. phlo_observatory-0.1.1/tests/test_integration_observatory.py +24 -0
  156. phlo_observatory-0.1.1/tests/test_service_runtime_contract.py +15 -0
@@ -0,0 +1,15 @@
1
+ Metadata-Version: 2.4
2
+ Name: phlo-observatory
3
+ Version: 0.1.1
4
+ Summary: Phlo Observatory - Data platform UI (bundled with phlo core)
5
+ Author-email: Phlo Team <team@phlo.dev>
6
+ License: MIT
7
+ Requires-Python: >=3.11
8
+ Description-Content-Type: text/plain
9
+ Requires-Dist: phlo>=0.1.0
10
+ Requires-Dist: phlo-postgres>=0.1.0
11
+ Provides-Extra: dev
12
+ Requires-Dist: pytest>=7.0; extra == "dev"
13
+ Requires-Dist: ruff>=0.1.0; extra == "dev"
14
+
15
+ Phlo Observatory - Data platform visibility and lineage UI.
@@ -0,0 +1,61 @@
1
+ # phlo-observatory
2
+
3
+ Phlo Observatory UI for data platform visibility.
4
+
5
+ ## Description
6
+
7
+ Web-based UI for exploring the data lakehouse. View lineage, browse tables, run queries, and monitor pipeline health.
8
+
9
+ ## Installation
10
+
11
+ ```bash
12
+ pip install phlo-observatory
13
+ # or
14
+ phlo plugin install observatory
15
+ ```
16
+
17
+ ## Configuration
18
+
19
+ | Variable | Default | Description |
20
+ | --------------------- | ----------------------------- | ------------------------ |
21
+ | `OBSERVATORY_PORT` | `3001` | Observatory web UI port |
22
+ | `DAGSTER_GRAPHQL_URL` | `http://dagster:3000/graphql` | Dagster GraphQL endpoint |
23
+ | `NESSIE_URL` | `http://nessie:19120/api/v2` | Nessie API URL |
24
+ | `TRINO_URL` | `http://trino:8080` | Trino HTTP URL |
25
+ | `PHLO_API_URL` | `http://phlo-api:4000` | Phlo API URL |
26
+
27
+ ## Auto-Configuration
28
+
29
+ This package is **auto-configured** via environment:
30
+
31
+ | Feature | How It Works |
32
+ | ------------------ | ------------------------------------------ |
33
+ | **API Connection** | Connects to phlo-api for backend data |
34
+ | **Service URLs** | Auto-configured from environment variables |
35
+ | **Dev Mode** | Hot-reloading in `--dev` mode |
36
+
37
+ ## Usage
38
+
39
+ ```bash
40
+ # Start Observatory
41
+ phlo services start --service observatory
42
+
43
+ # Start with dev mode (hot-reload)
44
+ phlo services start --dev
45
+ ```
46
+
47
+ ## Features
48
+
49
+ - **Data Explorer** - Browse tables, view schemas, query data
50
+ - **Lineage Graph** - Visualize data flow and dependencies
51
+ - **Asset Browser** - View Dagster assets and materialization status
52
+ - **Quality Dashboard** - Monitor quality check results
53
+ - **Branch Management** - Create and merge Nessie branches
54
+
55
+ ## Endpoints
56
+
57
+ - **Web UI**: `http://localhost:3001`
58
+
59
+ ## Entry Points
60
+
61
+ - `phlo.plugins.services` - Provides `ObservatoryServicePlugin`
@@ -0,0 +1,55 @@
1
+ [build-system]
2
+ requires = ["setuptools>=45", "wheel"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "phlo-observatory"
7
+ version = "0.1.1"
8
+ description = "Phlo Observatory - Data platform UI (bundled with phlo core)"
9
+ readme = {text = "Phlo Observatory - Data platform visibility and lineage UI.", content-type = "text/plain"}
10
+ requires-python = ">=3.11"
11
+ authors = [
12
+ {name = "Phlo Team", email = "team@phlo.dev"},
13
+ ]
14
+ license = {text = "MIT"}
15
+ dependencies = [
16
+ "phlo>=0.1.0",
17
+ "phlo-postgres>=0.1.0",
18
+ ]
19
+
20
+ [project.optional-dependencies]
21
+ dev = [
22
+ "pytest>=7.0",
23
+ "ruff>=0.1.0",
24
+ ]
25
+
26
+ [project.entry-points."phlo.plugins.services"]
27
+ observatory = "phlo_observatory.plugin:ObservatoryServicePlugin"
28
+
29
+ [tool.setuptools]
30
+ package-dir = {"" = "src"}
31
+ include-package-data = true
32
+
33
+ [tool.setuptools.packages.find]
34
+ where = ["src"]
35
+
36
+ [tool.setuptools.package-data]
37
+ phlo_observatory = [
38
+ "service.yaml",
39
+ "Dockerfile",
40
+ "README.md",
41
+ "components.json",
42
+ "eslint.config.js",
43
+ "package.json",
44
+ "package-lock.json",
45
+ "prettier.config.js",
46
+ "tsconfig.json",
47
+ "vite.config.ts",
48
+ "context/**",
49
+ "public/**",
50
+ "src/**",
51
+ ]
52
+
53
+ [tool.ruff]
54
+ line-length = 100
55
+ target-version = "py311"
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,44 @@
1
+ # Build stage
2
+ FROM node:24-alpine AS builder
3
+
4
+ WORKDIR /app
5
+
6
+ # Copy package files
7
+ COPY package*.json ./
8
+
9
+ # Install dependencies
10
+ RUN npm ci
11
+
12
+ # Copy source files
13
+ COPY . .
14
+
15
+ # Build the application
16
+ RUN npm run build
17
+
18
+ # Production stage
19
+ FROM node:24-alpine AS runner
20
+
21
+ WORKDIR /app
22
+
23
+ # Required for service discovery/status code paths that run `docker ps`.
24
+ RUN apk add --no-cache docker-cli
25
+
26
+ # Copy built application
27
+ COPY --from=builder /app/.output /app/.output
28
+ COPY --from=builder /app/package*.json ./
29
+ COPY --from=builder /app/node_modules /app/node_modules
30
+
31
+ # Set environment
32
+ ENV NODE_ENV=production
33
+ ENV HOST=0.0.0.0
34
+ ENV PORT=3001
35
+
36
+ # Expose port
37
+ EXPOSE 3001
38
+
39
+ # Health check
40
+ HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
41
+ CMD wget --no-verbose --tries=1 --spider http://localhost:3001/ || exit 1
42
+
43
+ # Run the application
44
+ CMD ["node", ".output/server/index.mjs"]
@@ -0,0 +1,305 @@
1
+ Welcome to your new TanStack app!
2
+
3
+ # Getting Started
4
+
5
+ To run this application:
6
+
7
+ ```bash
8
+ npm install
9
+ npm run start
10
+ ```
11
+
12
+ ## Dev Host Configuration
13
+
14
+ Vite dev server host settings can be overridden via environment variables:
15
+
16
+ - `DEV_HOST`: server host (default: `localhost`)
17
+ - `DEV_HMR_HOST`: HMR host (default: `DEV_HOST`)
18
+ - `DEV_ALLOWED_HOSTS`: comma-separated allowed hosts (default: `DEV_HOST`)
19
+
20
+ # Building For Production
21
+
22
+ To build this application for production:
23
+
24
+ ```bash
25
+ npm run build
26
+ ```
27
+
28
+ ## Testing
29
+
30
+ This project uses [Vitest](https://vitest.dev/) for testing. You can run the tests with:
31
+
32
+ ```bash
33
+ npm run test
34
+ ```
35
+
36
+ ## Styling
37
+
38
+ This project uses [Tailwind CSS](https://tailwindcss.com/) for styling.
39
+
40
+ ## Linting & Formatting
41
+
42
+ This project uses [eslint](https://eslint.org/) and [prettier](https://prettier.io/) for linting and formatting. Eslint is configured using [tanstack/eslint-config](https://tanstack.com/config/latest/docs/eslint). The following scripts are available:
43
+
44
+ ```bash
45
+ npm run lint
46
+ npm run format
47
+ npm run check
48
+ ```
49
+
50
+ ## Routing
51
+
52
+ This project uses [TanStack Router](https://tanstack.com/router). The initial setup is a file based router. Which means that the routes are managed as files in `src/routes`.
53
+
54
+ ### Adding A Route
55
+
56
+ To add a new route to your application just add another a new file in the `./src/routes` directory.
57
+
58
+ TanStack will automatically generate the content of the route file for you.
59
+
60
+ Now that you have two routes you can use a `Link` component to navigate between them.
61
+
62
+ ### Adding Links
63
+
64
+ To use SPA (Single Page Application) navigation you will need to import the `Link` component from `@tanstack/react-router`.
65
+
66
+ ```tsx
67
+ import { Link } from '@tanstack/react-router'
68
+ ```
69
+
70
+ Then anywhere in your JSX you can use it like so:
71
+
72
+ ```tsx
73
+ <Link to="/about">About</Link>
74
+ ```
75
+
76
+ This will create a link that will navigate to the `/about` route.
77
+
78
+ More information on the `Link` component can be found in the [Link documentation](https://tanstack.com/router/v1/docs/framework/react/api/router/linkComponent).
79
+
80
+ ### Using A Layout
81
+
82
+ In the File Based Routing setup the layout is located in `src/routes/__root.tsx`. Anything you add to the root route will appear in all the routes. The route content will appear in the JSX where you use the `<Outlet />` component.
83
+
84
+ Here is an example layout that includes a header:
85
+
86
+ ```tsx
87
+ import { Outlet, createRootRoute } from '@tanstack/react-router'
88
+ import { TanStackRouterDevtools } from '@tanstack/react-router-devtools'
89
+
90
+ import { Link } from '@tanstack/react-router'
91
+
92
+ export const Route = createRootRoute({
93
+ component: () => (
94
+ <>
95
+ <header>
96
+ <nav>
97
+ <Link to="/">Home</Link>
98
+ <Link to="/about">About</Link>
99
+ </nav>
100
+ </header>
101
+ <Outlet />
102
+ <TanStackRouterDevtools />
103
+ </>
104
+ ),
105
+ })
106
+ ```
107
+
108
+ The `<TanStackRouterDevtools />` component is not required so you can remove it if you don't want it in your layout.
109
+
110
+ More information on layouts can be found in the [Layouts documentation](https://tanstack.com/router/latest/docs/framework/react/guide/routing-concepts#layouts).
111
+
112
+ ## Data Fetching
113
+
114
+ There are multiple ways to fetch data in your application. You can use TanStack Query to fetch data from a server. But you can also use the `loader` functionality built into TanStack Router to load the data for a route before it's rendered.
115
+
116
+ For example:
117
+
118
+ ```tsx
119
+ const peopleRoute = createRoute({
120
+ getParentRoute: () => rootRoute,
121
+ path: '/people',
122
+ loader: async () => {
123
+ const response = await fetch('https://swapi.dev/api/people')
124
+ return response.json() as Promise<{
125
+ results: {
126
+ name: string
127
+ }[]
128
+ }>
129
+ },
130
+ component: () => {
131
+ const data = peopleRoute.useLoaderData()
132
+ return (
133
+ <ul>
134
+ {data.results.map((person) => (
135
+ <li key={person.name}>{person.name}</li>
136
+ ))}
137
+ </ul>
138
+ )
139
+ },
140
+ })
141
+ ```
142
+
143
+ Loaders simplify your data fetching logic dramatically. Check out more information in the [Loader documentation](https://tanstack.com/router/latest/docs/framework/react/guide/data-loading#loader-parameters).
144
+
145
+ ### React-Query
146
+
147
+ React-Query is an excellent addition or alternative to route loading and integrating it into you application is a breeze.
148
+
149
+ First add your dependencies:
150
+
151
+ ```bash
152
+ npm install @tanstack/react-query @tanstack/react-query-devtools
153
+ ```
154
+
155
+ Next we'll need to create a query client and provider. We recommend putting those in `main.tsx`.
156
+
157
+ ```tsx
158
+ import { QueryClient, QueryClientProvider } from '@tanstack/react-query'
159
+
160
+ // ...
161
+
162
+ const queryClient = new QueryClient()
163
+
164
+ // ...
165
+
166
+ if (!rootElement.innerHTML) {
167
+ const root = ReactDOM.createRoot(rootElement)
168
+
169
+ root.render(
170
+ <QueryClientProvider client={queryClient}>
171
+ <RouterProvider router={router} />
172
+ </QueryClientProvider>,
173
+ )
174
+ }
175
+ ```
176
+
177
+ You can also add TanStack Query Devtools to the root route (optional).
178
+
179
+ ```tsx
180
+ import { ReactQueryDevtools } from '@tanstack/react-query-devtools'
181
+
182
+ const rootRoute = createRootRoute({
183
+ component: () => (
184
+ <>
185
+ <Outlet />
186
+ <ReactQueryDevtools buttonPosition="top-right" />
187
+ <TanStackRouterDevtools />
188
+ </>
189
+ ),
190
+ })
191
+ ```
192
+
193
+ Now you can use `useQuery` to fetch your data.
194
+
195
+ ```tsx
196
+ import { useQuery } from '@tanstack/react-query'
197
+
198
+ import './App.css'
199
+
200
+ function App() {
201
+ const { data } = useQuery({
202
+ queryKey: ['people'],
203
+ queryFn: () =>
204
+ fetch('https://swapi.dev/api/people')
205
+ .then((res) => res.json())
206
+ .then((data) => data.results as { name: string }[]),
207
+ initialData: [],
208
+ })
209
+
210
+ return (
211
+ <div>
212
+ <ul>
213
+ {data.map((person) => (
214
+ <li key={person.name}>{person.name}</li>
215
+ ))}
216
+ </ul>
217
+ </div>
218
+ )
219
+ }
220
+
221
+ export default App
222
+ ```
223
+
224
+ You can find out everything you need to know on how to use React-Query in the [React-Query documentation](https://tanstack.com/query/latest/docs/framework/react/overview).
225
+
226
+ ## State Management
227
+
228
+ Another common requirement for React applications is state management. There are many options for state management in React. TanStack Store provides a great starting point for your project.
229
+
230
+ First you need to add TanStack Store as a dependency:
231
+
232
+ ```bash
233
+ npm install @tanstack/store
234
+ ```
235
+
236
+ Now let's create a simple counter in the `src/App.tsx` file as a demonstration.
237
+
238
+ ```tsx
239
+ import { useStore } from '@tanstack/react-store'
240
+ import { Store } from '@tanstack/store'
241
+ import './App.css'
242
+
243
+ const countStore = new Store(0)
244
+
245
+ function App() {
246
+ const count = useStore(countStore)
247
+ return (
248
+ <div>
249
+ <button onClick={() => countStore.setState((n) => n + 1)}>
250
+ Increment - {count}
251
+ </button>
252
+ </div>
253
+ )
254
+ }
255
+
256
+ export default App
257
+ ```
258
+
259
+ One of the many nice features of TanStack Store is the ability to derive state from other state. That derived state will update when the base state updates.
260
+
261
+ Let's check this out by doubling the count using derived state.
262
+
263
+ ```tsx
264
+ import { useStore } from '@tanstack/react-store'
265
+ import { Store, Derived } from '@tanstack/store'
266
+ import './App.css'
267
+
268
+ const countStore = new Store(0)
269
+
270
+ const doubledStore = new Derived({
271
+ fn: () => countStore.state * 2,
272
+ deps: [countStore],
273
+ })
274
+ doubledStore.mount()
275
+
276
+ function App() {
277
+ const count = useStore(countStore)
278
+ const doubledCount = useStore(doubledStore)
279
+
280
+ return (
281
+ <div>
282
+ <button onClick={() => countStore.setState((n) => n + 1)}>
283
+ Increment - {count}
284
+ </button>
285
+ <div>Doubled - {doubledCount}</div>
286
+ </div>
287
+ )
288
+ }
289
+
290
+ export default App
291
+ ```
292
+
293
+ We use the `Derived` class to create a new store that is derived from another store. The `Derived` class has a `mount` method that will start the derived store updating.
294
+
295
+ Once we've created the derived store we can use it in the `App` component just like we would any other store using the `useStore` hook.
296
+
297
+ You can find out everything you need to know on how to use TanStack Store in the [TanStack Store documentation](https://tanstack.com/store/latest).
298
+
299
+ # Demo files
300
+
301
+ Files prefixed with `demo` can be safely deleted. They are there to provide a starting point for you to play around with the features you've installed.
302
+
303
+ # Learn More
304
+
305
+ You can learn more about all of the offerings from TanStack in the [TanStack documentation](https://tanstack.com).
@@ -0,0 +1,25 @@
1
+ """Observatory UI plugin package."""
2
+
3
+ from phlo_observatory.manifest import ObservatoryExtensionManifest
4
+ from phlo_observatory.observatory_ext import ObservatoryExtensionPlugin
5
+ from phlo_observatory.plugin import ObservatoryServicePlugin
6
+ from phlo_observatory.settings import ObservatorySettings, get_settings
7
+ from phlo_observatory.settings_service import (
8
+ SettingsRecord,
9
+ SettingsScope,
10
+ SettingsService,
11
+ get_settings_service,
12
+ )
13
+
14
+ __all__ = [
15
+ "ObservatoryExtensionManifest",
16
+ "ObservatoryExtensionPlugin",
17
+ "ObservatoryServicePlugin",
18
+ "ObservatorySettings",
19
+ "SettingsRecord",
20
+ "SettingsScope",
21
+ "SettingsService",
22
+ "get_settings",
23
+ "get_settings_service",
24
+ ]
25
+ __version__ = "0.1.0"
@@ -0,0 +1,24 @@
1
+ {
2
+ "$schema": "https://ui.shadcn.com/schema.json",
3
+ "style": "base-lyra",
4
+ "rsc": false,
5
+ "tsx": true,
6
+ "tailwind": {
7
+ "config": "",
8
+ "css": "src/styles.css",
9
+ "baseColor": "neutral",
10
+ "cssVariables": true,
11
+ "prefix": ""
12
+ },
13
+ "iconLibrary": "lucide",
14
+ "aliases": {
15
+ "components": "@/components",
16
+ "utils": "@/lib/utils",
17
+ "ui": "@/components/ui",
18
+ "lib": "@/lib",
19
+ "hooks": "@/hooks"
20
+ },
21
+ "menuColor": "default",
22
+ "menuAccent": "subtle",
23
+ "registries": {}
24
+ }
@@ -0,0 +1,21 @@
1
+ // @ts-check
2
+
3
+ import { tanstackConfig } from '@tanstack/eslint-config'
4
+
5
+ export default [
6
+ {
7
+ ignores: [
8
+ '**/.output/**',
9
+ '**/dist/**',
10
+ '**/node_modules/**',
11
+ '**/eslint.config.js',
12
+ '**/prettier.config.js',
13
+ ],
14
+ },
15
+ ...tanstackConfig,
16
+ {
17
+ rules: {
18
+ '@typescript-eslint/no-unnecessary-condition': 'off',
19
+ },
20
+ },
21
+ ]
@@ -0,0 +1,66 @@
1
+ """Observatory extension discovery utilities."""
2
+
3
+ from __future__ import annotations
4
+
5
+ import importlib.metadata
6
+
7
+ from phlo.config import get_settings
8
+ from phlo.logging import get_logger
9
+ from phlo_observatory import ObservatoryExtensionPlugin
10
+
11
+ logger = get_logger(__name__)
12
+
13
+ _ENTRY_POINT_GROUP = "phlo.plugins.observatory"
14
+
15
+
16
+ def _is_plugin_allowed(plugin_name: str) -> bool:
17
+ settings = get_settings()
18
+ if plugin_name in settings.plugins_blacklist:
19
+ logger.debug("Plugin '%s' is blacklisted, skipping", plugin_name)
20
+ return False
21
+ if settings.plugins_whitelist and plugin_name not in settings.plugins_whitelist:
22
+ logger.debug("Plugin '%s' is not in whitelist, skipping", plugin_name)
23
+ return False
24
+ return True
25
+
26
+
27
+ def discover_observatory_extensions() -> list[ObservatoryExtensionPlugin]:
28
+ """Discover installed Observatory extension plugins."""
29
+ settings = get_settings()
30
+ if not settings.plugins_enabled:
31
+ logger.info("Plugin system is disabled")
32
+ return []
33
+
34
+ try:
35
+ entry_points = importlib.metadata.entry_points(group=_ENTRY_POINT_GROUP)
36
+ except TypeError:
37
+ entry_points = importlib.metadata.entry_points().get(_ENTRY_POINT_GROUP, [])
38
+
39
+ plugins: list[ObservatoryExtensionPlugin] = []
40
+ for entry_point in entry_points:
41
+ if not _is_plugin_allowed(entry_point.name):
42
+ continue
43
+ try:
44
+ plugin_class = entry_point.load()
45
+ plugin = plugin_class() if isinstance(plugin_class, type) else plugin_class
46
+ except Exception as exc:
47
+ logger.warning("Failed to load Observatory extension %s: %s", entry_point.name, exc)
48
+ continue
49
+ if not isinstance(plugin, ObservatoryExtensionPlugin):
50
+ logger.warning(
51
+ "Observatory extension %s has invalid type %s",
52
+ entry_point.name,
53
+ type(plugin).__name__,
54
+ )
55
+ continue
56
+ plugins.append(plugin)
57
+
58
+ return plugins
59
+
60
+
61
+ def get_observatory_extension(name: str) -> ObservatoryExtensionPlugin | None:
62
+ """Return a single Observatory extension by name."""
63
+ for plugin in discover_observatory_extensions():
64
+ if plugin.metadata.name == name:
65
+ return plugin
66
+ return None
@@ -0,0 +1,72 @@
1
+ """Observatory extension manifest models."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from typing import Any, Literal
6
+
7
+ from pydantic import BaseModel, Field
8
+
9
+
10
+ class ObservatoryExtensionCompatibility(BaseModel):
11
+ """Compatibility requirements for an Observatory extension."""
12
+
13
+ observatory_min: str = Field(..., description="Minimum supported Observatory version")
14
+
15
+
16
+ class ObservatoryExtensionSettings(BaseModel):
17
+ """Settings schema and defaults for an extension."""
18
+
19
+ settings_schema: dict[str, Any] = Field(
20
+ ..., description="Schema for extension settings and validation"
21
+ )
22
+ defaults: dict[str, Any] = Field(default_factory=dict)
23
+ scope: Literal["global", "extension"] = "extension"
24
+
25
+
26
+ class ObservatoryExtensionRoute(BaseModel):
27
+ """Route registration entry for an extension."""
28
+
29
+ path: str
30
+ module: str
31
+ export: str = "registerRoutes"
32
+
33
+
34
+ class ObservatoryExtensionNavItem(BaseModel):
35
+ """Navigation entry for an extension."""
36
+
37
+ title: str
38
+ to: str
39
+
40
+
41
+ class ObservatoryExtensionSlot(BaseModel):
42
+ """Slot registration entry for an extension."""
43
+
44
+ slot_id: str
45
+ module: str
46
+ export: str = "registerSlot"
47
+
48
+
49
+ class ObservatoryExtensionSettingsPanel(BaseModel):
50
+ """Settings panel registration entry for an extension."""
51
+
52
+ module: str
53
+ export: str = "registerSettings"
54
+
55
+
56
+ class ObservatoryExtensionUI(BaseModel):
57
+ """UI contributions for an extension."""
58
+
59
+ routes: list[ObservatoryExtensionRoute] = Field(default_factory=list)
60
+ nav: list[ObservatoryExtensionNavItem] = Field(default_factory=list)
61
+ slots: list[ObservatoryExtensionSlot] = Field(default_factory=list)
62
+ settings: list[ObservatoryExtensionSettingsPanel] = Field(default_factory=list)
63
+
64
+
65
+ class ObservatoryExtensionManifest(BaseModel):
66
+ """Manifest contract for Observatory extensions."""
67
+
68
+ name: str
69
+ version: str
70
+ compat: ObservatoryExtensionCompatibility
71
+ settings: ObservatoryExtensionSettings | None = None
72
+ ui: ObservatoryExtensionUI = Field(default_factory=ObservatoryExtensionUI)