Skip to content

Commit

Permalink
Merge pull request #16 from alan-turing-institute/13-clarifying-envir…
Browse files Browse the repository at this point in the history
…onment-setup-in-readme

13 clarifying environment setup in readme
  • Loading branch information
MaxBalmus authored Feb 7, 2025
2 parents a492779 + 6ecf4c6 commit 28002af
Show file tree
Hide file tree
Showing 5 changed files with 130 additions and 68 deletions.
61 changes: 53 additions & 8 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,31 +4,76 @@ on:
push:
branches:
- main
- tests_ci
- dev
pull_request:
branches:
- main
- tests_ci
- dev

jobs:
build:

build-conda:
name: Conda environment
runs-on: "ubuntu-latest"
defaults:
run:
shell: bash -el {0}
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Create environment.yml
run: |
echo "name: myenv" > environment.yml
echo "channels:" >> environment.yml
echo " - conda-forge" >> environment.yml
echo " - defaults" >> environment.yml
echo "dependencies:" >> environment.yml
echo " - pip" >> environment.yml
- name: Set up Conda
uses: conda-incubator/setup-miniconda@v3
with:
activate-environment: myenv
environment-file: environment.yml
python-version: '3.10'
auto-activate-base: false

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools --upgrade
pip install ./
- name: Run tests
run: |
python -m unittest discover -s tests
build-venv:
name: Python virtual environment
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.x'
python-version: '3.10'

- name: Set up environment
run: |
python -m venv venv
source venv/bin/activate
- name: Install dependencies
run: |
source venv/bin/activate
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install ./
- name: Run tests
run: |
python -m unittest discover -s tests
source venv/bin/activate
python -m unittest discover -s tests
43 changes: 41 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,50 @@ The scope of this package is to provide a framework for building **0D models** a
2. **Valves**
3. **Vessels**

## Clone the ModularCirc GitHub repo locally

Run:

```
git clone https://github.com/alan-turing-institute/ModularCirc
cd ModularCirc
```

## Setup Conda or python virtual environment

Before installation of the ModularCirc package, please setup a virtual environment using either Conda or python virtual environment.

### Conda setup

Install Conda from https://docs.conda.io/projects/conda/en/stable/user-guide/install/index.html

Run:

```
conda create --name <yourenvname>
conda activate <yourenvname>
```

Proceed to installing the ModularCirc package.

### Python virtual environment setup

Run `python3 -m venv venv`. This creates a virtual environment called `venv` in your base directory.

Activate the python environment: `source venv/bin/activate`

Proceed to installing the ModularCirc package.

## Installation

From the repo directory, run:

```bash
pip install git+https://github.com/alan-turing-institute/ModularCirc.git
pip install ./
```

This will install the package based on the `pyproject.toml` file specifications.

## Steps for running basic models
1. Load the classes for the model of interest and the parameter object used to paramterise the said model:
```python
Expand Down Expand Up @@ -76,4 +115,4 @@ You can run locally the tests by running the following command:
```bash
python -m unittest discover -s tests
```
there is also a autamtated test pipeline that runs the tests on every push to the repository (see [here](.github/workflows/ci.yml)).
there is also a autamtated test pipeline that runs the tests on every push to the repository (see [here](.github/workflows/ci.yml)).
36 changes: 36 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
[build-system]
requires = ["setuptools>=42", "wheel"]
build-backend = "setuptools.build_meta"

[project]
name = "ModularCirc"
version = "0.1.1"
description = "A python package for creating and running 0D models of the cardiovascular system"
readme = "README.md"
requires-python = ">=3.10"
license = {text = "MIT" }
authors = [
{name = "Maximilian Balmus", email = "[email protected]"}
]

dependencies = [
"matplotlib",
"numba",
"numpy",
"pandas",
"scipy",
"joblib",
"pandera",
"tdqm"
]

[project.optional-dependencies]
notebooks = ["ipykernel"]

[project.urls]
"Homepage" = "https://github.com/alan-turing-institute/ModularCirc"
"Source Code" = "https://github.com/alan-turing-institute/ModularCirc"
"Bug Tracker" = "https://github.com/alan-turing-institute/ModularCirc/issues"

[tool.setuptools]
packages = ["ModularCirc"]
8 changes: 0 additions & 8 deletions requirements.txt

This file was deleted.

50 changes: 0 additions & 50 deletions setup.py

This file was deleted.

0 comments on commit 28002af

Please sign in to comment.