Skip to content

Commit 742d8f1

Browse files
committed
chore: cleanup PR for review
- Remove brand book file (reference material, not needed in repo) - Update README with new CLI commands and workflow documentation - Add inline documentation explaining DevSeed modifications - Remove commented-out code from index.js - Add docstrings to config.py
1 parent 314b754 commit 742d8f1

File tree

4 files changed

+131
-25
lines changed

4 files changed

+131
-25
lines changed

DS-BrandBook_v003-2024.docx

-25.3 KB
Binary file not shown.

README.md

Lines changed: 104 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,134 @@
1-
# Development Seed contributor network
1+
# Development Seed Contributor Network
22

33
The code behind <https://developmentseed.org/contributor-network>.
44

55
![A splash of the page](./img/site-image.jpg)
66

7-
This visual is derived from the excellent <https://github.com/nbremer/ORCA/tree/main/top-contributor-network>.
7+
This visual is derived from the excellent [ORCA top-contributor-network](https://github.com/nbremer/ORCA/tree/main/top-contributor-network) by Nadieh Bremer.
88

9-
## Rebuilding
9+
## Quick Start
1010

11-
We use [workflow dispatch](https://github.com/developmentseed/contributor-network/actions/workflows/build.yml) to rebuild the source data.
12-
Right now this is manual, but eventually we'd like to set this up on a schedule: <https://github.com/developmentseed/contributor-network/issues/8>.
11+
### Prerequisites
1312

14-
## Development
13+
- [uv](https://docs.astral.sh/uv/getting-started/installation/) for Python package management
14+
- A GitHub personal access token with `public_repo` scope
1515

16-
To view things locally:
16+
### View Locally
1717

1818
```shell
19-
python -m http.server
19+
cd dist
20+
python -m http.server 8000
2021
```
2122

22-
This will open the page on <http://localhost:8000/>.
23+
Then open <http://localhost:8000/>.
24+
25+
## CLI Commands
26+
27+
All commands are run via `uv run contributor-network <command>`.
28+
29+
### `list-contributors`
2330

24-
To check the Python files, get [uv](https://docs.astral.sh/uv/getting-started/installation/), then:
31+
List all configured contributors by category:
2532

2633
```shell
27-
uv sync
28-
uv run ruff check --fix
29-
uv run ruff format
30-
uv run pytest
34+
uv run contributor-network list-contributors
3135
```
3236

33-
To add new repos or contributors, see [constants.py](src/devseed_contributor_network/constants.py)
37+
### `discover`
38+
39+
Find new repositories that DevSeed employees contribute to:
3440

35-
### Rebuilding locally
41+
```shell
42+
export GITHUB_TOKEN="your_token_here"
43+
uv run contributor-network discover --min-contributors 2 --limit 50
44+
```
3645

37-
To build the data locally, set up [.netrc authentication for Github](https://pygithub.readthedocs.io/en/stable/examples/Authentication.html#netrc-authentication).
38-
Then:
46+
This queries GitHub to find repos where multiple DevSeed employees have contributed, which are not yet in the configuration.
47+
48+
### `data`
49+
50+
Fetch contribution data from GitHub for all configured repositories:
3951

4052
```shell
53+
export GITHUB_TOKEN="your_token_here"
4154
uv run contributor-network data data
55+
```
56+
57+
Options:
58+
- `--all-contributors`: Include alumni/friends (not just current DevSeed employees)
59+
60+
### `csvs`
61+
62+
Generate CSV files from the fetched JSON data:
63+
64+
```shell
4265
uv run contributor-network csvs data
66+
```
67+
68+
### `build`
69+
70+
Build the static site to the `dist/` folder:
71+
72+
```shell
4373
uv run contributor-network build data dist
4474
```
4575

76+
## Full Workflow
77+
78+
To update the visualization with new data:
79+
80+
```shell
81+
# 1. Set your GitHub token
82+
export GITHUB_TOKEN="your_token_here"
83+
84+
# 2. (Optional) Discover new repos to add
85+
uv run contributor-network discover --min-contributors 2
86+
87+
# 3. Edit config.toml to add/remove repos or contributors
88+
89+
# 4. Fetch data from GitHub
90+
uv run contributor-network data data
91+
92+
# 5. Generate CSVs
93+
uv run contributor-network csvs data
94+
95+
# 6. Build the site
96+
uv run contributor-network build data dist
97+
98+
# 7. Preview locally
99+
cd dist && python -m http.server 8000
100+
```
101+
102+
## Configuration
103+
104+
Edit `config.toml` to configure:
105+
106+
- **repositories**: List of GitHub repos to track (format: `"owner/repo"`)
107+
- **contributors.devseed**: Current DevSeed employees (format: `github_username = "Display Name"`)
108+
- **contributors.alumni**: Friends and alumni (commented out by default)
109+
110+
## Development
111+
112+
### Code Quality
113+
114+
```shell
115+
uv sync
116+
uv run ruff check --fix
117+
uv run ruff format
118+
uv run pytest
119+
```
120+
121+
### Automated Rebuilds
122+
123+
We use [workflow dispatch](https://github.com/developmentseed/contributor-network/actions/workflows/build.yml) to rebuild the source data manually.
124+
125+
## Branding
126+
127+
This visualization uses the Development Seed brand colors:
128+
- **Grenadier** (#CF3F02): Primary orange accent
129+
- **Aquamarine** (#2E86AB): Secondary blue
130+
- **Base** (#443F3F): Text color
131+
46132
## License
47133

48134
This work was copied-and-modified from <https://github.com/nbremer/ORCA> and is licensed under the same (MPL).

index.js

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,15 @@
11
// This file was copied-and-modified from
22
// https://github.com/nbremer/ORCA/blob/77745774d9d189818ab1ba27e07979897434abf9/top-contributor-network/createORCAVisual.js,
33
// and is licensed under the same (MPL).
4-
4+
//
5+
// Development Seed Modifications:
6+
// - Updated color scheme to DevSeed brand (Grenadier orange, Aquamarine blue)
7+
// - Removed the central "team" pseudo-node from rendering (but kept for layout)
8+
// - Added null safety checks for hover/click interactions
9+
// - Added boundary checking to prevent hover outside visualization area
10+
// - Added mouseleave handler to properly clean up hover state
11+
// - Filtered out artificial links to/from the central pseudo-node
12+
//
513
/////////////////////////////////////////////////////////////////////
614
/////////////// Visualization designed & developed by ///////////////
715
/////////////////////////// Nadieh Bremer ///////////////////////////
@@ -1503,12 +1511,6 @@ const createORCAVisual = (
15031511
} // function drawNode
15041512

15051513
function drawNodeArc(context, SF, d) {
1506-
// Skip arc drawing for the central pseudo-node concept since it's been removed
1507-
// The original showed time involvement with a central repo, but we no longer have one
1508-
// if (d.type === "contributor" && !CLICK_ACTIVE) {
1509-
// timeRangeArc(context, SF, d, central_repo, d.data.link_central);
1510-
// }
1511-
15121514
// Draw an arc around the repository node that shows how long the contributor has been active in that repo for all its existence, based on the first and last commit time
15131515
if (
15141516
HOVER_ACTIVE &&

src/contributor_network/config.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
"""Configuration management for the contributor network visualization.
2+
3+
The config supports categorizing contributors into groups (e.g., "devseed" for current
4+
employees, "alumni" for past contributors). This allows filtering the visualization
5+
to show only active team members while preserving historical data.
6+
"""
17
from __future__ import annotations
28

39
import tomllib
@@ -7,6 +13,18 @@
713

814

915
class Config(BaseModel):
16+
"""Configuration for the contributor network visualization.
17+
18+
Attributes:
19+
title: Page title for the visualization
20+
author: Author attribution
21+
description: Description shown on the page
22+
central_repository: Label for the central node (e.g., "DevSeed Team")
23+
repositories: List of GitHub repos to track (format: "owner/repo")
24+
contributors: Nested dict of contributor categories, each mapping
25+
GitHub username to display name
26+
contributor_padding: Padding around contributor nodes in pixels
27+
"""
1028
title: str
1129
author: str
1230
description: str

0 commit comments

Comments
 (0)