Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
9 changes: 7 additions & 2 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
# Set update schedule for GitHub Actions
# Set update schedule for GitHub Actions and Python packages

version: 2
updates:

# Check for updates to GitHub Actions every week
- package-ecosystem: "github-actions"
directory: "/"
schedule:
# Check for updates to GitHub Actions every week
interval: "weekly"

# Check for updates to pip packages every week
- package-ecosystem: "pip"
directory: "/"
schedule:
interval: "weekly"
30 changes: 3 additions & 27 deletions .github/workflows/buildtest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ on:

jobs:
test:
name: Test and Deploy (${{ matrix.config.stormpyImg }})
name: Build and Test (${{ matrix.config.stormpyImg }})
runs-on: ubuntu-latest
strategy:
matrix:
Expand All @@ -30,32 +30,8 @@ jobs:
run: docker build -t movesrwth/stormpy-starter . --build-arg STORMPY_BASE=movesrwth/stormpy:${{ matrix.config.stormpyImg }}
- name: Run Docker
run: docker run -d -it --name ci -p 8888:8888 movesrwth/stormpy-starter
- name: Run and check output of example commands
- name: Run tests
run: |
docker exec ci bash -c "python stormpy_starter/check.py --model examples/die.pm --property examples/die.pctl | grep 'no'"
docker exec ci bash -c "python stormpy_starter/check.py --model examples/die.pm --property examples/die2.pctl | grep 'yes'"
docker exec ci bash -c "pip install .[test]; pytest"
- name: Run notebook
run: docker exec ci bash -c "pip install papermill && papermill stormpy_starter.ipynb"

notify:
name: Email notification
runs-on: ubuntu-latest
needs: [test]
# Only run in main repo and even if previous step failed
if: github.repository_owner == 'moves-rwth' && always()
steps:
- uses: technote-space/workflow-conclusion-action@v3
- uses: dawidd6/action-send-mail@v6
with:
server_address: ${{ secrets.STORM_CI_MAIL_SERVER }}
server_port: 587
username: ${{ secrets.STORM_CI_MAIL_USERNAME }}
password: ${{ secrets.STORM_CI_MAIL_PASSWORD }}
subject: "[You broke it] CI run failed for ${{ github.repository }}"
body:
"CI job of ${{ github.repository }} has failed for commit ${{ github.sha }}.\n\
The error type is: ${{ env.WORKFLOW_CONCLUSION }}.\n\n\
For more information, see https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}"
to: ${{ secrets.STORM_CI_MAIL_RECIPIENTS }}
from: Github Actions <[email protected]>
if: env.WORKFLOW_CONCLUSION != 'success' # notify only if failure
39 changes: 39 additions & 0 deletions .github/workflows/formatapply.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Apply code format

on:
workflow_dispatch:

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v5
- uses: psf/black@stable
with:
options: ""
src: "."
jupyter: true
- name: Commit Formatting
run: |
git config user.name 'Auto Format'
git config user.email 'test@test'
if [ -z "$(git status --porcelain)" ]
then
echo "Code did not change"
else
git commit -am "Applied code formatting"
git rev-parse HEAD >> .git-blame-ignore-revs
git commit -am "Add code formatting commit to .git-blame-ignore-revs"
fi
- name: Create Pull Request
id: cpr
uses: peter-evans/create-pull-request@v7
with:
branch: ci/apply-code-format
delete-branch: true
title: 'Code formatting'
body: |
Auto-generated pull request triggered by the `apply-code-format` workflow.
- Manually close and reopen this PR to trigger the CI.
- Make sure to **merge** (and not rebase) this PR so that the added commit hash in `.git-blame-ignore-revs` remains valid.
18 changes: 18 additions & 0 deletions .github/workflows/formatcheck.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Check code format

on:
push:
pull_request:
workflow_dispatch:

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v5
- uses: psf/black@stable
with:
options: "--check --diff --color"
src: "."
jupyter: true
9 changes: 8 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
# Run Docker container for Jupyter notebook
###################################
# The Docker image can be built by executing:
# docker build -t yourusername/stormpy-starter .
# A different stormpy base image can be set from the commandline with:
# --build-arg STORMPY_BASE=<new_base_image>

# Set stormpy base image
ARG STORMPY_BASE=movesrwth/stormpy:stable
FROM $STORMPY_BASE
MAINTAINER Matthias Volk <[email protected]>
LABEL org.opencontainers.image.authors="[email protected]"


##########
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Before starting, make sure that Storm and stormpy are installed. If not, see the
First, install the Python package. If you use a virtual environment, make sure to use it.
To install the starter package, execute
```
python setup.py develop
pip install .
```

Then, run the script using
Expand Down
60 changes: 60 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
[build-system]
requires = ["hatchling >= 1.26"]
build-backend = "hatchling.build"

[project]
name = "storm-project-starter-python"
description = "Starter project for the Python API of Storm via Stormpy"
version = "0.1"
readme = "README.md"
license.file = "LICENSE"
authors = [
{ name = "S. Junges", email = "[email protected]" },
{ name = "M. Volk", email = "[email protected]" }
]
requires-python = ">=3.9"
dependencies = [
"stormpy>=1.10",
]
classifiers = [
'Intended Audience :: Science/Research',
'Topic :: Scientific/Engineering',
'Topic :: Software Development :: Libraries :: Python Modules',
]

[project.urls]
Homepage = "https://github.com/moves-rwth/storm-project-starter-python"

[project.optional-dependencies]
dev = [
# Formatting
"black[jupyter]",
]
test = [
"pytest",
"nbval",
]

[tool.hatch.build.targets.wheel]
only-include = ["stormpy_starter"]

[tool.black]
line-length = 160

[tool.pytest.ini_options]
minversion = "6.0"
addopts = "--nbval"
#testpaths = [
# "tests",
# "examples",
# "doc",
#]
#python_files = [
# "test*.py",
# "examples/*.py",
#]
#python_functions = [
# "*_test",
# "test_*",
# "example_*",
#]
25 changes: 0 additions & 25 deletions setup.py

This file was deleted.

6 changes: 3 additions & 3 deletions stormpy_starter/check.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ def check(path_to_model, property_str):


def main():
parser = argparse.ArgumentParser(description='Starter project for stormpy.')
parser = argparse.ArgumentParser(description="Starter project for stormpy.")

parser.add_argument('--model', '-m', help='Model file', required=True)
parser.add_argument('--property', '-p', help='Property', required=True)
parser.add_argument("--model", "-m", help="Model file", required=True)
parser.add_argument("--property", "-p", help="Property", required=True)
args = parser.parse_args()

# Call function
Expand Down
11 changes: 11 additions & 0 deletions tests/test_starter.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
from stormpy_starter import check


def test_prop1():
answer = check.check("examples/die.pm", "examples/die.pctl")
assert not answer


def test_prop2():
answer = check.check("examples/die.pm", "examples/die2.pctl")
assert answer