Skip to content

Commit 3272d28

Browse files
committed
[feat] Add contributing guidelines for the registry
1 parent 6d74325 commit 3272d28

2 files changed

Lines changed: 130 additions & 0 deletions

File tree

.vscode/settings.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"json.schemas": [
3+
{
4+
"fileMatch": ["components/registry/components/*.json"],
5+
"url": "./components/registry/schemas/component.schema.json"
6+
}
7+
]
8+
}

components/registry/README.md

Lines changed: 122 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
# Component Registry
2+
3+
This repo includes a **community-maintained component registry** of Streamlit components under [`components/registry/components/`](components/). Each file is a small JSON document describing a single component found on the internet.
4+
5+
If you maintain a Streamlit Component, we’d love for you to add it here via a pull request!
6+
7+
## Quick submit (GitHub web editor)
8+
9+
1. **Fork** this repository.
10+
2. In your fork, open [`components/registry/components/`](components/) and click **Add file → Create new file**.
11+
3. Name your file: `components/registry/components/<slug>.json`
12+
- Use a short, URL-safe slug like `streamlit-my-component.json` (lowercase + hyphens is best).
13+
4. Copy/paste the **Starter template** below, fill in your values.
14+
5. Commit to a new branch in your fork.
15+
6. Open a **Pull Request** back to this repo.
16+
17+
When you open the PR, CI will automatically validate your JSON.
18+
19+
## What happens next?
20+
21+
Once your PR is merged, your component will appear in the gallery after the next weekly refresh (runs early Monday UTC / Sunday evening PT). Metrics like GitHub stars and PyPI downloads are updated automatically.
22+
23+
## Starter template (minimal valid)
24+
25+
> Tip: If you’re editing in VS Code / GitHub’s web editor, you should get live validation + autocomplete from the schema once `.vscode/settings.json` is present in the repo.
26+
27+
```json
28+
{
29+
"schemaVersion": 1,
30+
"title": "My Component",
31+
"author": {
32+
"github": "your-github-username",
33+
"displayName": "Your Name (optional)"
34+
},
35+
"links": {
36+
"github": "https://github.com/OWNER/REPO",
37+
"pypi": null,
38+
"demo": null,
39+
"docs": null
40+
},
41+
"media": {
42+
"image": null
43+
},
44+
"install": {
45+
"pip": "pip install your-package-name"
46+
},
47+
"governance": {
48+
"enabled": true,
49+
"notes": null
50+
},
51+
"categories": ["Widgets"]
52+
}
53+
```
54+
55+
## Requirements (what CI checks)
56+
57+
CI runs [`components/registry/scripts/validate.py`](scripts/validate.py) on every PR that touches `components/registry/components/**`.
58+
59+
### Schema requirements
60+
61+
Your JSON must conform to [`components/registry/schemas/component.schema.json`](schemas/component.schema.json). Key points:
62+
63+
- **`schemaVersion`**: must be `1`.
64+
- **`title`**: 1–80 characters.
65+
- **`author.github`**: GitHub username _without_ `@`.
66+
- **`links.github`**: must be a repo URL like `https://github.com/<owner>/<repo>` (no extra path segments).
67+
- **`links.pypi`**: PyPI project name (not a URL), or `null`.
68+
- **`links.docs`**: optional URL to your component’s documentation, or `null`.
69+
- **No extra keys**: the schema uses `additionalProperties: false`, so don’t add custom fields.
70+
71+
### Policy checks beyond schema (common CI failures)
72+
73+
The validator enforces a few “lint” rules to keep the registry stable:
74+
75+
- **Unique repo**: `links.github` must be unique across all submissions. If the same repo was already submitted, CI will fail.
76+
- **HTTPS only**: all URLs must be `https://` and must not use `javascript:`, `data:`, or `file:` schemes.
77+
- **Stable images** (`media.image`): must be a stable `https://` URL.
78+
- Signed/expiring URLs (S3/GCS/CloudFront-style query params like `X-Amz-Signature`, `Expires`, etc.) are rejected.
79+
- Proxy hosts like `camo.githubusercontent.com` are rejected.
80+
- **File size**: each `components/registry/components/*.json` must be ≤ 50 KB.
81+
82+
## Categories
83+
84+
Pick **at least one** category (you can pick multiple). Allowed values are:
85+
86+
- `LLMs`
87+
- `Widgets`
88+
- `Charts`
89+
- `Authentication`
90+
- `Connections`
91+
- `Images & video`
92+
- `Audio`
93+
- `Text`
94+
- `Maps`
95+
- `Dataframes`
96+
- `Graphs`
97+
- `Molecules & genes`
98+
- `Code editors`
99+
- `Page navigation`
100+
- `Developer tools`
101+
- `Integrations`
102+
103+
## Self-check your submission (optional, but recommended)
104+
105+
### Option A: No local setup
106+
107+
Open a **draft PR** and let CI validate it automatically.
108+
109+
### Option B: Run the validator locally
110+
111+
From the repo root:
112+
113+
```bash
114+
uv sync
115+
uv run python components/registry/scripts/validate.py
116+
```
117+
118+
If it prints `OK: all validated files passed.`, your submission is valid.
119+
120+
## What not to edit
121+
122+
- Don’t edit `components/registry/compiled/components.json` directly — it’s a generated artifact.

0 commit comments

Comments
 (0)