diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8bddc2a..a9e3901 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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 \ No newline at end of file diff --git a/README.md b/README.md index 8dbc9e1..d82a37c 100644 --- a/README.md +++ b/README.md @@ -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 +conda activate +``` + +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 @@ -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)). \ No newline at end of file +there is also a autamtated test pipeline that runs the tests on every push to the repository (see [here](.github/workflows/ci.yml)). diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..dff9a72 --- /dev/null +++ b/pyproject.toml @@ -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 = "mbalmus@turing.ac.uk"} +] + +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"] diff --git a/requirements.txt b/requirements.txt deleted file mode 100644 index ac54e19..0000000 --- a/requirements.txt +++ /dev/null @@ -1,8 +0,0 @@ -matplotlib==3.8.2 -numba==0.59.0 -numpy==1.26.4 -pandas==2.2.1 -pandera==0.22.1 -scipy==1.12.0 -joblib==1.4.2 -tdqm==0.0.1 diff --git a/setup.py b/setup.py deleted file mode 100755 index f564f32..0000000 --- a/setup.py +++ /dev/null @@ -1,50 +0,0 @@ -#!/usr/bin/env python3 -import os - -from setuptools import setup, find_packages - - -here = os.path.abspath(os.path.dirname(__file__)) -home_page = 'https://github.com/alan-turing-institute/ModularCirc' - -def read_requirements(file_name): - reqs = [] - with open(os.path.join(here, file_name)) as in_f: - for line in in_f: - line = line.strip() - if not line or line.startswith('#') or line.startswith('-'): - continue - reqs.append(line) - return reqs - - -with open(os.path.join(here, 'README.md')) as f: - readme = f.read() - -setup( - name='ModularCirc', - version='0.1.1', - url=here, - author='Maximilian Balmus', - author_email='mbalmus@turing.ac.uk', - license='MIT License', - description='A python package for creating and running 0D models of the cardiovascular system', - long_description=readme, - packages=find_packages(), - install_requires=read_requirements('requirements.txt'), - python_requires='>3.8', - project_urls={ - "Bug Tracker": os.path.join(home_page, 'issues'), - "Source Code": home_page, - }, - extras_require={ - "dev" : read_requirements('requirements.txt') - }, - classifiers=[ - 'Development Status :: 3 - Alpha', - 'Environemnt :: Console', - 'Intended Audience :: Researchers', - 'Operating System :: OS Independent', - 'Programming Language :: Python :: 3.10' - ] -) \ No newline at end of file