Skip to content

Commit

Permalink
Merge pull request #266 from CovertLab/tweaks
Browse files Browse the repository at this point in the history
Miscellaneous
  • Loading branch information
thalassemia authored Dec 12, 2024
2 parents baa8e8e + 563235c commit 959462c
Show file tree
Hide file tree
Showing 70 changed files with 4,392 additions and 1,159 deletions.
2 changes: 2 additions & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Greatly improves performance and reproducibility
OMP_NUM_THREADS=1
8 changes: 8 additions & 0 deletions .gcloudignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!include:.gitignore
notebooks
data
reconstruction/sim_data
reconstruction/ecoli/scripts
.git
.github
doc
22 changes: 9 additions & 13 deletions .github/workflows/docs_deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,23 +9,19 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Setup Python
uses: actions/setup-python@v2
- name: Install uv
uses: astral-sh/setup-uv@v4
with:
python-version: "3.11"
- name: Install dependencies
run: |
sudo apt-get install pandoc
python -m pip install --upgrade pip wheel
pip install numpy==1.26.4
pip install -r doc/requirements.txt
- name: Compile Cython components
run: |
make compile
enable-cache: true
version: "0.5.7"
- name: Install Pandoc
run: sudo apt-get install pandoc
- name: Install model
run: USE_CYTHON=1 uv sync --frozen --extra docs
- name: Build documentation
run: |
cd doc
make html
uv run make html
- name: Deploy documentation to GitHub pages
run: |
cd doc/_build/html
Expand Down
22 changes: 9 additions & 13 deletions .github/workflows/docs_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,16 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Setup Python
uses: actions/setup-python@v2
- name: Install uv
uses: astral-sh/setup-uv@v4
with:
python-version: "3.11"
- name: Install dependencies
run: |
sudo apt-get install pandoc
python -m pip install --upgrade pip wheel
pip install numpy==1.26.4
pip install -r doc/requirements.txt
- name: Compile Cython components
run: |
make compile
enable-cache: true
version: "0.5.7"
- name: Install Pandoc
run: sudo apt-get install pandoc
- name: Install model
run: USE_CYTHON=1 uv sync --frozen --extra docs
- name: Build documentation
run: |
cd doc
make html
uv run make html
65 changes: 19 additions & 46 deletions .github/workflows/pr_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,6 @@

name: Workflow

# Improves reproducibility and speed
env:
OPENBLAS_NUM_THREADS: 1
OMP_NUM_THREADS: 1

on:
push:
branches: [master]
Expand All @@ -16,72 +11,50 @@ on:
jobs:
Reproducibility:
runs-on: macos-latest
strategy:
matrix:
python-version: ["3.11"]
steps:
- uses: actions/checkout@v2
- name: Setup Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
- name: Install uv
uses: astral-sh/setup-uv@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
pip install --upgrade pip wheel
pip install numpy==1.26.4
pip install -r requirements.txt
- name: Compile Cython components
run: |
make clean compile
- name: Set PYTHONPATH
run: |
echo "PYTHONPATH=." >> $GITHUB_ENV
enable-cache: true
version: "0.5.7"
- name: Install model
run: USE_CYTHON=1 uv sync --frozen
- name: Test ParCa reproducibility
run: |
python runscripts/parca.py --config ecoli/composites/ecoli_configs/run_parca.json \
uv run --env-file .env runscripts/parca.py --config ecoli/composites/ecoli_configs/run_parca.json \
-c 3 -o out/parca_1
python runscripts/parca.py --config ecoli/composites/ecoli_configs/run_parca.json \
uv run --env-file .env runscripts/parca.py --config ecoli/composites/ecoli_configs/run_parca.json \
-c 3 -o out/parca_2
python runscripts/debug/compare_pickles.py out/parca_1/kb out/parca_2/kb
uv run --env-file .env runscripts/debug/compare_pickles.py out/parca_1/kb out/parca_2/kb
- name: Test simulation reproducibility
run: |
python ecoli/experiments/ecoli_master_sim.py \
uv run --env-file .env ecoli/experiments/ecoli_master_sim.py \
--generations 1 --emitter parquet --emitter_arg out_dir='out' \
--experiment_id "parca_1" --daughter_outdir "out/parca_1" \
--sim_data_path "out/parca_1/kb/simData.cPickle" --fail_at_total_time &
python ecoli/experiments/ecoli_master_sim.py \
uv run --env-file .env ecoli/experiments/ecoli_master_sim.py \
--generations 1 --emitter parquet --emitter_arg out_dir='out' \
--experiment_id "parca_2" --daughter_outdir "out/parca_2" \
--sim_data_path "out/parca_2/kb/simData.cPickle" --fail_at_total_time
python runscripts/debug/diff_simouts.py -o "out" "parca_1*" "parca_2*"
uv run --env-file .env runscripts/debug/diff_simouts.py -o "out" "parca_1*" "parca_2*"
Two-gens:
runs-on: macos-latest
strategy:
matrix:
python-version: ["3.11"]
steps:
- uses: actions/checkout@v2
- name: Setup Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
- name: Install uv
uses: astral-sh/setup-uv@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
pip install --upgrade pip wheel
pip install numpy==1.26.4 mypy
pip install -r requirements.txt
enable-cache: true
version: "0.5.7"
- name: Install model
run: USE_CYTHON=1 uv sync --frozen
- name: Install nextflow edge
run: |
curl -s https://get.nextflow.io | bash
chmod +x nextflow
echo "PATH=.:$PATH" >> $GITHUB_ENV
NXF_EDGE=1 ./nextflow self-update
- name: Compile Cython components
run: |
make clean compile
- name: Set PYTHONPATH
run: |
echo "PYTHONPATH=." >> $GITHUB_ENV
- name: Two generations
run: |
python runscripts/workflow.py --config ecoli/composites/ecoli_configs/two_generations.json
uv run --env-file .env runscripts/workflow.py --config ecoli/composites/ecoli_configs/two_generations.json
71 changes: 21 additions & 50 deletions .github/workflows/pytest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,6 @@

name: QA

# Improves reproducibility and speed
env:
OPENBLAS_NUM_THREADS: 1
OMP_NUM_THREADS: 1

on:
push:
branches: [master]
Expand All @@ -16,26 +11,18 @@ on:
jobs:
Pytest:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.11"]
steps:
- uses: actions/checkout@v2
- name: Setup Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
- name: Install uv
uses: astral-sh/setup-uv@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
pip install --upgrade pip wheel
pip install numpy==1.26.4
pip install -r requirements.txt
- name: Compile Cython components
run: |
make clean compile
enable-cache: true
version: "0.5.7"
- name: Install model
run: USE_CYTHON=1 uv sync --frozen --extra dev
- name: Test with pytest
run: |
python -m pytest --cov-report xml:cov.xml --cov=ecoli --cov=reconstruction --cov=wholecell --cov=runscripts --durations=0
uv run --env-file .env pytest --cov-report xml:cov.xml --cov=ecoli --cov=reconstruction --cov=wholecell --cov=runscripts --durations=0
- name: Code Coverage Report
uses: irongut/[email protected]
with:
Expand All @@ -51,45 +38,29 @@ jobs:
path: code-coverage-results.md
Mypy:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.11"]
steps:
- uses: actions/checkout@v2
- name: Setup Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
- name: Install uv
uses: astral-sh/setup-uv@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
pip install --upgrade pip wheel
pip install numpy==1.26.4 mypy
pip install -r requirements.txt
- name: Compile Cython components
run: |
make clean compile
enable-cache: true
version: "0.5.7"
- name: Install model
run: USE_CYTHON=1 uv sync --frozen --extra dev
- name: Mypy
run: |
mypy
uv run --env-file .env mypy
Lint:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.11"]
steps:
- uses: actions/checkout@v2
- name: Setup Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
- name: Install uv
uses: astral-sh/setup-uv@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
pip install --upgrade pip wheel
pip install numpy==1.26.4 ruff
pip install -r requirements.txt
- name: Compile Cython components
run: |
make clean compile
enable-cache: true
version: "0.5.7"
- name: Install model
run: USE_CYTHON=1 uv sync --frozen --extra dev
- name: Ruff
run: |
ruff check doc ecoli migration wholecell runscripts validation reconstruction
uv run --env-file .env ruff check doc ecoli migration wholecell runscripts validation reconstruction
20 changes: 8 additions & 12 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/build
/dist
/doc/_build
/vivarium_ecoli.egg-info
/vEcoli.egg-info
/Build_sequences.egg-info
/Fast_polymerize_sums.egg-info
/Monte_carlo_complexation.egg-info
Expand Down Expand Up @@ -37,17 +37,12 @@ __pycache__
._*
.python-version
.pytest_cache

# Pipenv files #
################
Pipfile
Pipfile.lock
pyproject.toml
.mypy_cache/
.ruff_cache/

# VS Code files #
#################
/.vscode
/.env

# Generated Files #
###################
Expand All @@ -61,8 +56,9 @@ cache/
##################
.nextflow*
nextflow_temp
trace-*

# Virtual environment #
#######################
.venv/

# Other files #
##################
/notebooks/ck/
/notebooks/ck_example/
21 changes: 0 additions & 21 deletions Makefile

This file was deleted.

Loading

0 comments on commit 959462c

Please sign in to comment.