Skip to content

Commit 733778e

Browse files
committed
[feat] Add contributing guidelines for the registry
1 parent 109c46d commit 733778e

2 files changed

Lines changed: 126 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: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
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+
## Starter template (minimal valid)
20+
21+
> 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.
22+
23+
```json
24+
{
25+
"schemaVersion": 1,
26+
"title": "My Component",
27+
"author": {
28+
"github": "your-github-username",
29+
"displayName": "Your Name (optional)"
30+
},
31+
"links": {
32+
"github": "https://github.com/OWNER/REPO",
33+
"pypi": null,
34+
"demo": null,
35+
"docs": null
36+
},
37+
"media": {
38+
"image": null
39+
},
40+
"install": {
41+
"pip": "pip install your-package-name"
42+
},
43+
"governance": {
44+
"enabled": true,
45+
"notes": null
46+
},
47+
"categories": ["Widgets"]
48+
}
49+
```
50+
51+
## Requirements (what CI checks)
52+
53+
CI runs [`components/registry/scripts/validate.py`](scripts/validate.py) on every PR that touches `components/registry/components/**`.
54+
55+
### Schema requirements
56+
57+
Your JSON must conform to [`components/registry/schemas/component.schema.json`](schemas/component.schema.json). Key points:
58+
59+
- **`schemaVersion`**: must be `1`.
60+
- **`title`**: 1–80 characters.
61+
- **`author.github`**: GitHub username _without_ `@`.
62+
- **`links.github`**: must be a repo URL like `https://github.com/<owner>/<repo>` (no extra path segments).
63+
- **`links.pypi`**: PyPI project name (not a URL), or `null`.
64+
- **No extra keys**: the schema uses `additionalProperties: false`, so don’t add custom fields.
65+
66+
### Policy checks beyond schema (common CI failures)
67+
68+
The validator enforces a few “lint” rules to keep the registry stable:
69+
70+
- **Unique repo**: `links.github` must be unique across all submissions. If the same repo was already submitted, CI will fail.
71+
- **HTTPS only**: all URLs must be `https://` and must not use `javascript:`, `data:`, or `file:` schemes.
72+
- **Stable images** (`media.image`): must be a stable `https://` URL.
73+
- Signed/expiring URLs (S3/GCS/CloudFront-style query params like `X-Amz-Signature`, `Expires`, etc.) are rejected.
74+
- Proxy hosts like `camo.githubusercontent.com` are rejected.
75+
- **File size**: each `components/registry/components/*.json` must be ≤ 50 KB.
76+
77+
## Categories
78+
79+
Pick **at least one** category (you can pick multiple). Allowed values are:
80+
81+
- `LLMs`
82+
- `Widgets`
83+
- `Charts`
84+
- `Authentication`
85+
- `Connections`
86+
- `Images & video`
87+
- `Audio`
88+
- `Text`
89+
- `Maps`
90+
- `Dataframes`
91+
- `Graphs`
92+
- `Molecules & genes`
93+
- `Code editors`
94+
- `Page navigation`
95+
- `Developer tools`
96+
- `Integrations`
97+
98+
## Self-check your submission (optional, but recommended)
99+
100+
### Option A: No local setup
101+
102+
Open a **draft PR** and let CI validate it automatically.
103+
104+
### Option B: Run the validator locally
105+
106+
From the repo root:
107+
108+
```bash
109+
uv venv .venv
110+
uv pip install -r requirements.txt
111+
.venv/bin/python ./components/registry/scripts/validate.py
112+
```
113+
114+
If it prints `OK: all validated files passed.`, your submission is valid.
115+
116+
## What not to edit
117+
118+
- Don’t edit `components/registry/compiled/components.json` directly — it’s a generated artifact.

0 commit comments

Comments
 (0)