Skip to content

Commit 77854c1

Browse files
committed
Improve and simplify the README
1 parent 5c92d0d commit 77854c1

3 files changed

Lines changed: 137 additions & 102 deletions

File tree

.github/copilot-instructions.md

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
# Copilot Instructions for Analysis Template
22

3-
## Project context (fill these in!)
4-
- **Project name:** <fill>
5-
- **One-liner goal:** <fill>
6-
- **Primary datasets / locations:** <fill>
3+
## Project context
4+
5+
See the project README for details about the project goal, datasets, and structure.
76

87
## Critical rules
98
- **Don't update Jupyter notebooks** — I manage them myself
@@ -22,7 +21,7 @@
2221
## Project structure
2322
- **Notebooks**: `analysis/[INITIALS]-[YYYY]-[MM]-[DD]_description.ipynb`
2423
- **Data**: `data/<dataset>/{raw,processed,resources,results}/`
25-
- **Paths**: Use `from myanalysis import FilePaths` (edit `_constants.py` for datasets)
24+
- **Paths**: Use `from <package> import FilePaths` (edit `_constants.py` for datasets)
2625
- **Deps**: All in `pixi.toml` (not pyproject.toml)
2726
- pyproject.toml exists mainly for package metadata and testing
2827
- Run `pixi install` after pulling changes that update `pixi.toml`

README.md

Lines changed: 133 additions & 97 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,18 @@
1-
# 🧬 Analysis Template (pixi, notebook-first)
1+
# 🧬 Analysis Template
22

3-
Template for single-cell/spatial **analysis** repos. If you're building a Python library, use the [scverse cookiecutter](https://github.com/scverse/cookiecutter-scverse) instead.
3+
A notebook-first template for single-cell/spatial analysis projects. Uses [pixi](https://pixi.sh) for environment management.
44

5-
> 📝 **After setup, replace this README** with project-specific docs so collaborators know what the project does. Include: a one-line goal, data locations, key notebooks to run, and who to ping.
5+
> If you're building a reusable Python library, use the [scverse cookiecutter](https://github.com/scverse/cookiecutter-scverse) instead.
66
77
---
88

9-
## 📦 What is pixi?
9+
## 🚀 Getting Started
1010

11-
[Pixi](https://pixi.sh) is a modern package manager that handles both **conda** and **PyPI** packages in one tool. Think of it as a replacement for conda/mamba + pip that:
11+
**You've initialized a new repo from this template—great!** Follow these steps to set up your project.
1212

13-
- 🔒 Creates **isolated environments** per project (like conda environments)
14-
- 🔀 Installs packages from **conda-forge AND PyPI** together
15-
- 📌 Locks exact versions for **reproducibility** (`pixi.lock`)
16-
- 💻 Works **cross-platform** (macOS, Linux, Windows)
13+
### Step 1: Install pixi
1714

18-
**You don't need conda or pip installed** — pixi handles everything!
19-
20-
### 🛠️ Installing pixi
15+
*Skip this if you already have pixi installed.*
2116

2217
```bash
2318
# macOS / Linux
@@ -27,90 +22,145 @@ curl -fsSL https://pixi.sh/install.sh | bash
2722
brew install pixi
2823
```
2924

30-
👉 See [pixi installation docs](https://pixi.sh/latest/#installation) for Windows and other options.
25+
Restart your terminal after installation. See [pixi installation docs](https://pixi.sh/latest/#installation) for Windows and other options.
3126

32-
---
27+
### Step 1b: Install GitHub CLI (optional)
3328

34-
## 🚀 Quick start
29+
*Recommended if you're working on a remote server and need to authenticate with GitHub.*
3530

3631
```bash
37-
pixi install # create environment (reads pixi.toml)
38-
pixi shell # activate the environment
39-
pre-commit install # set up code quality hooks (run once)
40-
pixi run lab # start Jupyter Lab
41-
pixi run test # run tests
42-
pixi run install-kernel # add Jupyter kernel (run once)
32+
# macOS
33+
brew install gh
34+
35+
# Linux (no sudo required)
36+
curl -sS https://webi.sh/gh | sh
37+
```
38+
39+
Then authenticate: `gh auth login`. See [GitHub CLI installation docs](https://github.com/cli/cli#installation) for more options.
40+
41+
### Step 2: Clone your repo locally
42+
43+
```bash
44+
git clone <your-repo-url>
45+
cd <your-project-name>
4346
```
4447

45-
### ☕ Daily workflow
48+
The URL depends on your authentication method:
49+
- **HTTPS**: `https://github.com/owner/repo.git`
50+
- **SSH**: `git@github.com:owner/repo.git`
51+
- **GitHub CLI**: `gh repo clone owner/repo`
52+
53+
### Step 3: Customize the template
54+
55+
Before installing the environment, update these files with your project details:
4656

47-
Once set up, your typical workflow is:
57+
| File | What to change |
58+
|------|----------------|
59+
| `src/myanalysis/` | **Rename this folder** to your project slug (e.g., `src/myproject/`) |
60+
| `pyproject.toml` | Update `name` to match your renamed folder |
61+
| `pixi.toml` | Update `name`, `description`, `authors`, kernel `display-name`, and `myanalysis` → your package name in `[pypi-dependencies]` |
62+
63+
### Step 4: Set up the environment
64+
65+
```bash
66+
pixi install # create environment from pixi.toml
67+
pixi run pre-commit install # set up code quality hooks
68+
pixi run install-kernel # register Jupyter kernel
69+
```
70+
71+
💡 **Tip**: Use `pixi shell` to enter the environment interactively—then you can run commands directly without the `pixi run` prefix.
72+
73+
### Step 5: Verify your setup
74+
75+
```bash
76+
pixi run test # should pass (tests your package imports correctly)
77+
pixi run lab # opens Jupyter Lab
78+
```
79+
80+
In Jupyter Lab, check that your kernel appears (look for the name you set in `pixi.toml`).
81+
82+
### Step 6: Make your first commit
83+
84+
```bash
85+
git add -A
86+
git commit -m "Initial project setup"
87+
git push
88+
```
89+
90+
💡 Pre-commit hooks will run and may reformat some files. If so, just `git add -A && git commit -m "Initial project setup"` again.
91+
92+
🎉 **You're ready to start analyzing!**
93+
94+
---
95+
96+
## 📊 Start Your Analysis
97+
98+
- **Demo notebook**: Check out `analysis/demo_scRNA_workflow.ipynb` for a complete scRNA-seq workflow example using scanpy's PBMC 3k dataset.
99+
- **New notebooks**: Copy `analysis/XX-2026-01-27_sample_notebook.ipynb` as a starting point. Follow the naming convention: `[INITIALS]-[YYYY]-[MM]-[DD]_description.ipynb`.
100+
- **Add your data**: Create folders under `data/` and register paths in `src/<your-package>/_constants.py`.
101+
- **Replace this README** with your project documentation once you're set up.
102+
103+
---
104+
105+
## ☕ Daily Workflow
48106

49107
```bash
50108
cd your-project
51109
pixi shell # activate environment
52-
jupyter lab # work in notebooks
110+
jupyter lab # work in notebooks, or start via jupyter-hub
53111
# ... do your analysis ...
54112
exit # leave pixi shell when done
55113
```
56114

57-
Or run commands without entering the shell:
115+
Or run commands directly without entering the shell:
58116

59117
```bash
60-
pixi run lab # runs Jupyter in pixi environment
61-
pixi run python my_script.py # runs script in pixi environment
118+
pixi run lab # start Jupyter Lab
119+
pixi run python script.py # run a script
62120
```
63121

64122
---
65123

66-
## ➕ Adding packages
124+
## 📚 Reference
67125

68-
All dependencies live in `pixi.toml`. To add a new package:
126+
<details>
127+
<summary><strong>📦 What is pixi?</strong></summary>
69128

70-
### Option 1: Command line (recommended)
129+
[Pixi](https://pixi.sh) is a modern package manager that handles both **conda** and **PyPI** packages in one tool:
71130

72-
```bash
73-
# Add from conda-forge (preferred for scientific packages)
74-
pixi add numpy
75-
pixi add "scanpy>=1.10"
131+
- 🔒 Creates **isolated environments** per project
132+
- 🔀 Installs from **conda-forge AND PyPI** together
133+
- 📌 Locks exact versions for **reproducibility** (`pixi.lock`)
134+
- 💻 Works **cross-platform** (macOS, Linux, Windows)
76135

77-
# Add from PyPI (when not available on conda-forge)
78-
pixi add --pypi some-pypi-only-package
79-
```
136+
**You don't need conda or pip installed** — pixi handles everything!
80137

81-
### Option 2: Edit pixi.toml directly
138+
</details>
82139

83-
```toml
84-
# In pixi.toml:
140+
<details>
141+
<summary><strong>➕ Adding packages</strong></summary>
142+
143+
All dependencies live in `pixi.toml`. To add a new package:
85144

86-
[dependencies]
87-
# Conda packages go here
88-
numpy = ">=2.0"
145+
```bash
146+
# From conda-forge (preferred for scientific packages)
147+
pixi add numpy
148+
pixi add "scanpy>=1.10"
89149

90-
[pypi-dependencies]
91-
# PyPI packages go here
92-
some-package = "*"
150+
# From PyPI (when not on conda-forge)
151+
pixi add --pypi some-package
93152
```
94153

95-
Then run `pixi install` to update the environment.
154+
Or edit `pixi.toml` directly and run `pixi install`.
96155

97-
💡 **Tip**: Prefer **conda-forge** packages when available — they're pre-compiled and faster to install. Use PyPI for packages only available there.
156+
💡 **Tip**: Prefer PyPI packages when available—mixing conda and pip can cause dependency conflicts.
98157

99158
👉 See [pixi documentation](https://pixi.sh/latest/) for more details.
100159

101-
---
102-
103-
## ✏️ What to customize
104-
105-
1. Update `pixi.toml` metadata: project name, description, authors, and kernel display name.
106-
2. Rename the package directory `src/myanalysis/` to your project slug, and update the `name` in `pyproject.toml` to match.
107-
3. Adjust paths in `src/<your-package>/_constants.py` to match your datasets.
108-
4. Update `.github/copilot-instructions.md` with your project name, goal, and dataset locations. This helps AI coding assistants (GitHub Copilot, Claude, etc.) understand your project.
109-
5. 📝 **Replace this README** with project-specific docs: what the project does, how to run key notebooks, and who to contact.
160+
</details>
110161

111-
---
112-
113-
## 📓 Data and notebooks
162+
<details>
163+
<summary><strong>📓 Data and notebook conventions</strong></summary>
114164

115165
- **Notebook naming**: `[INITIALS]-[YYYY]-[MM]-[DD]_description.ipynb`
116166
- **Data layout** (one folder per dataset):
@@ -122,64 +172,50 @@ Then run `pixi install` to update the environment.
122172
- **Import paths** via the local package:
123173

124174
```python
125-
from myanalysis import FilePaths
175+
from yourpackage import FilePaths
126176
```
127177

128-
---
129-
130-
## 🔧 Tooling & code quality
131-
132-
This template uses **pre-commit hooks** to automatically check your code before each commit. This catches common issues early and keeps code consistent across the team.
133-
134-
### What are pre-commit hooks?
135-
136-
[Pre-commit](https://pre-commit.com/) is a tool that runs checks on your code **every time you run `git commit`**. If any check fails, the commit is blocked until you fix the issue. This ensures:
178+
</details>
137179

138-
- ✅ Code is consistently formatted
139-
- ✅ Common bugs are caught early
140-
- ✅ Everyone's code looks the same
180+
<details>
181+
<summary><strong>🔧 Pre-commit & code quality</strong></summary>
141182

142-
### Tools we use
183+
This template uses **pre-commit hooks** to automatically check your code before each commit:
143184

144-
| Tool | What it does | Docs |
145-
|------|--------------|------|
146-
| 🦀 **[Ruff](https://docs.astral.sh/ruff/)** | Lints (finds bugs/style issues) and formats Python code + Jupyter notebooks. Super fast! | [Rules](https://docs.astral.sh/ruff/rules/) |
147-
| 🌿 **[Biome](https://biomejs.dev/)** | Formats JSON and JSONC files for consistency | [Guide](https://biomejs.dev/guides/getting-started/) |
148-
| 📋 **[pyproject-fmt](https://github.com/tox-dev/pyproject-fmt)** | Keeps `pyproject.toml` nicely formatted | |
185+
| Tool | What it does |
186+
|------|--------------|
187+
| [Ruff](https://docs.astral.sh/ruff/) | Lints and formats Python code + notebooks |
188+
| [Biome](https://biomejs.dev/) | Formats JSON/JSONC files |
189+
| [pyproject-fmt](https://github.com/tox-dev/pyproject-fmt) | Formats `pyproject.toml` |
149190

150-
### Setting up pre-commit
151-
152-
Run this once after cloning the repo:
153-
154-
```bash
155-
pixi shell
156-
pre-commit install
157-
```
158-
159-
Now hooks run automatically on `git commit`. To run all checks manually:
191+
Hooks run automatically on `git commit`. To run manually:
160192

161193
```bash
162194
pre-commit run --all-files
163195
```
164196

165-
💡 **Tip**: If a check reformats your code, just `git add` the changes and commit again!
197+
💡 If a check reformats your code, just `git add` the changes and commit again.
166198

167-
---
199+
</details>
168200

169-
## 🖥️ GPU notes
201+
<details>
202+
<summary><strong>🖥️ GPU notes</strong></summary>
170203

171204
| Platform | PyTorch | JAX |
172205
|----------|---------|-----|
173206
| **macOS** (Apple Silicon) | ✅ MPS acceleration | ❌ CPU only |
174-
| **Linux** (NVIDIA GPU) | ✅ CUDA | ✅ CUDA 12 via `jax[cuda12]` |
207+
| **Linux** (NVIDIA GPU) | ✅ CUDA | ✅ CUDA 12 |
175208

176-
The template automatically configures the right packages per platform. Linux also gets [rapids-singlecell](https://rapids-singlecell.readthedocs.io/) for GPU-accelerated single-cell analysis.
209+
The template auto-configures packages per platform. Linux also gets [rapids-singlecell](https://rapids-singlecell.readthedocs.io/) for GPU-accelerated analysis.
177210

178-
---
211+
</details>
179212

180-
## 🖧 Cluster usage
213+
<details>
214+
<summary><strong>🖧 Cluster usage</strong></summary>
181215

182216
For cluster usage (e.g., ETH Euler):
183217

184218
- 📚 General docs: https://docs.hpc.ethz.ch/
185-
- 🚀 Start notebooks via JupyterHub: https://jupyter.euler.hpc.ethz.ch/hub/
219+
- 🚀 Notebooks via JupyterHub: https://jupyter.euler.hpc.ethz.ch/hub/
220+
221+
</details>
File renamed without changes.

0 commit comments

Comments
 (0)