Skip to content

Commit 9596dcb

Browse files
Cleanup and Docs (#7)
- Updated README.md to only include installation and run details - Moved developer details to DEVELOPMENT.md - Added missing test project dependencies to pyproject.toml - Cleanup unused stuff from cookiecutter template - Added 'Getting Started' details to readthedocs docs - Added more documentation to backend classes
1 parent 4860f90 commit 9596dcb

20 files changed

Lines changed: 448 additions & 308 deletions

DEVELOPMENT.md

Lines changed: 227 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,227 @@
1+
# Development
2+
3+
This page contains developer instructions to build and maintain `mdadash`.
4+
5+
- [Installation](#installation)
6+
- [With `conda`](#with-conda)
7+
- [With `pip`](#with-pip)
8+
- [Run](#run)
9+
- [Develop](#develop)
10+
- [Frontend](#frontend)
11+
- [Backend](#backend)
12+
- [Lint checks](#lint-checks)
13+
- [Frontend](#frontend)
14+
- [Backend](#backend)
15+
- [Tests](#tests)
16+
- [Frontend](#frontend)
17+
- [Backend](#backend)
18+
- [Code Coverage](#code-coverage)
19+
- [Frontend](#frontend)
20+
- [Backend](#backend)
21+
- [Build](#build)
22+
- [Verify GitHub actions locally](#verify-github-actions-locally)
23+
- [Docs](#docs)
24+
25+
### Installation
26+
27+
To build mdadash from source,we highly recommend using virtual environments. If possible, we strongly recommend that you use [Anaconda](https://docs.conda.io/en/latest/) as your package manager. Below we provide instructions both for `conda` and for `pip`.
28+
29+
#### With conda
30+
31+
Ensure that you have [conda](https://docs.conda.io/projects/conda/en/latest/user-guide/install/index.html) installed.
32+
33+
Create a virtual environment and activate it:
34+
35+
```sh
36+
conda create --name mdadash
37+
conda activate mdadash
38+
```
39+
40+
Install the development, testing and documentation dependencies:
41+
42+
```sh
43+
conda env update --name mdadash --file devtools/conda-envs/dev_env.yaml
44+
conda env update --name mdadash --file devtools/conda-envs/test_env.yaml
45+
conda env update --name mdadash --file docs/requirements.yaml
46+
```
47+
48+
Build this package from source:
49+
50+
```sh
51+
pip install -e .
52+
```
53+
54+
If you want to update your dependencies (which can be risky!), run:
55+
56+
```sh
57+
conda update --all
58+
```
59+
60+
And when you are finished, you can exit the virtual environment with:
61+
62+
```sh
63+
conda deactivate
64+
```
65+
66+
#### With pip
67+
68+
To build the package from source, run:
69+
70+
```sh
71+
pip install .
72+
```
73+
74+
If you want to create a development environment, install
75+
the dependencies required for tests and docs with:
76+
77+
```sh
78+
pip install ".[dev,test,doc]"
79+
```
80+
81+
### Run
82+
83+
> The frontend code needs to be built before running the backend server. This can be done as follows:
84+
85+
```sh
86+
cd mdadash/frontend
87+
npm install
88+
npm run build
89+
```
90+
91+
To run the dashboard server:
92+
93+
```sh
94+
mdadash --topology <topology_filename> --trajectory <trajectory_url>
95+
```
96+
97+
To see the options available:
98+
99+
```sh
100+
mdadash --help
101+
```
102+
103+
### Develop
104+
105+
#### Frontend
106+
107+
Developer instructions for `frontend` code can be found [here](mdadash/frontend/README.md).
108+
109+
#### Backend
110+
111+
- Use the `editable` installation above (`pip install -e .`)
112+
113+
### Lint checks
114+
115+
#### Frontend
116+
117+
```sh
118+
npm run lint --prefix mdadash/frontend
119+
```
120+
121+
#### Backend
122+
123+
```sh
124+
ruff check
125+
```
126+
127+
### Tests
128+
129+
#### Frontend
130+
131+
```sh
132+
npm run test:unit --prefix mdadash/frontend -- --run
133+
```
134+
135+
#### Backend
136+
137+
```sh
138+
pytest -v
139+
```
140+
141+
### Code Coverage
142+
143+
#### Frontend
144+
145+
```sh
146+
cd mdadash/frontend
147+
npx vitest --run --coverage
148+
```
149+
150+
The coverage details will be shown on the console. Open `coverage/index.html` to view the interactive coverage report in the browser.
151+
152+
#### Backend
153+
154+
To see coverage output on the console:
155+
156+
```sh
157+
pytest -v --cov=mdadash
158+
```
159+
160+
To write coverage output to `html` file:
161+
162+
```sh
163+
pytest -v --cov=mdadash --cov-report=html
164+
```
165+
166+
Open `htmlcov/index.html` to view the coverage report in the browser.
167+
168+
### Build
169+
170+
To build this package:
171+
172+
```sh
173+
rm -rf mdadash.egg-info dist && python -m build
174+
```
175+
176+
To verify the created wheel in an isolated environment:
177+
178+
```sh
179+
uv run --refresh --with path.to.whl mdadash <options>
180+
```
181+
182+
To check the created distribution:
183+
184+
```sh
185+
twine check dist/*
186+
```
187+
188+
### Verify GitHub actions locally
189+
190+
GitHub actions can be verified locally using [act](https://github.com/nektos/act).
191+
192+
> Note that this requires [Docker](https://www.docker.com). Running on Mac needs an additional param `--container-architecture linux/arm64`. To bypass the repo name check, you can pass `--env GITHUB_REPOSITORY=MDAnalysis/mdadash`. Both these can be set in `~/.actrc` as well.
193+
194+
To list the jobs:
195+
196+
```sh
197+
act -l
198+
```
199+
200+
To run a job (eg: `pylint_check`):
201+
202+
```sh
203+
act -j pylint_check
204+
```
205+
206+
To run all jobs:
207+
208+
```sh
209+
act
210+
```
211+
212+
### Docs
213+
214+
Setting up the docs environment:
215+
216+
```sh
217+
conda env update --name mdadash --file docs/requirements.yaml
218+
```
219+
220+
Building docs locally:
221+
222+
```sh
223+
cd docs
224+
make clean && make html
225+
```
226+
227+
Open `docs/_build/html/index.html` to view the docs in the browser.

0 commit comments

Comments
 (0)