Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release cycle, ? 2025 #449

Draft
wants to merge 43 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
53aa24f
Remove unused method from `Parameters`
TimothyWillard Dec 5, 2024
098e13d
Line length formatting
TimothyWillard Dec 5, 2024
8c8df8b
New documentation and installation script
emprzy Dec 9, 2024
0ebbf08
Update local-installation.md
emprzy Dec 9, 2024
1eee527
Minor styling edits to `seeding.py`
TimothyWillard Dec 9, 2024
2d68856
Remove `modinf` arg from `_DataFrame2NumbaDict`
TimothyWillard Dec 9, 2024
a12150c
Add `ModelInfo.get_seeding_data`
TimothyWillard Dec 10, 2024
8ba5f0c
Update other references to `Seeding.get_from_*`
TimothyWillard Dec 10, 2024
e31cac8
Add documentation to the `Seeding` class
TimothyWillard Dec 10, 2024
692865f
Document `ModelInfo.get_seeding_data`
TimothyWillard Dec 10, 2024
0b9c351
Update `local_install_or_update` and `local-installation.md`
emprzy Dec 16, 2024
d812220
Removing file extension from `local_install_or_update` file
emprzy Dec 18, 2024
67ccbff
Update local_install_or_update
emprzy Dec 19, 2024
cbecd91
Incorporate `conda` env setup into installation script and update doc…
emprzy Dec 20, 2024
8db7923
Update local_install_or_update
emprzy Dec 26, 2024
7b97ac7
Add `Jinja2` dep to `gempyor`
TimothyWillard Jan 6, 2025
5abf319
Set `include-package-data` to `true`
TimothyWillard Nov 26, 2024
0d6f517
Include templates with `include-data` directive
TimothyWillard Dec 2, 2024
ca17746
Jinja2 templating infrastructure
TimothyWillard Oct 29, 2024
a997367
Fix Jinja2 loader
TimothyWillard Nov 26, 2024
20bb555
Provide only pkg name to Jinja2 `PackageLoader`
TimothyWillard Nov 26, 2024
1d82cd4
Prefer `FileSystemLoader` over `PackageLoader`
TimothyWillard Nov 26, 2024
71e2f47
Logging infrastructure for `gempyor`
TimothyWillard Oct 29, 2024
e090873
Only propagate logger in pytest
TimothyWillard Oct 30, 2024
a983af2
`black` linting for `gempyor.logging`
TimothyWillard Jan 7, 2025
cd3392e
Merge pull request #418 from emprzy/installation_documentation
emprzy Jan 7, 2025
39be84e
Merge dev into feature/310/logging-infra
TimothyWillard Jan 7, 2025
cd2bfd0
Add `log_cli_inputs` utility
TimothyWillard Nov 5, 2024
a333f6b
Add custom duration click param type
TimothyWillard Jan 7, 2025
f2edc27
Add custom click param type for memory
TimothyWillard Jan 7, 2025
33ad611
Document info/shared_cli, MemoryParamType int
TimothyWillard Jan 7, 2025
bbfa1c2
Assume unitless numbers are in default unit
TimothyWillard Nov 25, 2024
39bfbdc
Remove unused `_jinja` helpers
TimothyWillard Jan 8, 2025
085beca
Call positional args with names
TimothyWillard Jan 8, 2025
857f9e6
Explicit unit control for custom click types
TimothyWillard Jan 8, 2025
dcb899b
Create internal `gempyor._click` module
TimothyWillard Jan 8, 2025
7426548
Merge pull request #447 from HopkinsIDD/feature/310/logging-infra
TimothyWillard Jan 10, 2025
da7d816
Merge pull request #414 from HopkinsIDD/feature/276/remove-dead-methods
TimothyWillard Jan 10, 2025
4071d37
Merge dev into feature/365/convenience-click-types
TimothyWillard Jan 10, 2025
5eee4a6
Merge pull request #446 from HopkinsIDD/feature/365/templating-infra
TimothyWillard Jan 13, 2025
533fcd9
Merge pull request #448 from HopkinsIDD/feature/365/convenience-click…
TimothyWillard Jan 13, 2025
4917d62
Merge main into dev
TimothyWillard Jan 15, 2025
5e6e622
Merge pull request #422 from HopkinsIDD/feature/397/remove-seeding-de…
TimothyWillard Jan 15, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 58 additions & 0 deletions build/local_install_or_update
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
#!/usr/bin/env bash

# Generic setup
set -e

# Ensure we have a $FLEPI_PATH
if [ -z "${FLEPI_PATH}" ]; then
export FLEPI_PATH=$(realpath "$(pwd)")
if [ "$(basename "$FLEPI_PATH")" != "flepiMoP" ]; then
echo "Could not find flepiMoP repository in your current directory."
exit 1
fi
echo "Using '$FLEPI_PATH' for \$FLEPI_PATH."
fi

# Test that flepiMoP is located there, exit if not
if [ ! -d "$FLEPI_PATH" ]; then
echo "Could not find flepiMoP repository in your current directory. Please make sure you have correctly cloned flepiMoP in this directory."
exit 1
fi

# Ensure that conda environment is named flepimop-env
if [ -z "${FLEPI_CONDA}" ]; then
export FLEPI_CONDA="flepimop-env"
echo "Using '$FLEPI_CONDA' for \$FLEPI_CONDA."
fi

# Check that the name of the FLEPI_CONDA variable matches the environment that has been set up, exit if not
FLEPI_CONDA_ENV_MATCHES=$( conda info --envs | awk '{print $1}' | grep -x "$FLEPI_CONDA" | wc -l )
if [ "$FLEPI_CONDA_ENV_MATCHES" -eq 0 ]; then
conda env create --name flepimop-env --file $FLEPI_PATH/environment.yml
fi

# Load the conda environment
eval "$(conda shell.bash hook)"
conda activate $FLEPI_CONDA
[ -e "$CONDA_PREFIX/conda-meta/pinned" ] && rm $CONDA_PREFIX/conda-meta/pinned
cat << EOF > $CONDA_PREFIX/conda-meta/pinned
r-arrow==17.0.0
arrow==17.0.0
EOF

# Install the gempyor package from local
pip install --editable $FLEPI_PATH/flepimop/gempyor_pkg

# Install the local R packages
R -e "install.packages('covidcast', repos='https://cloud.r-project.org')"
RETURNTO=$( pwd )
cd $FLEPI_PATH/flepimop/R_packages/
for d in $( ls ); do
R CMD INSTALL $d
done
cd $RETURNTO
R -e "library(inference); inference::install_cli()"

# Done
echo "> Done installing/updating flepiMoP."
set +e
46 changes: 46 additions & 0 deletions documentation/gitbook/how-to-run/local-installation.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
---
description: >-
Instructions on how to proceed with the installations necessary for local flepiMoP use.
---


# Local flepiMoP installation

## ⇅ Get set up to use Github

You need to interact with Github to run and edit `flepiMoP` code. [Github](https://github.com/) is a web platform for people to share and manage software, and it is based on a 'version control' software called `git` that helps programmers keep track of changes to code. Flepimop core code as well as example projects using flepimop code are all stored on Github, and frequently being updated. The first step to using flepimop for your own project is making sure you're set up to interact with code shared on Github.

If you are totally new to Github, navigate to [Github.com](https://github.com/) and Sign Up for a new account. Read about the [basics of git](https://docs.github.com/en/get-started/getting-started-with-git/set-up-git).

To work with `flepimop` code, you can do some tasks from the Github website, but you'll also need a way to 'clone' the code to your own local computer and keep it up to date with versions hosted online. You can do this either using a user interface like [Github Desktop](https://desktop.github.com/), or, using [`git` ](https://git-scm.com/downloads)commands from the command line. Make sure you have one or both installed.

If you are a veteran user, make sure you're signed in on Github.com and through whatever method you use locally on your computer to interact with Github.

## 🔐 Access the flepiMoP model code

In order to run a model with flepiMoP, you will need to clone the flepiMoP **code** to your machine.

**To clone the `flepiMoP` code repository:**

* If you're using the command line in a terminal, first navigate to the local directory you'll use as the directory for the files that make up `flepiMoP`. Then, use the command: `git clone https://github.com/HopkinsIDD/flepiMoP`
* If you're using Github Desktop, go File -> Clone Repository, switch to the "URL" tab and copy the URL `https://github.com/HopkinsIDD/flepiMoP` there. For the "Local Path" option, make sure you choose your desired directory.

## 🐍 Installing `conda`

In order to complete `flepiMoP` installation, you must have [`conda`](https://docs.conda.io/projects/conda/en/latest/user-guide/getting-started.html) installed on your machine. `conda` is a tool that will assist you in managing software environments and code packages on your device, and it will be very helpful in ensuring consistent, reproducible environments across different projects. To install `conda` follow [the directions](https://docs.conda.io/projects/conda/en/stable/user-guide/install/index.html) according to your operating system. We would recommend selecting the `Anaconda Distribution` installer of `conda`.

Installation of `conda` may take a few minutes.

## ⬇️ Installing flepiMoP packages and dependencies

Navigate to the `flepiMoP` directory and run the following command:

**Note: This installation script is currently only designed for Mac/Linux operating systems. Windows installation script coming soon.**
```bash
./build/local_install_or_update
```

1. Determine `$FLEPI_PATH` and `$FLEPI_CONDA` environment variables
2. Activate your conda environment
3. Install `gempyor` and related Python dependencies
4. Install necessary R packages and dependencies
4 changes: 2 additions & 2 deletions flepimop/gempyor_pkg/docs/integration_benchmark.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,7 @@
},
{
"cell_type": "code",
"execution_count": 5,
"execution_count": null,
"id": "07bfd952-5c42-4704-81cc-5de0c917c0ab",
"metadata": {
"execution": {
Expand Down Expand Up @@ -450,7 +450,7 @@
"\n",
"with Timer(\"onerun_SEIR.seeding\"):\n",
" initial_conditions = s.initial_conditions.get_from_config(sim_id, modinf=s)\n",
" seeding_data, seeding_amounts = s.seeding.get_from_config(sim_id, modinf=s)\n",
" seeding_data, seeding_amounts = s.get_seeding_data(sim_id)\n",
"\n",
"mobility_subpop_indices = s.mobility.indices\n",
"mobility_data_indices = s.mobility.indptr\n",
Expand Down
4 changes: 2 additions & 2 deletions flepimop/gempyor_pkg/docs/integration_doc.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
},
{
"cell_type": "code",
"execution_count": 3,
"execution_count": null,
"id": "96230106-73e3-4681-b562-6a7269513375",
"metadata": {
"execution": {
Expand Down Expand Up @@ -109,7 +109,7 @@
"\n",
"\n",
"initial_conditions = gempyor_inference.s.initial_conditions.get_from_config(sim_id2write, modinf=gempyor_inference.s)\n",
"seeding_data, seeding_amounts = gempyor_inference.s.seeding.get_from_config(sim_id2write, modinf=gempyor_inference.s)\n",
"seeding_data, seeding_amounts = gempyor_inference.s.get_seeding_data(sim_id2write)\n",
"\n",
"\n",
"p_draw = gempyor_inference.s.parameters.parameters_quick_draw(\n",
Expand Down
9 changes: 2 additions & 7 deletions flepimop/gempyor_pkg/docs/interface.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@
},
{
"cell_type": "code",
"execution_count": 15,
"execution_count": null,
"id": "63618148-81db-4fe0-9395-7f21878c1372",
"metadata": {
"execution": {
Expand Down Expand Up @@ -254,20 +254,15 @@
"\n",
"### Run every time:\n",
"with Timer(\"onerun_SEIR.seeding\"):\n",
" seeding_data, seeding_amounts = gempyor_inference.s.get_seeding_data(sim_id2load if load_ID else sim_id2write)\n",
" if load_ID:\n",
" initial_conditions = gempyor_inference.s.initial_conditions.get_from_file(\n",
" sim_id2load, modinf=gempyor_inference.s\n",
" )\n",
" seeding_data, seeding_amounts = gempyor_inference.s.seeding.get_from_file(\n",
" sim_id2load, modinf=gempyor_inference.s\n",
" )\n",
" else:\n",
" initial_conditions = gempyor_inference.s.initial_conditions.get_from_config(\n",
" sim_id2write, modinf=gempyor_inference.s\n",
" )\n",
" seeding_data, seeding_amounts = gempyor_inference.s.seeding.get_from_config(\n",
" sim_id2write, modinf=gempyor_inference.s\n",
" )\n",
"\n",
"with Timer(\"SEIR.parameters\"):\n",
" # Draw or load parameters\n",
Expand Down
4 changes: 3 additions & 1 deletion flepimop/gempyor_pkg/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ dependencies = [
"emcee",
"graphviz",
"h5py",
"Jinja2",
"matplotlib",
"numba>=0.53.1",
"numpy",
Expand Down Expand Up @@ -51,7 +52,8 @@ gempyor-simulate = "gempyor.simulate:_deprecated_simulate"

[tool.setuptools]
package-dir = {"" = "src"}
include-package-data = false
include-package-data = true
package-data = { "gempyor" = ["templates/*.j2"] }

[tool.setuptools.packages.find]
where = ["src"]
Expand Down
Loading
Loading