Skip to content

Commit d995960

Browse files
authored
Rename files and library to gitmetrics (#25)
1 parent 9ec61ab commit d995960

30 files changed

+110
-121
lines changed

.github/workflows/daily_collection.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@ jobs:
2525
run: |
2626
uv pip install -U pip
2727
uv pip install .
28-
- name: Collect Github Data
28+
- name: Collect GitHub Data
2929
run: |
30-
uv run github-analytics collect -v -q -t ${{ secrets.GITHUB_TOKEN }} -m -c daily.yaml
30+
uv run gitmetrics collect -v -q -t ${{ secrets.GITHUB_TOKEN }} -m -c daily.yaml
3131
env:
3232
PYDRIVE_CREDENTIALS: ${{ secrets.PYDRIVE_CREDENTIALS }}
3333

@@ -47,6 +47,6 @@ jobs:
4747
uv pip install -U pip
4848
uv pip install .[dev]
4949
- name: Slack alert if failure
50-
run: python -m github_analytics.slack_utils -r ${{ github.run_id }} -c ${{ github.event.inputs.slack_channel || 'sdv-alerts' }}
50+
run: python -m gitmetrics.slack_utils -r ${{ github.run_id }} -c ${{ github.event.inputs.slack_channel || 'sdv-alerts' }}
5151
env:
5252
SLACK_TOKEN: ${{ secrets.SLACK_TOKEN }}

.github/workflows/daily_summarize.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ jobs:
2828
uv pip install .
2929
- name: Run Summarize
3030
run: |
31-
uv run github-analytics summarize \
31+
uv run gitmetrics summarize \
3232
--input-folder gdrive://1ZvsuVbFAUk3BN-n6Pv_lUBLwviHZSxM2
3333
env:
3434
PYDRIVE_CREDENTIALS: ${{ secrets.PYDRIVE_CREDENTIALS }}
@@ -66,9 +66,9 @@ jobs:
6666
uv pip install .[dev]
6767
- name: Slack alert if failure
6868
run: |
69-
uv run python -m github_analytics.slack_utils \
69+
uv run python -m gitmetrics.slack_utils \
7070
-r ${{ github.run_id }} \
7171
-c ${{ github.event.inputs.slack_channel || 'sdv-alerts' }} \
72-
-m 'Summarize GitHub Analytics build failed :fire: :dumpster-fire: :fire:'
72+
-m 'Summarize GitMetrics build failed :fire: :dumpster-fire: :fire:'
7373
env:
7474
SLACK_TOKEN: ${{ secrets.SLACK_TOKEN }}

.github/workflows/manual.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,9 @@ jobs:
3333
run: |
3434
python -m pip install --upgrade pip
3535
python -m pip install .
36-
- name: Collect Github Data
36+
- name: Collect GitHub Data
3737
run: |
38-
github-analytics collect -v -q \
38+
gitmetrics collect -v -q \
3939
-t ${{ secrets.GITHUB_TOKEN }} \
4040
-p ${{ github.event.inputs.project }} \
4141
-r ${{ github.event.inputs.repositories }} \

.github/workflows/traffic_collection.yaml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ on:
1212
- cron: "0 0 */14 * *" # Runs every 14 days at midnight UTC
1313

1414
jobs:
15-
collect_traffic:
15+
daily_traffic_collection:
1616
runs-on: ubuntu-latest
1717
steps:
1818
- uses: actions/checkout@v4
@@ -25,13 +25,13 @@ jobs:
2525
run: |
2626
uv pip install -U pip
2727
uv pip install .
28-
- name: Collect Github Traffic Data
28+
- name: Collect GitHub Traffic Data
2929
run: |
30-
uv run github-analytics traffic -v -t ${{ secrets.GH_TRAFFIC_TOKEN }} -c traffic_config.yaml
30+
uv run gitmetrics traffic -v -t ${{ secrets.GH_TRAFFIC_TOKEN }} -c traffic_config.yaml
3131
env:
3232
PYDRIVE_CREDENTIALS: ${{ secrets.PYDRIVE_CREDENTIALS }}
3333
alert:
34-
needs: [daily_github_collection]
34+
needs: [daily_traffic_collection]
3535
runs-on: ubuntu-latest
3636
if: failure()
3737
steps:
@@ -46,6 +46,6 @@ jobs:
4646
uv pip install -U pip
4747
uv pip install .[dev]
4848
- name: Slack alert if failure
49-
run: python -m github_analytics.slack_utils -r ${{ github.run_id }} -c ${{ github.event.inputs.slack_channel || 'sdv-alerts' }}
49+
run: python -m gitmetrics.slack_utils -r ${{ github.run_id }} -c ${{ github.event.inputs.slack_channel || 'sdv-alerts' }}
5050
env:
5151
SLACK_TOKEN: ${{ secrets.SLACK_TOKEN }}

.github/workflows/weekly_collection.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,12 @@ jobs:
2727
uv pip install .
2828
- name: Collect GitHub Data
2929
run: |
30-
uv run github-analytics collect -v -q -t ${{ secrets.GITHUB_TOKEN }} -m -c weekly.yaml
30+
uv run gitmetrics collect -v -q -t ${{ secrets.GITHUB_TOKEN }} -m -c weekly.yaml
3131
env:
3232
PYDRIVE_CREDENTIALS: ${{ secrets.PYDRIVE_CREDENTIALS }}
3333
- name: Consolidate GitHub Data
3434
run: |
35-
uv run github-analytics consolidate -v -c weekly.yaml
35+
uv run gitmetrics consolidate -v -c weekly.yaml
3636
env:
3737
PYDRIVE_CREDENTIALS: ${{ secrets.PYDRIVE_CREDENTIALS }}
3838
alert:
@@ -51,6 +51,6 @@ jobs:
5151
uv pip install -U pip
5252
uv pip install .[dev]
5353
- name: Slack alert if failure
54-
run: python -m github_analytics.slack_utils -r ${{ github.run_id }} -c ${{ github.event.inputs.slack_channel || 'sdv-alerts' }}
54+
run: python -m gitmetrics.slack_utils -r ${{ github.run_id }} -c ${{ github.event.inputs.slack_channel || 'sdv-alerts' }}
5555
env:
5656
SLACK_TOKEN: ${{ secrets.SLACK_TOKEN }}

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ bigquery_creds.json
33
client_secrets.json
44
credentials.json
55
sdv-dev.github.io/*
6+
uv.lock
67

78
notebooks
89
*.xlsx

CONFIGURATION.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
# Github Analytics Configuration
1+
# GitMetrics Configuration
22

3-
The Github Analytics script can be configured using a YAML file that indicates which repositories
3+
The GitMetrics script can be configured using a YAML file that indicates which repositories
44
to collect and where to store the collected data.
55

6-
Additionally, [Github Actions Workflows](.github/workflows) are being used to trigger the
6+
Additionally, [GitMetrics Workflows](.github/workflows) are being used to trigger the
77
collection of such projects either manually or on a scheduled basis.
88

99
## Configuration file format
1010

11-
The configuration file for `github-analytics` must have the following contents:
11+
The configuration file for `gitmetrics` must have the following contents:
1212

1313
* `output_folder`: Folder where results will be written. Can be a Google Drive in the format
1414
gdrive://<folder-name>
@@ -48,7 +48,7 @@ projects:
4848
### Adding an entire organization
4949
5050
Optionally, an organization or user name can be added to the confiuration instead of the
51-
individual repositories, and then `github-analytics` will translate that into the list of
51+
individual repositories, and then `gitmetrics` will translate that into the list of
5252
repositories owned by that user or organization *which are not forks of other repositories*.
5353

5454
For example, this configuration file would include all the repositories listed above,
@@ -78,12 +78,12 @@ projects:
7878

7979
## Default Configuration File
8080

81-
By default, Github Analytics collects the projects configured in the [config.yaml](config.yaml)
81+
By default, GitMetrics collects the projects configured in the [config.yaml](config.yaml)
8282
file included in the project. However, passing a different configuration file when running the
8383
command line script is possible via the `-c` flag, as shown in the example above:
8484

8585
```bash
86-
$ github-analytics collect -c my_config_file.yaml ...
86+
$ gitmetrics collect -c my_config_file.yaml ...
8787
```
8888

8989
### Importing other configuration files
@@ -142,11 +142,11 @@ projects:
142142

143143
## Daily and Weekly Collection
144144

145-
Github Analytics is configured to collect data daily and weekly via the
145+
GitMetrics is configured to collect data daily and weekly via the
146146
[.github/workflow/daily.yaml](.github/workflow/daily.yaml) and [.github/workflow/weekly.yaml](
147-
.github/workflow/weekly.yaml) Github Action Workflows.
147+
.github/workflow/weekly.yaml) GitHub Action Workflows.
148148

149-
These workflows are configured to execute the `github-analytics collect` command using the
149+
These workflows are configured to execute the `gitmetrics collect` command using the
150150
[daily.yaml](daily.yaml) and [weekly.yaml](weekly.yaml) configuration files respectively,
151151
which:
152152
- Import the [config.yaml](config.yaml) file, where all the project repositories are listed

MANIFEST.in

Lines changed: 0 additions & 12 deletions
This file was deleted.

README.md

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,30 @@
1-
# Github Analytics
1+
# GitMetrics
22

3-
Scripts to extract multiple metrics from Github Projects.
3+
Scripts to extract multiple metrics from GitHub Projects.
44

55
## Install
66

77
```bash
8-
pip install git+ssh://git@github.com/datacebo/github-analytics
8+
pip install git+ssh://git@github.com/datacebo/gitmetrics
99
```
1010

1111
### Development
1212

1313
For development, clone the repository and install `dev-requirements.txt`:
1414

1515
```bash
16-
git clone git@github.com:datacebo/github-analytics
17-
cd github-analytics
18-
pip install -r dev-requirements.txt
16+
git clone git@github.com:datacebo/gitmetrics
17+
cd gitmetrics
18+
pip install -e .[test,dev]
1919
```
2020

2121
# Local Usage
2222

23-
To collect metrics from github by running `github-analytics` on your computer you need to provide:
23+
To collect metrics from GitHub by running `gitmetrics` on your computer you need to provide:
2424

25-
1. A Github Token. Documentation about how to create a Personal Access Token can be found
25+
1. A GitHub Token. Documentation about how to create a Personal Access Token can be found
2626
[here](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token)
27-
2. A list of Github Repositories for which to collect the metrics. The repositories need
27+
2. A list of GitHub Repositories for which to collect the metrics. The repositories need
2828
to be given as `{org-name}/{repo-name}`, like `sdv-dev/SDV`.
2929
3. (Optional) A filename where the output will be stored. If a name containing the `.xlsx`
3030
extension is given (like `path/to/my-filename.xlsx`), it will be used as provided.
@@ -36,44 +36,44 @@ To collect metrics from github by running `github-analytics` on your computer yo
3636
## Python Interface
3737

3838
In order to run the collection script from python, the `collect_project_metrics` function
39-
needs to be imported from the `github_analytics` package and executed passing the values
39+
needs to be imported from the `gitmetrics` package and executed passing the values
4040
indicated above.
4141

4242
**NOTE**: For detailed output, logging must be enabled as shown in the example below.
4343

4444
```python3
4545
>>> import logging
4646
>>> logging.basicConfig(level=logging.INFO)
47-
>>> from github_analytics import collect_project_metrics
47+
>>> from gitmetrics import collect_project_metrics
4848
>>> repositories = ['sdv-dev/RDT', 'sdv-dev/SDV', 'sdv-dev/Copulas', 'sdv-dev/CTGAN']
4949
>>> output_name = 'sdv-dev'
5050
>>> token = '<my-github-token>'
5151
>>> collect_project_metrics(token, repositories, output_name)
52-
INFO:github_analytics.main:Getting information for repository sdv-dev/RDT
52+
INFO:gitmetrics.main:Getting information for repository sdv-dev/RDT
5353
100%|███████████████████████████████████████████████████████████████| 143/143 [00:00<00:00, 195.00it/s]
5454
100%|███████████████████████████████████████████████████████████████| 182/182 [00:00<00:00, 364.64it/s]
5555
100%|███████████████████████████████████████████████████████████████| 37/37 [00:00<00:00, 91020.09it/s]
56-
INFO:github_analytics.main:Getting information for repository sdv-dev/SDV
56+
INFO:gitmetrics.main:Getting information for repository sdv-dev/SDV
5757
100%|███████████████████████████████████████████████████████████████| 389/389 [00:02<00:00, 193.20it/s]
5858
100%|███████████████████████████████████████████████████████████████| 219/219 [00:00<00:00, 231.17it/s]
5959
100%|███████████████████████████████████████████████████████████████| 561/561 [00:03<00:00, 158.39it/s]
60-
INFO:github_analytics.main:Getting information for repository sdv-dev/Copulas
60+
INFO:gitmetrics.main:Getting information for repository sdv-dev/Copulas
6161
100%|███████████████████████████████████████████████████████████████| 138/138 [00:00<00:00, 333.27it/s]
6262
100%|███████████████████████████████████████████████████████████████| 143/143 [00:00<00:00, 287.29it/s]
6363
100%|███████████████████████████████████████████████████████████████| 245/245 [00:01<00:00, 204.88it/s]
64-
INFO:github_analytics.main:Getting information for repository sdv-dev/CTGAN
64+
INFO:gitmetrics.main:Getting information for repository sdv-dev/CTGAN
6565
100%|███████████████████████████████████████████████████████████████| 113/113 [00:00<00:00, 287.26it/s]
6666
100%|██████████████████████████████████████████████████████████████| 64/64 [00:00<00:00, 134824.44it/s]
6767
100%|███████████████████████████████████████████████████████████████| 498/498 [00:02<00:00, 171.11it/s]
68-
INFO:github_analytics.main:Getting 164 missing users
68+
INFO:gitmetrics.main:Getting 164 missing users
6969
99%|██████████████████████████████████████████████████████████████▌| 163/164 [00:01<00:00, 121.99it/s]
70-
INFO:github_analytics.output:Creating file github-metrics-sdv-dev-2021-11-12.xlsx
70+
INFO:gitmetrics.output:Creating file github-metrics-sdv-dev-2021-11-12.xlsx
7171
```
7272

7373

7474
## Command Line Interface
7575

76-
In order to run the collection script from the command line, the `github-analytics collect` command
76+
In order to run the collection script from the command line, the `gitmetrics collect` command
7777
must be called passing the following optional arguments:
7878

7979
- `-c / --config-file CONFIG_FILE`: Path to the config file to use. Defaults to `config.yaml`.
@@ -91,13 +91,13 @@ must be called passing the following optional arguments:
9191
spreadsheet.
9292
- `-n / --not-incremental`: If indicated, collect data from scratch instead of doing it
9393
incrementally over the existing data.
94-
- `-t / --token`: Github token to use. If not given, it will be requested in a prompt.
94+
- `-t / --token`: GitHub token to use. If not given, it will be requested in a prompt.
9595
- `-l / --logfile LOGFILE`: Write logs to the indicated logfile.
9696
- `-v / --verbose`: Be more verbose.
9797

9898
```bash
99-
$ github-analytics github -p sdv-dev -c config.yaml
100-
Please input your Github Token: <my-github-token>
99+
$ gitmetrics github -p sdv-dev -c config.yaml
100+
Please input your GitHub Token: <my-github-token>
101101
2021-11-12 15:42:43,100 - INFO - Getting information for repository sdv-dev/RDT
102102
100%|███████████████████████████████████████████████████████████████| 143/143 [00:00<00:00, 300.87it/s]
103103
100%|███████████████████████████████████████████████████████████████| 182/182 [00:00<00:00, 324.25it/s]
@@ -144,7 +144,7 @@ aggregation metrics for the entire project.
144144

145145
## Google Drive Integration
146146

147-
Github Analytics is capable of reading and writing results in Google Spreadsheets.
147+
GitMetrics is capable of reading and writing results in Google Spreadsheets.
148148

149149
For this to work, the following things are required:
150150

@@ -156,11 +156,11 @@ For this to work, the following things are required:
156156
the corresponding `settings.yaml` file, or passed via the `PYDRIVE_CREDENTIALS` environment
157157
variable.
158158

159-
# Github Analytics Configuration
159+
# GitMetrics Configuration
160160

161-
The Github Analytics script can be configured using a YAML file that indicates which repositories
161+
The GitMetrics script can be configured using a YAML file that indicates which repositories
162162
to collect and where to store the collected data, as well as when to execute the collection
163-
of data using Github Actions.
163+
of data using GitHub Actions.
164164

165165
For more details about how to configure this, check the [CONFIGURATION.md](CONFIGURATION.md)
166166
document.

github_analytics/__init__.py

Lines changed: 0 additions & 5 deletions
This file was deleted.

0 commit comments

Comments
 (0)