Skip to content

Commit 7ae7eca

Browse files
committed
added analytics
1 parent 7741ba1 commit 7ae7eca

File tree

4 files changed

+32
-1
lines changed

4 files changed

+32
-1
lines changed

.github/workflows/analytics.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
- uses: actions/setup-python@v4
1313
with:
1414
python-version: '3.10'
15-
- run: python -m pip install -r analytics/requirements.txt
15+
- run: python -m pip install -r .github/workflows/analytics/requirements.txt
1616
- env:
1717
GH_SECRET: ${{ secrets.GITHUB_TOKEN }}
1818
run: python .github/workflows/analytics/cron.py
File renamed without changes.
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
google-cloud-bigquery
2+
requests
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
from __future__ import annotations
2+
3+
from dataclasses import asdict, dataclass, field
4+
5+
6+
@dataclass
7+
class BaseEvent:
8+
event_type: str = field(init=False)
9+
10+
def to_dict(self):
11+
return asdict(self)
12+
13+
@dataclass
14+
class CronEvent(BaseEvent):
15+
num_discord_members_total: int
16+
num_github_stars_total: int
17+
18+
# count for each day
19+
num_python_downloads: int
20+
num_discord_members: int
21+
num_github_stars: int
22+
num_github_repo_views: int
23+
num_documentation_views: int = 0
24+
25+
def __post_init__(self):
26+
self.event_type = "cron"
27+
28+
def to_dict(self):
29+
return asdict(self)

0 commit comments

Comments
 (0)