Skip to content

Commit 3e9c961

Browse files
committed
add readme usage example
1 parent d406c3a commit 3e9c961

File tree

1 file changed

+53
-0
lines changed

1 file changed

+53
-0
lines changed

README.md

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,55 @@
11
# write-githubstat
22
write-githubstat makes it easy to collect, filter and save github statistics to csv files.
3+
4+
[![PyPI version](https://badge.fury.io/py/write-condastat.svg)](https://badge.fury.io/py/write-githubstat)
5+
6+
7+
# About The Project
8+
9+
write-githubstat makes it easy to collect, filter and save github statistics to csv files.
10+
11+
# Installation
12+
13+
write-githubstat requires `pandas` package.
14+
15+
```sh
16+
pip install write-githubstat
17+
```
18+
19+
# Usage
20+
21+
```python
22+
import logging
23+
from pathlib import Path
24+
25+
from githubstat import WriteGithubStat, GithubAuth, Referrers, Paths, StarsForks, ViewsClones
26+
27+
28+
logging.basicConfig(level=logging.INFO)
29+
30+
owner = "owner"
31+
repo = "repo"
32+
token = "token"
33+
34+
auth = GithubAuth(owner, repo, token)
35+
write_githubstat = WriteGithubStat(auth)
36+
for stat_type in (
37+
Referrers(owner, repo),
38+
Paths(owner, repo),
39+
StarsForks(owner, repo),
40+
ViewsClones(owner, repo, write_githubstat.date),
41+
):
42+
year = write_githubstat.date[0:4]
43+
outdir = "stats"
44+
outfile = (
45+
f"{year}_githubstat_{stat_type.__class__.__name__.lower()}.csv"
46+
)
47+
csv = Path(outdir) / outfile
48+
write_githubstat.write_stat(stat_type, csv)
49+
```
50+
51+
# License
52+
53+
Copyright © 2023.
54+
55+
Released under the [Apache 2.0 License](https://github.com/veghdev/write-condastat/blob/main/LICENSE).

0 commit comments

Comments
 (0)