Metadata-Version: 2.4
Name: megaton
Version: 1.0.0
Summary: Utilities for Google Analytics, Google Analytics 4, Google Sheets, Search Console and Google Cloud Platform.
Author: Makoto Shimizu
Author-email: aa.analyst.ga@gmail.com
Classifier: Programming Language :: Python :: 3
Classifier: Operating System :: OS Independent
Classifier: Topic :: Internet
Requires-Python: >=3.11
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: pandas>=1.3
Requires-Dist: google-api-python-client>=2.89
Requires-Dist: google-auth>=2.40.0
Requires-Dist: google-api-core>=2.25.0
Requires-Dist: google-auth-oauthlib>=1.0
Requires-Dist: google-analytics-data>=0.18
Requires-Dist: google-analytics-admin>=0.25.0
Requires-Dist: google-cloud-bigquery>=3.11
Requires-Dist: google-cloud-bigquery-datatransfer>=1.11
Requires-Dist: gspread>=5.7
Requires-Dist: oauthlib>=3.2
Requires-Dist: ipywidgets>=8.0
Requires-Dist: gspread-dataframe>=3.0
Requires-Dist: pytz>=2023.3
Dynamic: author
Dynamic: author-email
Dynamic: classifier
Dynamic: description
Dynamic: description-content-type
Dynamic: license-file
Dynamic: requires-dist
Dynamic: requires-python
Dynamic: summary

# megaton

Megaton は Google Analytics 4、Google Search Console、Google Sheets、BigQuery を **Notebook から短いコードで扱う** ためのツールです。分析の試行錯誤を速く回すことを重視し、Notebook 向けの UX に特化しています。

## コア概念

- **結果オブジェクト**: `SearchResult` / `ReportResult` によるメソッドチェーン
- **シンプルな流れ**: 開く → 期間設定 → 取得 → 保存
- **Notebook 前提**: 途中結果の確認を前提にした設計

## クイックスタート

```python
from megaton.start import Megaton

mg = Megaton("/path/to/service_account.json")
mg.report.set.dates("2024-01-01", "2024-01-31")
mg.report.run(d=["date", "eventName"], m=["eventCount"])

mg.open.sheet("https://docs.google.com/spreadsheets/d/...")
mg.save.to.sheet("_ga_data", mg.report.data)
```

## もう少し実用的な例

```python
# 複数サイトの Search Console データを一括取得して整形
result = (mg.search.run.all(
    sites,
    dimensions=['query', 'page'],
    item_key='clinic',
)
    .categorize('query', by=query_map)
    .categorize('page', by=page_map))

mg.save.to.sheet('_query', result.df, sort_by='impressions')
mg.upsert.to.csv(result.df, filename='query_master', keys=['clinic', 'query', 'page'], include_dates=False)
```

## インストール

```bash
# PyPI 公開版
pip install megaton

# 最新版（GitHub）
pip install git+https://github.com/mak00s/megaton.git
```

## ドキュメント

- 仕様の正は [api-reference.md](docs/api-reference.md) です。
- [api-reference.md](docs/api-reference.md) - API 仕様の単一ソース
- [design.md](docs/design.md) - 設計思想とトレードオフ
- [cookbook.md](docs/cookbook.md) - 実用例集
- [cheatsheet.md](docs/cheatsheet.md) - 1 行リファレンス

## 変更履歴

- [CHANGELOG.md](CHANGELOG.md)
- [docs/changelog-archive.md](docs/changelog-archive.md) - 0.x 系の履歴

## ライセンス

MIT License
