Skip to content

Commit 28002af

Browse files
authored
Merge pull request #16 from alan-turing-institute/13-clarifying-environment-setup-in-readme
13 clarifying environment setup in readme
2 parents a492779 + 6ecf4c6 commit 28002af

File tree

5 files changed

+130
-68
lines changed

5 files changed

+130
-68
lines changed

.github/workflows/ci.yml

Lines changed: 53 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,31 +4,76 @@ on:
44
push:
55
branches:
66
- main
7-
- tests_ci
7+
- dev
88
pull_request:
99
branches:
1010
- main
11-
- tests_ci
11+
- dev
1212

1313
jobs:
14-
build:
14+
15+
build-conda:
16+
name: Conda environment
17+
runs-on: "ubuntu-latest"
18+
defaults:
19+
run:
20+
shell: bash -el {0}
21+
steps:
22+
- name: Checkout code
23+
uses: actions/checkout@v4
24+
25+
- name: Create environment.yml
26+
run: |
27+
echo "name: myenv" > environment.yml
28+
echo "channels:" >> environment.yml
29+
echo " - conda-forge" >> environment.yml
30+
echo " - defaults" >> environment.yml
31+
echo "dependencies:" >> environment.yml
32+
echo " - pip" >> environment.yml
33+
34+
- name: Set up Conda
35+
uses: conda-incubator/setup-miniconda@v3
36+
with:
37+
activate-environment: myenv
38+
environment-file: environment.yml
39+
python-version: '3.10'
40+
auto-activate-base: false
41+
42+
- name: Install dependencies
43+
run: |
44+
python -m pip install --upgrade pip
45+
pip install setuptools --upgrade
46+
pip install ./
47+
48+
- name: Run tests
49+
run: |
50+
python -m unittest discover -s tests
51+
52+
build-venv:
53+
name: Python virtual environment
1554
runs-on: ubuntu-latest
1655

1756
steps:
1857
- name: Checkout code
19-
uses: actions/checkout@v3
58+
uses: actions/checkout@v4
2059

2160
- name: Set up Python
2261
uses: actions/setup-python@v4
2362
with:
24-
python-version: '3.x'
63+
python-version: '3.10'
64+
65+
- name: Set up environment
66+
run: |
67+
python -m venv venv
68+
source venv/bin/activate
2569
2670
- name: Install dependencies
2771
run: |
72+
source venv/bin/activate
2873
python -m pip install --upgrade pip
29-
pip install -r requirements.txt
74+
pip install ./
3075
3176
- name: Run tests
3277
run: |
33-
python -m unittest discover -s tests
34-
78+
source venv/bin/activate
79+
python -m unittest discover -s tests

README.md

Lines changed: 41 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,50 @@ The scope of this package is to provide a framework for building **0D models** a
55
2. **Valves**
66
3. **Vessels**
77

8+
## Clone the ModularCirc GitHub repo locally
9+
10+
Run:
11+
12+
```
13+
git clone https://github.com/alan-turing-institute/ModularCirc
14+
cd ModularCirc
15+
```
16+
17+
## Setup Conda or python virtual environment
18+
19+
Before installation of the ModularCirc package, please setup a virtual environment using either Conda or python virtual environment.
20+
21+
### Conda setup
22+
23+
Install Conda from https://docs.conda.io/projects/conda/en/stable/user-guide/install/index.html
24+
25+
Run:
26+
27+
```
28+
conda create --name <yourenvname>
29+
conda activate <yourenvname>
30+
```
31+
32+
Proceed to installing the ModularCirc package.
33+
34+
### Python virtual environment setup
35+
36+
Run `python3 -m venv venv`. This creates a virtual environment called `venv` in your base directory.
37+
38+
Activate the python environment: `source venv/bin/activate`
39+
40+
Proceed to installing the ModularCirc package.
41+
842
## Installation
43+
44+
From the repo directory, run:
45+
946
```bash
10-
pip install git+https://github.com/alan-turing-institute/ModularCirc.git
47+
pip install ./
1148
```
1249

50+
This will install the package based on the `pyproject.toml` file specifications.
51+
1352
## Steps for running basic models
1453
1. Load the classes for the model of interest and the parameter object used to paramterise the said model:
1554
```python
@@ -76,4 +115,4 @@ You can run locally the tests by running the following command:
76115
```bash
77116
python -m unittest discover -s tests
78117
```
79-
there is also a autamtated test pipeline that runs the tests on every push to the repository (see [here](.github/workflows/ci.yml)).
118+
there is also a autamtated test pipeline that runs the tests on every push to the repository (see [here](.github/workflows/ci.yml)).

pyproject.toml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
[build-system]
2+
requires = ["setuptools>=42", "wheel"]
3+
build-backend = "setuptools.build_meta"
4+
5+
[project]
6+
name = "ModularCirc"
7+
version = "0.1.1"
8+
description = "A python package for creating and running 0D models of the cardiovascular system"
9+
readme = "README.md"
10+
requires-python = ">=3.10"
11+
license = {text = "MIT" }
12+
authors = [
13+
{name = "Maximilian Balmus", email = "[email protected]"}
14+
]
15+
16+
dependencies = [
17+
"matplotlib",
18+
"numba",
19+
"numpy",
20+
"pandas",
21+
"scipy",
22+
"joblib",
23+
"pandera",
24+
"tdqm"
25+
]
26+
27+
[project.optional-dependencies]
28+
notebooks = ["ipykernel"]
29+
30+
[project.urls]
31+
"Homepage" = "https://github.com/alan-turing-institute/ModularCirc"
32+
"Source Code" = "https://github.com/alan-turing-institute/ModularCirc"
33+
"Bug Tracker" = "https://github.com/alan-turing-institute/ModularCirc/issues"
34+
35+
[tool.setuptools]
36+
packages = ["ModularCirc"]

requirements.txt

Lines changed: 0 additions & 8 deletions
This file was deleted.

setup.py

Lines changed: 0 additions & 50 deletions
This file was deleted.

0 commit comments

Comments
 (0)