Skip to content

Commit

Permalink
Merge pull request #3 from artificial-life-lab/env-test
Browse files Browse the repository at this point in the history
Version locked dependencies requirements file
  • Loading branch information
pranjaldhole authored Nov 13, 2024
2 parents a964a35 + 0b6a0e6 commit c59fd0e
Show file tree
Hide file tree
Showing 7 changed files with 52 additions and 32 deletions.
17 changes: 3 additions & 14 deletions .github/workflows/test_and_deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ jobs:
runs-on: ${{ matrix.platform }}
strategy:
matrix:
platform: [ubuntu-latest, windows-latest, macos-latest]
python-version: [3.7, 3.8]
platform: [ubuntu-latest]
python-version: [3.10.12]

steps:
- uses: actions/checkout@v2
Expand All @@ -42,17 +42,6 @@ jobs:
libxcb-image0 libxcb-keysyms1 libxcb-randr0 libxcb-render-util0 \
libxcb-xinerama0 libxcb-xinput0 libxcb-xfixes0
# strategy borrowed from vispy for installing opengl libs on windows
- name: Install Windows OpenGL
if: runner.os == 'Windows'
run: |
git clone --depth 1 git://github.com/pyvista/gl-ci-helpers.git
powershell gl-ci-helpers/appveyor/install_opengl.ps1
# note: if you need dependencies from conda, considering using
# setup-miniconda: https://github.com/conda-incubator/setup-miniconda
# and
# tox-conda: https://github.com/tox-dev/tox-conda
- name: Install dependencies
run: |
python -m pip install --upgrade pip
Expand All @@ -79,7 +68,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: "3.x"
python-version: "3.xx.xx"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
Expand Down
13 changes: 9 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,15 @@ Library to conduct experiements on population dynamics.

## Installation

- To generate required log and results directories, run
- To generate required log and results directories and setup virtual environment, run

```(bash)
bash init.sh
```
This step needs to be performed only once to set up your work space.

- Alternatively, you can create virtual environment manually as follows:

- Create virtual environment
```bash
mkdir -p ~/venvs/population-dynamics
python3 -m venv ~/venvs/population-dynamics
Expand All @@ -36,8 +38,10 @@ pip install --upgrade pip setuptools
```bash
pip install -r requirements.txt
```
Alternatively, there exists `requirements_lock.txt` to get a version of the environment that is tested by us in terms of dependencies. The downside of using this file to installing dependencies is that you might not get all the latest version of packages.
In case, if either or the files do not setup the environment successfully, please raise an issue.

- Install `causal_inference` as a package within the environment
- Install `causal_inference` as a package within the environment in development setting if you want to use the repo in the development mode by running the following line

```(bash)
python setup.py develop
Expand All @@ -54,5 +58,6 @@ You can edit the `config.py` file directly to play around with the parameter val
```(bash)
python causal_inference/base/lv_simulator.py
```
This will take all the default arguments and configuration to run a simulation instance of lotka-volterra population dynamics.

- The simulation statistics will be saved in the `repo/results` directory.
- The simulation statistics will be saved in the `repo/results` directory by default.
4 changes: 2 additions & 2 deletions causal_inference/tests/test_lv_simulator.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env python3
# flake8: noqa
from causal_inference import LotkaVolterra
from causal_inference import LV_PARAMS
from causal_inference.base.lv_system import LotkaVolterra
from causal_inference.config import LV_PARAMS

def test_lotka_volterra():
model = LotkaVolterra()
Expand Down
6 changes: 5 additions & 1 deletion init.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
#!/bin/bash

# Create folders for logging results
# Create folders for virtual environment and logging results
mkdir -p results
mkdir -p .venv

# Create Virtual env
python3 -m venv .venv
3 changes: 2 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
numpy
h5py
matplotlib
matplotlib
scipy
28 changes: 28 additions & 0 deletions requirements_lock.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
autocommand==2.2.2
backports.tarfile==1.2.0
-e git+ssh://git@github.com/artificial-life-lab/population-dynamics.git@a964a35de85d47c6e39550c87d552a4ffe73d200#egg=causal_inference_population_dynamics
contourpy==1.3.1
cycler==0.12.1
fonttools==4.54.1
h5py==3.12.1
importlib_metadata==8.0.0
inflect==7.3.1
jaraco.collections==5.1.0
jaraco.context==5.3.0
jaraco.functools==4.0.1
jaraco.text==3.12.1
kiwisolver==1.4.7
matplotlib==3.9.2
more-itertools==10.3.0
numpy==2.1.3
packaging==24.2
pillow==11.0.0
platformdirs==4.2.2
pyparsing==3.2.0
python-dateutil==2.9.0.post0
scipy==1.14.1
six==1.16.0
tomli==2.0.1
typeguard==4.3.0
typing_extensions==4.12.2
zipp==3.19.2
13 changes: 3 additions & 10 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,28 +1,21 @@
# For more information about tox, see https://tox.readthedocs.io/en/latest/
[tox]
envlist = py{37,38,39}-{linux,macos,windows}
envlist = py{310}-{linux}

[gh-actions]
python =
3.7: py37
3.8: py38
3.9: py39
3.10.12: py310

[gh-actions:env]
PLATFORM =
ubuntu-latest: linux
macos-latest: macos
windows-latest: windows

[testenv]
platform =
macos: darwin
platform =
linux: linux
windows: win32
passenv =
CI
GITHUB_ACTIONS
DISPLAY XAUTHORITY
NUMPY_EXPERIMENTAL_ARRAY_FUNCTION
PYVISTA_OFF_SCREEN
deps =
Expand Down

0 comments on commit c59fd0e

Please sign in to comment.