Skip to content

Commit 3e5936f

Browse files
documentation site prototype
1 parent 2662cd4 commit 3e5936f

19 files changed

Lines changed: 1043 additions & 348 deletions

.github/workflows/docs.yml

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
name: Deploy Documentation
2+
3+
on:
4+
push:
5+
branches: [main, master]
6+
pull_request:
7+
branches: [main, master]
8+
9+
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
10+
permissions:
11+
contents: read
12+
pages: write
13+
id-token: write
14+
15+
# Allow one concurrent deployment
16+
concurrency:
17+
group: "pages"
18+
cancel-in-progress: false
19+
20+
jobs:
21+
build:
22+
runs-on: ubuntu-latest
23+
steps:
24+
- name: Checkout
25+
uses: actions/checkout@v4
26+
27+
- name: Set up Python
28+
uses: actions/setup-python@v5
29+
with:
30+
python-version: "3.11"
31+
32+
- name: Install dependencies
33+
run: |
34+
python -m pip install --upgrade pip
35+
pip install -e .
36+
pip install quartodoc
37+
38+
- name: Setup Quarto
39+
uses: quarto-dev/quarto-actions/setup@v2
40+
41+
- name: Build API documentation
42+
run: |
43+
cd docs
44+
quartodoc build
45+
46+
- name: Render Quarto site
47+
run: |
48+
cd docs
49+
quarto render
50+
51+
- name: Upload artifact
52+
if: github.event_name != 'pull_request'
53+
uses: actions/upload-pages-artifact@v3
54+
with:
55+
path: docs/_site
56+
57+
deploy:
58+
if: github.event_name != 'pull_request'
59+
environment:
60+
name: github-pages
61+
url: ${{ steps.deployment.outputs.page_url }}
62+
runs-on: ubuntu-latest
63+
needs: build
64+
steps:
65+
- name: Deploy to GitHub Pages
66+
id: deployment
67+
uses: actions/deploy-pages@v4

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,10 @@ venv.bak/
5050

5151
# Documentation build output
5252
/site
53+
docs/_site/
54+
docs/reference/
55+
!docs/reference/.gitkeep
56+
!docs/reference/index.qmd
5357

5458
# Hatch
5559
.hatch/
@@ -63,3 +67,5 @@ Desktop.ini
6367
# Local development
6468
*.local
6569
local/
70+
71+
.ipynb_checkpoints

AGENTS.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,19 @@ hatch run fix
3535
- functions/vars: `snake_case`
3636
- constants: `UPPER_SNAKE_CASE`
3737

38+
## Coding conventions
39+
40+
- Complexity is a liability and should only be introduced when it has significant benefits.
41+
- Dont write short wrapper functions for other functions.
42+
- Only check types and parameter validity on public APIs.
43+
44+
45+
## Testing conventions
46+
47+
- Dont write trivial tests; no tests for the sake of tests.
48+
- Only test public APIs.
49+
- Dont design tests to pass, design tests that test what the user expects to happen or fail.
50+
- This pacakge primarily embeds JS widgets. The effect they have on the dom should be tested with playwright
3851

3952
## Before Submitting Changes
4053

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,11 @@ package.
1616
pip install heattree_py
1717
```
1818

19+
## Documentation
20+
21+
Full documentation with interactive examples is available at:
22+
**https://grunwaldlab.github.io/heattree_py/**
23+
1924
## Quick start
2025

2126
```python

docs/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
/.quarto/
2+
**/*.quarto_ipynb

docs/_quarto.yml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
project:
2+
type: website
3+
output-dir: _site
4+
5+
website:
6+
title: "heattree_py"
7+
description: "Interactive phylogenetic tree visualization for Jupyter notebooks"
8+
navbar:
9+
left:
10+
- href: index.qmd
11+
text: Home
12+
- getting-started.qmd
13+
- examples.qmd
14+
- href: reference/index.qmd
15+
text: API Reference
16+
right:
17+
- icon: github
18+
href: https://github.com/grunwaldlab/heattree_py
19+
sidebar:
20+
- title: Getting Started
21+
contents:
22+
- getting-started.qmd
23+
- title: Examples
24+
contents:
25+
- examples.qmd
26+
- title: API Reference
27+
contents:
28+
- section: Core Functions
29+
contents:
30+
- reference/heat_tree.qmd
31+
- reference/example_data.qmd
32+
- reference/HeatTreeWidget.qmd
33+
34+
# quartodoc configuration for API reference
35+
quartodoc:
36+
style: pkgdown
37+
dir: reference
38+
package: heattree_py
39+
title: API Reference
40+
sidebar: reference/_sidebar.yml
41+
parser: google
42+
sections:
43+
- title: Core Functions
44+
desc: Main visualization functions
45+
contents:
46+
- heat_tree
47+
- example_data
48+
- HeatTreeWidget
49+
50+
format:
51+
html:
52+
theme: cosmo
53+
css: styles.css
54+
toc: true
55+
code-copy: true
56+
code-overflow: wrap

docs/examples.qmd

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
---
2+
title: "Examples"
3+
---
4+
5+
This page showcases real-world examples using published phylogenetic datasets.
6+
7+
## Weisberg et al. 2020
8+
9+
Phylogenetic trees of *Agrobacterium* isolates from a study on virulence plasmid conservation and transmission:
10+
11+
> Alexandra J. Weisberg et al., Unexpected conservation and global transmission
12+
> of agrobacterial virulence plasmids. Science 368, eaba5256 (2020).
13+
14+
The widget below contains both the MLSA (multilocus sequence analysis) tree and
15+
the time-calibrated BEAST tree. Use the "Select tree" dropdown in the toolbar's
16+
"Data" tab to switch between them.
17+
18+
```{python}
19+
from heattree_py import heat_tree, example_data
20+
21+
heat_tree(
22+
tree=[
23+
example_data("weisberg_2020_mlsa"),
24+
example_data("weisberg_2020_beast")
25+
],
26+
metadata=[
27+
example_data("weisberg_2020_metadata"),
28+
example_data("weisberg_2020_metadata")
29+
],
30+
aesthetics=[
31+
{"tipLabelText": "strain", "tipLabelColor": "host_type"},
32+
{"tipLabelText": "strain", "tipLabelColor": "year_isolated"}
33+
],
34+
tree_names=["MLSA", "BEAST"],
35+
layout="circular"
36+
)
37+
```
38+
39+
## Bansal et al. 2021
40+
41+
Phylogenetic tree from a comparative genomics study of *Xylella*:
42+
43+
> Bansal, K., Kumar, S., Kaur, A., Singh, A., & Patil, P. B. (2021). Deep
44+
> phylo-taxono genomics reveals Xylella as a variant lineage of plant associated
45+
> Xanthomonas and supports their taxonomic reunification along with
46+
> Stenotrophomonas and Pseudoxanthomonas. Genomics, 113(6), 3989-4003.
47+
48+
```{python}
49+
heat_tree(
50+
example_data("bansal_2021_tree"),
51+
metadata=example_data("bansal_2021_metadata"),
52+
aesthetics={
53+
"tipLabelText": "Strain",
54+
"tipLabelColor": "Lifestyle"
55+
}
56+
)
57+
```

0 commit comments

Comments
 (0)