-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #81 from ucl-cssb/Fontanapink/issue78
Update testing workflow and dependencies
- Loading branch information
Showing
12 changed files
with
585 additions
and
113 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,25 +7,31 @@ on: | |
jobs: | ||
build-docs: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Install pandoc | ||
run: sudo apt-get -y install pandoc | ||
|
||
- name: Set up Python | ||
uses: actions/setup-[email protected] | ||
- name: Set up Conda | ||
uses: conda-incubator/setup-miniconda@v2 | ||
with: | ||
python-version: '3.11' | ||
cache: 'pip' | ||
auto-update-conda: true | ||
python-version: "3.10" | ||
|
||
- name: Create mimic_env from environment.yml | ||
run: conda env create -f environment.yml | ||
|
||
- name: Install documentation dependencies | ||
- name: Activate mimic_env | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install sphinx sphinx-rtd-theme nbsphinx ipykernel furo sphinx-autoapi recommonmark | ||
eval "$(conda shell.bash hook)" | ||
conda activate mimic_env | ||
- name: Install project dependencies | ||
run: pip install -r requirements.txt | ||
- name: Install Documentation Dependencies | ||
run: | | ||
# Installing additional dependencies not in environment.yml | ||
conda install sphinx sphinx-rtd-theme nbsphinx ipykernel furo sphinx-autoapi recommonmark | ||
- name: Generate API documentation | ||
run: sphinx-apidoc -o docs/source/ ./ setup.py | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,7 +17,7 @@ jobs: | |
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
fetch-depth: 0 | ||
|
||
- name: Set up Git | ||
run: | | ||
if [ "${{ github.event_name }}" = "pull_request" ] | ||
|
@@ -28,25 +28,43 @@ jobs: | |
fi | ||
git checkout $BRANCH_NAME | ||
- name: Set up Python | ||
uses: actions/setup-python@v2 | ||
# Set up Conda | ||
- name: Set up Conda | ||
uses: conda-incubator/setup-miniconda@v2 | ||
with: | ||
auto-update-conda: true | ||
python-version: "3.10" | ||
miniconda-version: "latest" | ||
|
||
- name: Install autopep8 | ||
run: python -m pip install autopep8 | ||
|
||
- name: Format code with autopep8 | ||
run: autopep8 --in-place --aggressive --aggressive --recursive mimic/ | ||
|
||
|
||
# Create mimic_env from environment.yml | ||
- name: Create mimic_env from environment.yml | ||
run: conda env create -f environment.yml | ||
|
||
- name: Install pip-tools | ||
run: python -m pip install pip-tools | ||
# Activate mimic_env and install autopep8 | ||
- name: Activate mimic_env and install autopep8 | ||
shell: bash -l {0} | ||
run: | | ||
eval "$(conda shell.bash hook)" | ||
conda activate mimic_env | ||
conda install autopep8 | ||
- name: Compile requirements.txt | ||
run: pip-compile --output-file requirements.txt requirements.in | ||
- name: Format code with autopep8 | ||
shell: bash -l {0} | ||
run: | | ||
eval "$(conda shell.bash hook)" | ||
conda activate mimic_env | ||
autopep8 --in-place --aggressive --aggressive --recursive mimic/ | ||
# Activate mimic_env, install pip-tools, and compile requirements.txt | ||
- name: Install pip-tools and compile requirements.txt | ||
shell: bash -l {0} | ||
run: | | ||
eval "$(conda shell.bash hook)" | ||
conda activate mimic_env | ||
pip install pip-tools | ||
pip-compile --output-file requirements.txt requirements.in | ||
# Commit changes to the repository | ||
- name: Commit changes | ||
run: | | ||
git config --global user.email "[email protected]" | ||
|
@@ -62,7 +80,7 @@ jobs: | |
name: requirements | ||
path: requirements.txt | ||
|
||
build: | ||
compatibility-check: | ||
needs: update-requirements | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
|
@@ -79,26 +97,29 @@ jobs: | |
with: | ||
name: requirements | ||
|
||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v2 | ||
- name: Set up Conda | ||
uses: conda-incubator/setup-miniconda@v2 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
|
||
- name: Cache Python dependencies | ||
uses: actions/cache@v2 | ||
with: | ||
path: ~/.cache/pip | ||
key: ${{ runner.os }}-pip-${{ hashFiles('requirements.txt') }} | ||
restore-keys: | | ||
${{ runner.os }}-pip- | ||
auto-update-conda: true | ||
python-version: "3.10" | ||
miniconda-version: "latest" | ||
|
||
- name: Install dependencies | ||
shell: bash | ||
# Create mimic_env from environment.yml, with adjustments for Windows compatibility | ||
- name: Create mimic_env from environment file | ||
shell: bash -l {0} | ||
run: | | ||
python -m pip install --upgrade pip | ||
python -m pip install flake8 mypy pytest | ||
if [ -f requirements.txt ]; then | ||
python -m pip install -r requirements.txt | ||
eval "$(conda shell.bash hook)" | ||
if [[ "${{ matrix.os }}" == "windows-latest" ]]; then | ||
conda env create -f environment_windows.yml | ||
else | ||
echo "No requirements.txt found" | ||
fi | ||
conda env create -f environment.yml | ||
fi | ||
# Activate mimic_env and install the package for compatibility check | ||
- name: Install dependencies for compatibility check | ||
shell: bash -l {0} | ||
run: | | ||
eval "$(conda shell.bash hook)" | ||
conda activate mimic_env | ||
pip install -e . |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
name: Test and Coverage | ||
|
||
on: | ||
push: | ||
branches: [ master ] | ||
pull_request: | ||
branches: [ master ] | ||
|
||
jobs: | ||
test-and-coverage: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
# Checkout the repository | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
|
||
# Set up Conda and create the environment from environment.yml | ||
- name: Set up Conda | ||
uses: conda-incubator/setup-miniconda@v2 | ||
with: | ||
auto-update-conda: true | ||
python-version: "3.10" | ||
|
||
- name: Create mimic_env from environment.yml | ||
run: conda env create -f environment.yml | ||
|
||
- name: Activate mimic_env | ||
run: | | ||
eval "$(conda shell.bash hook)" | ||
conda activate mimic_env | ||
# Activate the Conda environment and install the package in editable mode | ||
- name: Install Your Package | ||
shell: bash -l {0} | ||
run: | | ||
eval "$(conda shell.bash hook)" | ||
conda activate mimic_env | ||
pip install -e . | ||
# Run tests with coverage reporting | ||
- name: Run tests with coverage | ||
shell: bash -l {0} | ||
run: | | ||
eval "$(conda shell.bash hook)" | ||
conda activate mimic_env | ||
pytest --cov=mimic --cov-report=xml --cov-report=html | ||
# Upload the coverage report as an artifact | ||
- name: Upload coverage report | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: coverage-report | ||
path: htmlcov |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,7 +14,7 @@ MICrobiomes Project* (MIMIC) introduces a Python package designed to advance the | |
simulation, inference, and prediction of microbial community interactions and dynamics. | ||
Addressing the complex nature of microbial ecosystems, MIMIC integrates a suite of | ||
mathematical models, including previously used approaches such as *Generalized Lotka- | ||
Volterra* (gLV), *Gaussian Processes* (GP), and *Vector Autoregression* (VAR) plus | ||
Volterra* (gLV), *Gaussian Processes* (GP), and *Vector Autoregression* (VAR), plus | ||
newly developed models for integrating multiomic data, to offer a comprehensive | ||
framework for analysing microbial dynamics. By leveraging Bayesian inference and | ||
machine learning techniques, MIMIC accurately infers the dynamics of microbial | ||
|
@@ -28,7 +28,6 @@ microbial ecology and microbiome research. This software package contributes to | |
microbial ecology research and supports ecological predictions and applications, | ||
benefiting the scientific and applied microbiology communities. | ||
|
||
|
||
Structure | ||
----------- | ||
|
||
|
@@ -43,7 +42,10 @@ The repository is organized into the following main directories: | |
- `LICENSE`: The license for the project. | ||
- `mimic/`: The main directory for the project's source code. | ||
- `README.rst`: The main README file for the project, providing an overview and basic usage examples. | ||
- `requirements.txt`: A list of Python dependencies required to run the project. | ||
- `environment.yml`: The Conda environment file for macOS and Ubuntu. | ||
- `environment_windows.yml`: The Conda environment file for Windows. | ||
- `requirements.in`: The pip requirements input file. | ||
- `requirements.txt`: The compiled list of Python dependencies. | ||
- `setup.py`: The build script for the project. | ||
- `tests/`: Contains unit tests for the project's code. | ||
|
||
|
@@ -52,35 +54,93 @@ Installation | |
|
||
Prerequisites | ||
^^^^^^^^^^^^^ | ||
Conda package manager is recommended due to dependencies on PyMC. | ||
|
||
Python Packages | ||
"""""""""""""""" | ||
The Python packages needed to run this package are listed in the requirements.txt file in the same workspace. To install them, run: | ||
- **Conda Package Manager**: We recommend using Conda to manage the environment due to dependencies that may not be available via pip. | ||
|
||
.. code-block:: bash | ||
Installation Steps | ||
^^^^^^^^^^^^^^^^^^^ | ||
|
||
pip install -r requirements.txt | ||
### For macOS and Ubuntu | ||
|
||
Compilers | ||
"""""""""" | ||
* g++ compiler is needed for the PyMC3 package. | ||
1. **Clone the Repository** | ||
|
||
.. code-block:: bash | ||
git clone https://github.com/yourusername/yourrepository.git | ||
cd yourrepository | ||
2. **Create the Conda Environment** | ||
|
||
.. code-block:: bash | ||
conda env create -f environment.yml | ||
3. **Activate the Environment** | ||
|
||
.. code-block:: bash | ||
conda activate mimic_env | ||
4. **Install the Package** | ||
|
||
.. code-block:: bash | ||
pip install -e . | ||
5. **Run the Code** | ||
|
||
Refer to the `Usage`_ section below for instructions on how to run the code. | ||
|
||
### For Windows | ||
|
||
1. **Clone the Repository** | ||
|
||
.. code-block:: bash | ||
git clone https://github.com/yourusername/yourrepository.git | ||
cd yourrepository | ||
.. Solvers | ||
.. """""""" | ||
.. * Solver 1 | ||
.. * Solver 2 | ||
2. **Create the Conda Environment for Windows** | ||
|
||
Steps | ||
^^^^^ | ||
On Windows, use the `environment_windows.yml` file: | ||
|
||
#. Clone the repository. | ||
#. Create a new conda environment using the `environment.yml` file. | ||
#. Activate the new environment. | ||
#. Install required packages using `pip install -r requirements.txt` from the root directory of the repository. | ||
#. Install the package using `pip install -e .` from the root directory of the repository. | ||
#. Run the code using the instructions below. | ||
#. Deactivate the environment when finished. | ||
.. code-block:: bash | ||
conda env create -f environment_windows.yml | ||
3. **Activate the Environment** | ||
|
||
.. code-block:: bash | ||
conda activate mimic_env_windows | ||
4. **Install the Package** | ||
|
||
Install the package in editable mode: | ||
|
||
.. code-block:: bash | ||
pip install -e . | ||
5. **Run the Code** | ||
|
||
Refer to the `Usage`_ section below for instructions on how to run the code. | ||
|
||
Alternative Installation Using Pip Only | ||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
|
||
If you prefer to use pip without Conda, you can install the package and its dependencies using `requirements.txt`: | ||
|
||
.. code-block:: bash | ||
pip install -r requirements.txt | ||
pip install -e . | ||
**Note**: This method may not install all dependencies correctly, especially if there are packages that are only available via Conda. We recommend using the Conda installation method for full functionality. | ||
|
||
Compilers | ||
""""""""""" | ||
A g++ compiler is required for the PyMC3 package. | ||
|
||
Usage | ||
------- | ||
|
@@ -92,7 +152,6 @@ To get started with MIMIC, you can explore a variety of detailed examples and co | |
|
||
The documentation is regularly updated with the latest information on usage, features, and examples to help you effectively utilize the MIMIC package in your research or applications. | ||
|
||
|
||
Contributing | ||
------------- | ||
|
||
|
@@ -104,12 +163,11 @@ License | |
This project is licensed under the `LICENSE <LICENSE>`_. | ||
|
||
Acknowledgements | ||
------------------ | ||
----------------- | ||
|
||
This project is based on methods proposed in `this paper <https://onlinelibrary.wiley.com/doi/full/10.1002/bies.201600188>`_. | ||
|
||
Contact | ||
-------- | ||
|
||
For questions or feedback, please `contact us <mailto:[email protected]>`_. | ||
|
Oops, something went wrong.