Skip to content

Commit 0fc5387

Browse files
committed
Add AGPL-3.0 license and GitHub Actions deployment workflow
1 parent fe58087 commit 0fc5387

24 files changed

Lines changed: 493 additions & 531 deletions

.github/workflows/deploy.yml

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
name: Deploy to GitHub Pages
2+
3+
on:
4+
push:
5+
branches: [master]
6+
workflow_dispatch:
7+
8+
permissions:
9+
contents: read
10+
pages: write
11+
id-token: write
12+
13+
concurrency:
14+
group: "pages"
15+
cancel-in-progress: true
16+
17+
jobs:
18+
build:
19+
runs-on: ubuntu-latest
20+
steps:
21+
- name: Checkout
22+
uses: actions/checkout@v4
23+
24+
- name: Setup Python
25+
uses: actions/setup-python@v5
26+
with:
27+
python-version: '3.11'
28+
29+
- name: Install Python dependencies
30+
run: pip install -r scripts/requirements.txt
31+
32+
- name: Clone PathSim repositories for API extraction
33+
run: |
34+
git clone --depth 1 https://github.com/pathsim/pathsim.git ../pathsim
35+
git clone --depth 1 https://github.com/pathsim/pathsim-chem.git ../pathsim-chem
36+
git clone --depth 1 https://github.com/pathsim/pathsim-vehicle.git ../pathsim-vehicle
37+
38+
- name: Extract API documentation
39+
run: python scripts/extract-api.py
40+
41+
- name: Prepare notebooks
42+
run: python scripts/prepare-notebooks.py
43+
44+
- name: Setup Node.js
45+
uses: actions/setup-node@v4
46+
with:
47+
node-version: '20'
48+
cache: 'npm'
49+
50+
- name: Install dependencies
51+
run: npm ci
52+
53+
- name: Build
54+
env:
55+
BASE_PATH: '/${{ github.event.repository.name }}'
56+
run: npm run build
57+
58+
- name: Upload artifact
59+
uses: actions/upload-pages-artifact@v3
60+
with:
61+
path: build
62+
63+
deploy:
64+
needs: build
65+
runs-on: ubuntu-latest
66+
environment:
67+
name: github-pages
68+
url: ${{ steps.deployment.outputs.page_url }}
69+
steps:
70+
- name: Deploy to GitHub Pages
71+
id: deployment
72+
uses: actions/deploy-pages@v4

LICENSE

Lines changed: 218 additions & 0 deletions
Large diffs are not rendered by default.

scripts/extract-api.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -357,7 +357,8 @@ def extract(self) -> dict:
357357

358358
try:
359359
module_data = self._extract_module(module_path)
360-
if module_data and (module_data["classes"] or module_data["functions"] or module_data["docstring_html"]):
360+
# Only include modules that have classes or functions (not just docstrings)
361+
if module_data and (module_data["classes"] or module_data["functions"]):
361362
result["modules"][module_path] = module_data
362363
class_count = len(module_data["classes"])
363364
func_count = len(module_data["functions"])
@@ -419,12 +420,11 @@ def _empty_result(self) -> dict:
419420

420421
def _extract_module_obj(self, obj: griffe.Object, module_path: str) -> dict | None:
421422
"""Extract module data from griffe object - only items defined here."""
422-
docstring = obj.docstring.value if obj.docstring else ""
423-
423+
# Skip module-level docstrings - only extract classes and functions
424424
module_data = {
425425
"name": module_path,
426-
"description": extract_first_line(docstring),
427-
"docstring_html": rst_to_html(docstring),
426+
"description": "",
427+
"docstring_html": "",
428428
"classes": [],
429429
"functions": [],
430430
}

src/app.css

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -306,6 +306,14 @@ pre {
306306
padding: var(--space-md);
307307
}
308308

309+
/* Notebook images - ensure responsive scaling */
310+
.notebook img,
311+
.notebook-cells img,
312+
.cell-outputs img {
313+
max-width: 100%;
314+
height: auto;
315+
}
316+
309317
pre code {
310318
background: none;
311319
padding: 0;
@@ -1363,3 +1371,55 @@ pre.output-text {
13631371
.gap-lg {
13641372
gap: var(--space-lg);
13651373
}
1374+
1375+
/* ============================================
1376+
CODE BLOCK SHARED STYLES
1377+
Used by MarkdownRenderer, RstRenderer, DocstringRenderer
1378+
============================================ */
1379+
1380+
.code-block-wrapper {
1381+
margin: var(--space-md) 0;
1382+
border: 1px solid var(--border);
1383+
border-radius: var(--radius-lg);
1384+
overflow: hidden;
1385+
}
1386+
1387+
.code-block-header {
1388+
display: flex;
1389+
align-items: center;
1390+
justify-content: space-between;
1391+
padding: var(--space-xs) var(--space-md);
1392+
background: var(--surface-raised);
1393+
border-bottom: 1px solid var(--border);
1394+
}
1395+
1396+
.code-copy-btn {
1397+
display: flex;
1398+
align-items: center;
1399+
justify-content: center;
1400+
padding: var(--space-xs);
1401+
background: transparent;
1402+
border: none;
1403+
border-radius: var(--radius-sm);
1404+
color: var(--text-muted);
1405+
cursor: pointer;
1406+
transition: color var(--transition-fast), background var(--transition-fast);
1407+
}
1408+
1409+
.code-copy-btn:hover {
1410+
color: var(--text);
1411+
background: var(--surface-hover);
1412+
}
1413+
1414+
.code-copy-btn.copied {
1415+
color: var(--success);
1416+
}
1417+
1418+
.cm-container {
1419+
background: var(--surface);
1420+
}
1421+
1422+
.cm-container .cm-editor {
1423+
font-size: var(--font-base);
1424+
max-height: 300px;
1425+
}

src/lib/api/generated/chem.json

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,6 @@
22
"package": "pathsim_chem",
33
"display_name": "PathSim-Chem",
44
"modules": {
5-
"pathsim_chem": {
6-
"name": "pathsim_chem",
7-
"description": "PathSim-Chem: Chemical Engineering Blocks for PathSim",
8-
"docstring_html": "<p>PathSim-Chem: Chemical Engineering Blocks for PathSim</p>\n<p>A toolbox providing specialized blocks for chemical engineering simulations\nin the PathSim framework.</p>\n",
9-
"classes": [],
10-
"functions": []
11-
},
125
"pathsim_chem.tritium.bubbler": {
136
"name": "pathsim_chem.tritium.bubbler",
147
"description": "",
@@ -111,8 +104,8 @@
111104
},
112105
"pathsim_chem.tritium.glc": {
113106
"name": "pathsim_chem.tritium.glc",
114-
"description": "Bubble column gas-liquid contactor model solver.",
115-
"docstring_html": "<p>Bubble column gas-liquid contactor model solver.</p>\n<p>This module solves the coupled, non-linear, second-order ordinary differential\nequations that describe tritium transport in a counter-current bubble column,\nbased on the model by C. Malara (1995).</p>\n",
107+
"description": "",
108+
"docstring_html": "",
116109
"classes": [
117110
{
118111
"name": "GLC",

src/lib/api/generated/index.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33

44
import pathsimData from './pathsim.json';
55
import chemData from './chem.json';
6-
import vehicleData from './vehicle.json';
76

87
export interface APIParameter {
98
name: string;
@@ -68,7 +67,6 @@ export interface APIPackage {
6867
export const apiData: Record<string, APIPackage> = {
6968
pathsim: pathsimData as APIPackage,
7069
chem: chemData as APIPackage,
71-
vehicle: vehicleData as APIPackage,
7270
};
7371

7472
export default apiData;

src/lib/components/api/DocstringRenderer.svelte

Lines changed: 2 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import { theme } from '$lib/stores/themeStore';
77
import { processCrossRefs, lookupRef } from '$lib/utils/crossref';
88
import { searchTarget } from '$lib/stores/searchNavigation';
9-
import { COPY_FEEDBACK_DURATION } from '$lib/config/timing';
9+
import { createCopyButton } from '$lib/utils/copyButton';
1010
1111
interface Props {
1212
html: string;
@@ -212,30 +212,6 @@
212212
return 'python';
213213
}
214214
215-
// Create copy button with icon
216-
function createCopyButton(code: string): HTMLButtonElement {
217-
const button = document.createElement('button');
218-
button.className = 'code-copy-btn';
219-
button.title = 'Copy to clipboard';
220-
button.innerHTML = `<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="9" y="9" width="13" height="13" rx="2" ry="2"></rect><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"></path></svg>`;
221-
222-
button.addEventListener('click', async () => {
223-
try {
224-
await navigator.clipboard.writeText(code);
225-
button.classList.add('copied');
226-
button.innerHTML = `<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="20 6 9 17 4 12"></polyline></svg>`;
227-
setTimeout(() => {
228-
button.classList.remove('copied');
229-
button.innerHTML = `<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="9" y="9" width="13" height="13" rx="2" ry="2"></rect><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"></path></svg>`;
230-
}, COPY_FEEDBACK_DURATION);
231-
} catch (e) {
232-
console.warn('Failed to copy:', e);
233-
}
234-
});
235-
236-
return button;
237-
}
238-
239215
// Render code blocks with CodeMirror
240216
async function renderCodeBlocks() {
241217
if (!container) return;
@@ -434,55 +410,7 @@
434410
margin-bottom: 0;
435411
}
436412
437-
/* Code block wrapper */
438-
.docstring-content :global(.code-block-wrapper) {
439-
margin: var(--space-md) 0;
440-
border: 1px solid var(--border);
441-
border-radius: var(--radius-lg);
442-
overflow: hidden;
443-
}
444-
445-
/* Code block header - styled like panel-header */
446-
.docstring-content :global(.code-block-header) {
447-
display: flex;
448-
align-items: center;
449-
justify-content: space-between;
450-
padding: var(--space-xs) var(--space-md);
451-
background: var(--surface-raised);
452-
border-bottom: 1px solid var(--border);
453-
}
454-
455-
456-
.docstring-content :global(.code-copy-btn) {
457-
display: flex;
458-
align-items: center;
459-
justify-content: center;
460-
padding: var(--space-xs);
461-
background: transparent;
462-
border: none;
463-
border-radius: var(--radius-sm);
464-
color: var(--text-muted);
465-
cursor: pointer;
466-
transition: color var(--transition-fast), background var(--transition-fast);
467-
}
468-
469-
.docstring-content :global(.code-copy-btn:hover) {
470-
color: var(--text);
471-
background: var(--surface-hover);
472-
}
473-
474-
.docstring-content :global(.code-copy-btn.copied) {
475-
color: var(--success, #22c55e);
476-
}
477-
478-
.docstring-content :global(.cm-container) {
479-
background: var(--surface);
480-
}
481-
482-
.docstring-content :global(.cm-editor) {
483-
font-size: var(--font-base);
484-
max-height: 300px;
485-
}
413+
/* Code block styles are in app.css */
486414
487415
/* Parameter/Attribute tables - panel style */
488416
.docstring-content :global(.param-table-wrapper) {

0 commit comments

Comments
 (0)