pfetl-analytics-studio 0.1.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,10 @@
1
+ """PFETL Analytics Studio package initialization.
2
+
3
+ Local-first, read-only analytical companion to Personal Finance ETL.
4
+ """
5
+
6
+ from __future__ import annotations
7
+
8
+ __version__ = "0.1.0"
9
+
10
+ __all__ = ["__version__"]
@@ -0,0 +1,10 @@
1
+ """Executable module entrypoint for PFETL Analytics Studio."""
2
+
3
+ from __future__ import annotations
4
+
5
+ import sys
6
+
7
+ from pfetl_analytics_studio.cli import main
8
+
9
+ if __name__ == "__main__":
10
+ sys.exit(main())
@@ -0,0 +1,7 @@
1
+ """Analytics package for PFETL Analytics Studio.
2
+
3
+ Ownership: Typed analytical read services and safe query projections.
4
+ Forbidden: Does not import NiceGUI widgets or mutate warehouse/state data.
5
+ """
6
+
7
+ from __future__ import annotations
@@ -0,0 +1,67 @@
1
+ """NiceGUI application factory and shell layout for PFETL Analytics Studio."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from nicegui import ui
6
+
7
+ from pfetl_analytics_studio import __version__
8
+
9
+
10
+ def create_app() -> None:
11
+ """Register application pages and render bootstrap shell layout.
12
+
13
+ Notes
14
+ -----
15
+ This function registers presentation routes. It does not open databases or
16
+ perform I/O during initialization.
17
+ """
18
+
19
+ @ui.page("/")
20
+ def index_page() -> None:
21
+ """Render primary workspace shell."""
22
+ ui.colors(
23
+ primary="#1976D2",
24
+ secondary="#26A69A",
25
+ accent="#9C27B0",
26
+ dark="#1D1D1D",
27
+ positive="#21BA45",
28
+ negative="#C10015",
29
+ info="#31CCEC",
30
+ warning="#F2C037",
31
+ )
32
+
33
+ with ui.header().classes("items-center justify-between px-6 py-3 bg-slate-900 text-white"):
34
+ with ui.row().classes("items-center gap-3"):
35
+ ui.icon("analytics", size="sm").classes("text-cyan-400")
36
+ ui.label("PFETL Analytics Studio").classes("text-lg font-bold tracking-tight")
37
+ ui.badge(f"v{__version__}").props("outline color=cyan")
38
+
39
+ with ui.row().classes("items-center gap-4 text-sm text-slate-300"):
40
+ with ui.row().classes("items-center gap-1 text-amber-400"):
41
+ ui.icon("folder_off", size="xs")
42
+ ui.label("No PFETL profile selected").classes("font-medium")
43
+
44
+ with ui.column().classes("w-full max-w-5xl mx-auto p-8 gap-6"):
45
+ with ui.card().classes("w-full p-6 border border-slate-200 shadow-sm rounded-lg"):
46
+ with ui.row().classes("items-center gap-3"):
47
+ ui.icon("info", size="md").classes("text-blue-500")
48
+ ui.label("Bootstrap Quality Baseline Active").classes("text-xl font-semibold")
49
+
50
+ ui.markdown(
51
+ """
52
+ Welcome to **PFETL Analytics Studio**.
53
+
54
+ The application shell and quality baseline are successfully initialized.
55
+ In upcoming phases, you will be able to select your PFETL **Settings TOML** and
56
+ **FinancialRules TOML** profiles to explore warehouse facts, inspect data lineage,
57
+ and generate certified reports.
58
+ """
59
+ ).classes("text-slate-600 leading-relaxed")
60
+
61
+ with ui.row().classes("mt-4 gap-3"):
62
+ ui.button("Select Profile", icon="folder_open").props(
63
+ "unelevated color=primary disabled"
64
+ )
65
+ ui.button("View Documentation", icon="menu_book").props(
66
+ "outline color=secondary disabled"
67
+ )
@@ -0,0 +1,113 @@
1
+ """Command-line interface for PFETL Analytics Studio."""
2
+
3
+ from __future__ import annotations
4
+
5
+ import argparse
6
+ import ipaddress
7
+ import os
8
+ import sys
9
+
10
+ from nicegui import ui
11
+
12
+ from pfetl_analytics_studio import __version__
13
+ from pfetl_analytics_studio.app import create_app
14
+
15
+ ALLOWED_LOOPBACKS = {"127.0.0.1", "localhost", "::1"}
16
+
17
+
18
+ def validate_loopback_host(host: str) -> None:
19
+ """Validate that host is bound to local loopback interface.
20
+
21
+ Parameters
22
+ ----------
23
+ host : str
24
+ Host IP address or hostname.
25
+
26
+ Raises
27
+ ------
28
+ ValueError
29
+ If host is not a loopback address and remote binding is not explicitly allowed.
30
+ """
31
+ if os.environ.get("PFETL_STUDIO_DEV_ALLOW_REMOTE", "").lower() in ("1", "true", "yes"):
32
+ return
33
+
34
+ clean_host = host.strip().lower()
35
+ if clean_host in ALLOWED_LOOPBACKS:
36
+ return
37
+
38
+ try:
39
+ ip = ipaddress.ip_address(clean_host)
40
+ if ip.is_loopback:
41
+ return
42
+ except ValueError:
43
+ pass
44
+
45
+ raise ValueError(
46
+ f"Security violation: PFETL Analytics Studio must bind to a loopback address "
47
+ f"(got '{host}'). Set PFETL_STUDIO_DEV_ALLOW_REMOTE=1 only for explicit dev testing."
48
+ )
49
+
50
+
51
+ def main(args: list[str] | None = None) -> int:
52
+ """Launch PFETL Analytics Studio NiceGUI server.
53
+
54
+ Parameters
55
+ ----------
56
+ args : list[str] | None, optional
57
+ Command line arguments, by default None (sys.argv[1:]).
58
+
59
+ Returns
60
+ -------
61
+ int
62
+ Exit return code.
63
+ """
64
+ parser = argparse.ArgumentParser(
65
+ prog="pfetl-studio",
66
+ description="PFETL Analytics Studio — Local-First Analytical Console",
67
+ )
68
+ parser.add_argument(
69
+ "--host",
70
+ default="127.0.0.1",
71
+ help="Host address to bind (must be loopback, default: 127.0.0.1)",
72
+ )
73
+ parser.add_argument(
74
+ "--port",
75
+ type=int,
76
+ default=8080,
77
+ help="Port to listen on (default: 8080)",
78
+ )
79
+ parser.add_argument(
80
+ "--no-browser",
81
+ action="store_true",
82
+ help="Do not automatically open browser on startup",
83
+ )
84
+ parser.add_argument(
85
+ "--reload",
86
+ action="store_true",
87
+ help="Enable auto-reload on code change (development only)",
88
+ )
89
+ parser.add_argument(
90
+ "--version",
91
+ "-v",
92
+ action="version",
93
+ version=f"pfetl-analytics-studio {__version__}",
94
+ )
95
+
96
+ parsed = parser.parse_args(args)
97
+
98
+ try:
99
+ validate_loopback_host(parsed.host)
100
+ except ValueError as exc:
101
+ print(f"Error: {exc}", file=sys.stderr)
102
+ return 1
103
+
104
+ create_app()
105
+
106
+ ui.run( # pyright: ignore[reportUnknownMemberType]
107
+ host=parsed.host,
108
+ port=parsed.port,
109
+ title="PFETL Analytics Studio",
110
+ show=not parsed.no_browser,
111
+ reload=parsed.reload,
112
+ )
113
+ return 0
@@ -0,0 +1,7 @@
1
+ """Data package for PFETL Analytics Studio.
2
+
3
+ Ownership: All external I/O (DuckDB, SQLite Control Plane, archived logs).
4
+ Forbidden: Does not import UI/NiceGUI or execute financial methodologies.
5
+ """
6
+
7
+ from __future__ import annotations
@@ -0,0 +1,7 @@
1
+ """Pages package for PFETL Analytics Studio.
2
+
3
+ Ownership: Thin NiceGUI composition and presentation layouts.
4
+ Forbidden: Does not execute raw SQL, open databases directly, or compute financial formulas.
5
+ """
6
+
7
+ from __future__ import annotations
@@ -0,0 +1,38 @@
1
+ """PFETL Settings and FinancialRules profile management and drift verification.
2
+
3
+ Owns path resolution and run snapshot comparison. Does not execute finance algorithms.
4
+ """
5
+
6
+ from __future__ import annotations
7
+
8
+ from enum import StrEnum
9
+ from pathlib import Path
10
+
11
+ from pydantic import BaseModel, Field
12
+
13
+
14
+ class ProfileDriftStatus(StrEnum):
15
+ """Drift check comparison status."""
16
+
17
+ MATCH = "MATCH"
18
+ DRIFTED = "DRIFTED"
19
+ UNVERIFIED_DEFAULTS = "UNVERIFIED DEFAULTS"
20
+
21
+
22
+ class ProfilePaths(BaseModel):
23
+ """Resolved warehouse paths from Settings TOML."""
24
+
25
+ target_db_base_path: Path
26
+ warehouse_db_path: Path
27
+ raw_document_store_path: Path
28
+ logs_directory: Path | None = None
29
+
30
+
31
+ class ProfileContext(BaseModel):
32
+ """Active profile context and metadata."""
33
+
34
+ settings_path: Path
35
+ rules_path: Path
36
+ paths: ProfilePaths
37
+ drift_status: ProfileDriftStatus = ProfileDriftStatus.MATCH
38
+ drift_details: list[str] = Field(default_factory=list)
@@ -0,0 +1,7 @@
1
+ """Reports package for PFETL Analytics Studio.
2
+
3
+ Ownership: Report definitions, rendering engines, and PDF/Excel deterministic export.
4
+ Forbidden: Does not bypass analytics layer or recompute financial truth.
5
+ """
6
+
7
+ from __future__ import annotations
@@ -0,0 +1,7 @@
1
+ """Semantic package for PFETL Analytics Studio.
2
+
3
+ Ownership: Presentation metadata for periods, filters, metrics, and dataset schemas.
4
+ Forbidden: Does not compute financial methodology or open external databases.
5
+ """
6
+
7
+ from __future__ import annotations
@@ -0,0 +1,24 @@
1
+ """Studio-owned SQLite persistence manager.
2
+
3
+ Persists saved views, report definitions, recent profiles, and export history.
4
+ Never writes to PFETL DuckDB or Control Plane databases.
5
+ """
6
+
7
+ from __future__ import annotations
8
+
9
+ from pathlib import Path
10
+
11
+ from platformdirs import user_data_dir
12
+
13
+
14
+ def get_studio_state_path() -> Path:
15
+ """Resolve destination path for Studio state database.
16
+
17
+ Returns
18
+ -------
19
+ Path
20
+ Path to studio.sqlite in user data directory.
21
+ """
22
+ data_dir = Path(user_data_dir("PFETL Analytics Studio"))
23
+ data_dir.mkdir(parents=True, exist_ok=True)
24
+ return data_dir / "studio.sqlite"
@@ -0,0 +1,7 @@
1
+ """UI package for PFETL Analytics Studio.
2
+
3
+ Ownership: Reusable presentational components, styling, themes, and formatters.
4
+ Forbidden: Does not import analytics or data layers directly.
5
+ """
6
+
7
+ from __future__ import annotations
@@ -0,0 +1,97 @@
1
+ Metadata-Version: 2.5
2
+ Name: pfetl-analytics-studio
3
+ Version: 0.1.0
4
+ Summary: Local-first, read-only analytical companion to Personal Finance ETL for visual exploration, reporting, and intelligence.
5
+ Project-URL: Homepage, https://github.com/tks18/pfetl-analytics-studio
6
+ Project-URL: Repository, https://github.com/tks18/pfetl-analytics-studio
7
+ Project-URL: Issues, https://github.com/tks18/pfetl-analytics-studio/issues
8
+ Author-email: Shan <tksudharshan@gmail.com>
9
+ License-Expression: GPL-3.0-or-later
10
+ License-File: LICENSE
11
+ Requires-Python: >=3.13
12
+ Requires-Dist: duckdb<2.0.0,>=1.5.5
13
+ Requires-Dist: kaleido<2.0.0,>=1.5.0
14
+ Requires-Dist: nicegui<5.0.0,>=4.0.0
15
+ Requires-Dist: platformdirs>=4.0.0
16
+ Requires-Dist: plotly<8.0.0,>=7.1.0
17
+ Requires-Dist: polars<3.0.0,>=2.1.0
18
+ Requires-Dist: pydantic<3.0.0,>=2.14.0
19
+ Requires-Dist: reportlab<6.0.0,>=5.1.0
20
+ Requires-Dist: xlsxwriter<4.0.0,>=3.3.0
21
+ Description-Content-Type: text/markdown
22
+
23
+ # PFETL Analytics Studio
24
+
25
+ Local-first, read-only analytical companion to Personal Finance ETL (PFETL) for visual exploration, reporting, and operational intelligence.
26
+
27
+ ---
28
+
29
+ ## 1. Product Mission & Invariants
30
+
31
+ PFETL Core calculates financial truth; Analytics Studio turns that truth into interactive exploration, visual drill-downs, operational intelligence, and downloadable reports.
32
+
33
+ ### Hard Boundary
34
+ - **Read-Only**: Studio **never** writes to PFETL DuckDB, Control Plane SQLite, Settings TOML, or FinancialRules TOML.
35
+ - **Zero Reimplementation**: Studio never reimplements FIFO, tax classification, reconciliation, XIRR, or Monte Carlo methodology.
36
+ - **Local Loopback**: Studio binds to `127.0.0.1` by default and rejects non-loopback hosts.
37
+ - **No Direct Vendor Coupling**: Studio queries warehouse tables via DuckDB SQL and SQLite URIs (`mode=ro`).
38
+
39
+ ---
40
+
41
+ ## 2. Quickstart
42
+
43
+ ### Prerequisites
44
+ - Python >=3.13
45
+ - [uv](https://docs.astral.sh/uv/) package manager
46
+
47
+ ### Launch Application
48
+ ```bash
49
+ # Start Analytics Studio on localhost:8080
50
+ uv run pfetl-studio
51
+
52
+ # Start in development mode without opening a browser
53
+ uv run poe dev
54
+ ```
55
+
56
+ ---
57
+
58
+ ## 3. Engineering Workflows & Quality Gate
59
+
60
+ Orchestrated using **Project Forge** (`pforge`):
61
+
62
+ ```bash
63
+ # Run Fast Quality Gate (< 2s: Ruff Lint, Format, Mypy)
64
+ uv run poe audit-fast
65
+
66
+ # Run Full Quality Gate (Ruff, Mypy, Pyright, Pytest)
67
+ uv run poe audit-full
68
+
69
+ # Automated Conventional Commits
70
+ uv run poe commit:preview
71
+ uv run poe commit:run
72
+
73
+ # GitHub PR and Release Automation
74
+ uv run poe pr:create
75
+ uv run poe release:pipeline
76
+ ```
77
+
78
+ ---
79
+
80
+ ## 4. Architecture Overview
81
+
82
+ ```text
83
+ src/pfetl_analytics_studio/
84
+ ├── __init__.py # Package version & metadata
85
+ ├── __main__.py # Module executable
86
+ ├── cli.py # Command-line entrypoint (pfetl-studio)
87
+ ├── app.py # NiceGUI application factory
88
+ ├── profile.py # Settings/Rules resolution & drift check
89
+ ├── state.py # Studio-owned SQLite state persistence
90
+ ├── data/ # DuckDB, Control Plane & Log I/O
91
+ ├── semantic/ # Periods, filters, metrics, datasets metadata
92
+ ├── analytics/ # Typed analytical read services
93
+ ├── pages/ # NiceGUI presentation pages
94
+ ├── reports/ # PDF & Excel report generators
95
+ └── ui/ # Reusable UI components & formatting
96
+ ```
97
+
@@ -0,0 +1,17 @@
1
+ pfetl_analytics_studio/__init__.py,sha256=a-oqMr1jmNrfvPuyWH2WQxgQE7cCrDwRHvaQUlHiluU,210
2
+ pfetl_analytics_studio/__main__.py,sha256=63fVjBxieT5Dbvc2j7V1gPDCEZFegjrflIi6P4sC9iw,205
3
+ pfetl_analytics_studio/app.py,sha256=SqiQQKuVm-pOGPjQ9i4QhfTnfy3PYkKzrdKIxXB10Ic,2804
4
+ pfetl_analytics_studio/cli.py,sha256=Rqe-eliKyah29m5-N84g3ZRW6ekSXWSCr8a_QbNPJso,2836
5
+ pfetl_analytics_studio/profile.py,sha256=zSYl0JFeGH1xalz3vOnwCvcuTqVOrK2CSvaHs9xfcnk,964
6
+ pfetl_analytics_studio/state.py,sha256=EKourznPFNaAZMlon_ZNwlg5ePy5je4F5aU6dD6-eLM,628
7
+ pfetl_analytics_studio/analytics/__init__.py,sha256=TH1sZQSdpUZnBvwV-pAVU63cEPKMXlRHoXcKPCopjWY,235
8
+ pfetl_analytics_studio/data/__init__.py,sha256=ThBTvN2M5eJ1W8juKcpxU3kNbFMCD4kiuFb0ot3IQr4,234
9
+ pfetl_analytics_studio/pages/__init__.py,sha256=O-euCEhiBhoKvRUoENwjkbQ2hSIHKqeArguDCat0zwc,241
10
+ pfetl_analytics_studio/reports/__init__.py,sha256=n8o3A9dIDNsqbegTY3wCEftgig9Rbc3-RT7EmY3Shl8,247
11
+ pfetl_analytics_studio/semantic/__init__.py,sha256=on6_kP9-ESqK5-tURkKxFULlwDd7OMraSzdxWNJ6okw,252
12
+ pfetl_analytics_studio/ui/__init__.py,sha256=MMnheSfCu4-3Z9VNdscW0l4NYO6VWVyubDCTqXyeox8,225
13
+ pfetl_analytics_studio-0.1.0.dist-info/METADATA,sha256=n7Lkw0uJDweAmwecZuyDT0exvH0p_XIH9Z9JaZlw19c,3361
14
+ pfetl_analytics_studio-0.1.0.dist-info/WHEEL,sha256=2iZrJkDIkeDh0k9SikKMqFuRP-ua6mb4Ir1AsER4BEw,87
15
+ pfetl_analytics_studio-0.1.0.dist-info/entry_points.txt,sha256=v43LVof9vFIS5V3Fg6oREUHHraF4jRBvhTSo5WtnChA,65
16
+ pfetl_analytics_studio-0.1.0.dist-info/licenses/LICENSE,sha256=2A1OGOYe5dYCFhNpQfw7mW2AyuY9hFF1jPuZ99zclto,978
17
+ pfetl_analytics_studio-0.1.0.dist-info/RECORD,,
@@ -0,0 +1,4 @@
1
+ Wheel-Version: 1.0
2
+ Generator: hatchling 1.33.0
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ pfetl-studio = pfetl_analytics_studio.cli:main
@@ -0,0 +1,22 @@
1
+ GNU GENERAL PUBLIC LICENSE
2
+ Version 3, 29 June 2007
3
+
4
+ Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
5
+ Everyone is permitted to copy and distribute verbatim copies
6
+ of this license document, but changing it is not allowed.
7
+
8
+ Preamble
9
+
10
+ The GNU General Public License is a free, copyleft license for
11
+ software and other kinds of works.
12
+
13
+ The licenses for most software and other practical works are designed
14
+ to take away your freedom to share and change the works. By contrast,
15
+ the GNU General Public License is intended to guarantee your freedom to
16
+ share and change all versions of a program--to make sure it remains free
17
+ software for all its users. We, the Free Software Foundation, use the
18
+ GNU General Public License for most of our software; it applies also to
19
+ any other work released this way by its authors. You can apply it to
20
+ your programs, too.
21
+
22
+ [Full GPL-3.0 License Text]