Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,3 +54,33 @@ updates:
- github-actions
commit-message:
prefix: "chore(ci)"

- package-ecosystem: pip
directory: /packages/data-analytics-demo
schedule:
interval: weekly
day: monday
time: "09:00"
timezone: Asia/Tokyo
open-pull-requests-limit: 5
groups:
dbt:
patterns:
- "dbt-*"
ml:
patterns:
- "scikit-learn"
- "xgboost"
- "shap"
- "pandas"
- "numpy"
duckdb:
patterns:
- "duckdb"
dev:
dependency-type: "development"
labels:
- dependencies
- python
commit-message:
prefix: "chore(deps)"
40 changes: 40 additions & 0 deletions .github/workflows/python-audit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: python audit (data-analytics-demo)

on:
push:
branches: [main, master]
paths:
- "packages/data-analytics-demo/pyproject.toml"
- ".github/workflows/python-audit.yml"
pull_request:
branches: [main, master]
paths:
- "packages/data-analytics-demo/pyproject.toml"
- ".github/workflows/python-audit.yml"
schedule:
- cron: "0 0 * * 0"
workflow_dispatch:

jobs:
audit:
runs-on: ubuntu-latest
permissions:
contents: read
defaults:
run:
working-directory: packages/data-analytics-demo
steps:
- uses: actions/checkout@v4

- uses: actions/setup-python@v5
with:
python-version: "3.11"

- name: install pip-audit + package deps
run: |
python -m pip install --upgrade pip
pip install pip-audit
pip install -e .

- name: pip-audit (fail on HIGH or CRITICAL)
run: pip-audit --strict --vulnerability-service osv
43 changes: 43 additions & 0 deletions .github/workflows/python-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: python test (data-analytics-demo)

on:
push:
branches: [main, master]
paths:
- "packages/data-analytics-demo/**"
- ".github/workflows/python-test.yml"
pull_request:
branches: [main, master]
paths:
- "packages/data-analytics-demo/**"
- ".github/workflows/python-test.yml"
workflow_dispatch:

jobs:
test:
runs-on: ubuntu-latest
permissions:
contents: read
defaults:
run:
working-directory: packages/data-analytics-demo
steps:
- uses: actions/checkout@v4

- uses: actions/setup-python@v5
with:
python-version: "3.11"

- name: install package + dev extras
run: |
python -m pip install --upgrade pip
pip install -e ".[dev]"

- name: ruff (lint)
run: ruff check src tests

- name: mypy (strict type-check)
run: mypy -p data_analytics_demo

- name: pytest (coverage ≥ 80%)
run: pytest
7 changes: 3 additions & 4 deletions packages/data-analytics-demo/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,9 @@ help:
install:
$(PIP) install -e ".[dev]"

# Stage targets — placeholders until T-03 .. T-10 are implemented
# Stage targets
data:
@echo "[data] TODO T-03: synthetic data generation not yet implemented"
@exit 1
$(PYTHON) -m data_analytics_demo.data.generate

dbt:
@echo "[dbt] TODO T-04/T-05: dbt models not yet implemented"
Expand Down Expand Up @@ -53,7 +52,7 @@ test:

lint:
$(PYTHON) -m ruff check src tests
$(PYTHON) -m mypy src
$(PYTHON) -m mypy -p data_analytics_demo

clean:
rm -rf warehouse/*.duckdb ml/artifacts/* dashboard/build narrative/output.md
Expand Down
11 changes: 11 additions & 0 deletions packages/data-analytics-demo/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ build-backend = "setuptools.build_meta"
[tool.setuptools.packages.find]
where = ["src"]

[tool.setuptools.package-data]
data_analytics_demo = ["py.typed"]

[tool.ruff]
line-length = 120
target-version = "py311"
Expand All @@ -65,6 +68,14 @@ strict = true
python_version = "3.11"
namespace_packages = true
explicit_package_bases = true
mypy_path = "src"

# Third-party libraries without published type stubs. `pandas-stubs` exists
# but lags behind `pandas` releases; treating these as untyped is the
# pragmatic choice for a Python 3.11 + pandas 3.x stack.
[[tool.mypy.overrides]]
module = ["pandas", "pandas.*", "duckdb", "faker", "shap", "xgboost", "sklearn.*"]
ignore_missing_imports = true

[tool.pytest.ini_options]
testpaths = ["tests"]
Expand Down
8 changes: 5 additions & 3 deletions packages/data-analytics-demo/src/data_analytics_demo/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,11 @@ def version() -> None:

@app.command()
def data() -> None:
"""Generate synthetic SaaS data (T-03, not yet implemented)."""
typer.echo("[data] TODO T-03: synthetic data generation not yet implemented", err=True)
sys.exit(1)
"""Generate synthetic SaaS data into warehouse/analytics.duckdb."""
from data_analytics_demo.data import generate as gen

out = gen.main()
typer.echo(f"wrote {out}")


@app.command()
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
"""Synthetic SaaS data generation for the customer-analytics demo.

Public surface:
generate.main() Run the full synthesis and persist to DuckDB.
schemas.{Customer, Event, Subscription, Invoice} Pydantic models.
"""
Loading
Loading