-
Notifications
You must be signed in to change notification settings - Fork 2
PyPI readiness: Finalization of patchsim #3
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
Merged
Merged
Changes from all commits
Commits
Show all changes
55 commits
Select commit
Hold shift + click to select a range
489e71d
added metwork.py and patch.py
shreyamukherji 6d5279e
added metwork.py and patch.py
shreyamukherji a16412f
added metwork.py and patch.py
shreyamukherji 7239bf7
added support for per-patch parameters
shreyamukherji d2f2f8c
added pytests
shreyamukherji 39ee214
added pytests
shreyamukherji 7510819
added pytests
shreyamukherji 25b325b
mkdocs
shreyamukherji c7fdaf5
mkdocs
shreyamukherji 25279ce
updated model.py
shreyamukherji 6bf96b5
added patch and network files
shreyamukherji f35da97
added model_runner.py
shreyamukherji 5698d7f
added model_runner.py
shreyamukherji 84df389
added model_runner.py
shreyamukherji b6e0b6e
added csv data files
shreyamukherji a6f9356
added csv data files
shreyamukherji d41d7b3
updated network.py and patch.py
shreyamukherji 3a3ebcf
updated config
shreyamukherji a1a406f
updated config
shreyamukherji 61d8bd1
updated config
shreyamukherji f02c11c
updated docs
shreyamukherji 1aa81ee
updated docs
shreyamukherji ca55514
updated docs
shreyamukherji d969ded
updated docs
shreyamukherji 592eb4c
updated docs
shreyamukherji 80e9e99
updated docs
shreyamukherji 7ab8190
updated docs
shreyamukherji e98488f
updated docs
shreyamukherji 4380b40
pypi deploy
shreyamukherji 2f06ac1
pypi deploy
shreyamukherji 14d79dc
pypi deploy
shreyamukherji bf225e3
smoketests
shreyamukherji 5861e35
smoketests
shreyamukherji 44c5240
smoketests
shreyamukherji b9ad465
smoketests
shreyamukherji 7dea882
smoketests
shreyamukherji 8c1bc21
smoketests
shreyamukherji 27ace26
smoketests
shreyamukherji 714ab8f
smoke tests
shreyamukherji e6667ba
smoke tests
shreyamukherji 0c87b75
fixed transitions
shreyamukherji 7a49563
applied pypi readiness and sdk/cli changes
shreyamukherji ba11329
removed dead code
shreyamukherji d73a554
setting up ci/cd
shreyamukherji 38d12eb
setting up ci/cd
shreyamukherji 5fc702c
setting up ci/cd
shreyamukherji d305ee6
fixed issues based on coderabbit PR review
shreyamukherji cc94719
fixed issues based on coderabbit PR review
shreyamukherji 45d195f
fixed issues based on coderabbit PR review
shreyamukherji 2534755
fixed issues based on coderabbit PR review
shreyamukherji 1f170f0
fixed issues based on coderabbit PR review
shreyamukherji 25f97c8
changed ci.yml, publish.yml, cli.py and docs
shreyamukherji 73d32ce
changed ci.yml, publish.yml, cli.py and docs
shreyamukherji d09df22
changed ci.yml, publish.yml, cli.py and docs
shreyamukherji b9ce994
changed ci.yml, publish.yml, cli.py and docs
shreyamukherji File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,56 @@ | ||
| name: CI | ||
|
|
||
| on: | ||
| push: | ||
| branches: [main, feature, dev, develop] | ||
| pull_request: null | ||
|
|
||
| jobs: | ||
| test-and-lint: | ||
| runs-on: ubuntu-latest | ||
|
|
||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Setup uv | ||
| uses: astral-sh/setup-uv@v5 | ||
|
|
||
| - name: Setup Python | ||
| uses: actions/setup-python@v5 | ||
| with: | ||
| python-version-file: .python-version | ||
|
|
||
| - name: Sync dependencies (including dev) | ||
| run: uv sync --extra dev --frozen | ||
|
|
||
| - name: Ruff lint | ||
| run: uv run --no-sync --frozen ruff check . | ||
|
|
||
| - name: Ruff format check | ||
| run: uv run --no-sync --frozen ruff format --check . | ||
|
|
||
| - name: Run tests | ||
| run: uv run --no-sync --frozen pytest -q | ||
|
|
||
| build: | ||
| runs-on: ubuntu-latest | ||
| needs: test-and-lint | ||
|
|
||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Setup uv | ||
| uses: astral-sh/setup-uv@v5 | ||
|
|
||
| - name: Setup Python | ||
| uses: actions/setup-python@v5 | ||
| with: | ||
| python-version-file: .python-version | ||
|
|
||
| - name: Sync dependencies | ||
| run: uv sync --frozen | ||
|
|
||
| - name: Build package | ||
| run: uv build |
This file contains hidden or 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,46 @@ | ||
| name: Publish to PyPI | ||
|
|
||
| on: | ||
| release: | ||
| types: [published] | ||
| workflow_dispatch: null | ||
|
|
||
| jobs: | ||
| publish: | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| id-token: write | ||
| contents: read | ||
|
|
||
| environment: | ||
| name: pypi | ||
|
|
||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Setup uv | ||
| uses: astral-sh/setup-uv@v5 | ||
|
|
||
| - name: Setup Python | ||
| uses: actions/setup-python@v5 | ||
| with: | ||
| python-version-file: .python-version | ||
|
|
||
| - name: Sync dependencies (including dev) | ||
| run: uv sync --extra dev --frozen | ||
|
|
||
| - name: Lint | ||
| run: uv run --no-sync --frozen ruff check . | ||
|
|
||
| - name: Format check | ||
| run: uv run --no-sync --frozen ruff format --check . | ||
|
|
||
| - name: Test | ||
| run: uv run --no-sync --frozen pytest -q | ||
|
|
||
| - name: Build | ||
| run: uv build | ||
|
|
||
| - name: Publish | ||
| uses: pypa/gh-action-pypi-publish@release/v1 |
This file contains hidden or 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
This file contains hidden or 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,15 @@ | ||
| repos: | ||
| - repo: https://github.com/pre-commit/pre-commit-hooks | ||
| rev: v6.0.0 | ||
| hooks: | ||
| - id: end-of-file-fixer | ||
| - id: trailing-whitespace | ||
| - id: check-yaml | ||
| - id: check-toml | ||
|
|
||
| - repo: https://github.com/astral-sh/ruff-pre-commit | ||
| rev: v0.15.8 | ||
| hooks: | ||
| - id: ruff | ||
| args: [--fix] | ||
| - id: ruff-format | ||
This file contains hidden or 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 @@ | ||
| 3.11 |
Empty file.
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This document expects users to be running |
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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,5 @@ | ||
| day,source,target,weight | ||
| 0,A,A,0.9 | ||
| 0,A,B,0.1 | ||
| 0,B,B,0.9 | ||
| 0,B,A,0.1 |
This file contains hidden or 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,3 @@ | ||
| patch,Population | ||
| A, 1000 | ||
| B, 500 |
This file contains hidden or 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,3 @@ | ||
| patch,S,I,R | ||
| A,999,1,0 | ||
| B,500,0,0 |
This file contains hidden or 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,25 @@ | ||
|
|
||
| # Architecture | ||
|
|
||
| PatchSim follows a layered architecture: | ||
|
|
||
| ## Core components | ||
|
|
||
| ### Patch | ||
| Represents a single subpopulation with: | ||
| - Fixed population size | ||
| - Compartment state vector | ||
| - Parameter dictionary | ||
| - Validation logic | ||
|
|
||
| ### Network | ||
| Defines interactions between patches via a weighted directed graph. | ||
|
|
||
| ### Model | ||
| Orchestrates: | ||
| - ODE construction | ||
| - Numerical integration | ||
| - Visualization of results | ||
|
|
||
| This separation ensures that changes to network structure do not require | ||
| rewriting patch-level dynamics. |
This file contains hidden or 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,30 @@ | ||
| # Configuration | ||
|
|
||
| PatchSim simulations are configured using YAML files. | ||
|
|
||
| ## Model definition | ||
|
|
||
| ```yaml | ||
| # Input files (required) | ||
| PatchFile: data/patch/patch-population.csv | ||
| NetworkFile: data/networks/network.csv | ||
| SeedFile: data/seeds/seed-initial.csv | ||
|
|
||
| # Model configuration | ||
| ModelName: sample-sir-ode | ||
|
|
||
| # Simulation parameters | ||
| TMax: 50 | ||
| Tolerance: 1e-8 | ||
| MaxIter: 10000 | ||
| StartDate: 2020-01-01 | ||
| EndDate: 2022-12-31 | ||
| OutputDir: output/sample-sir-ode | ||
| compartments: ["S", "I", "R"] | ||
| Parameters: | ||
| beta: 0.08 | ||
| gamma: 0.1 | ||
| Transitions: | ||
| "S -> I": "beta" | ||
| "I -> R": "gamma * I" | ||
| ``` | ||
coderabbitai[bot] marked this conversation as resolved.
Show resolved
Hide resolved
|
||
This file contains hidden or 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,23 @@ | ||
|
|
||
|
|
||
| # Getting Started | ||
|
|
||
| ## Installation | ||
|
|
||
| ### From PyPI (Recommended) | ||
|
|
||
| Install patchsim from PyPI: | ||
|
|
||
| ```bash | ||
| pip install patchsim | ||
| ``` | ||
|
|
||
| ### For Contributors | ||
|
|
||
| Clone the repository and install in editable mode for development: | ||
|
|
||
| ```bash | ||
| git clone https://github.com/dsih-artpark/patchsim.git | ||
| cd patchsim | ||
| pip install -e . | ||
| ``` |
This file contains hidden or 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
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.