diff --git a/.github/workflows/deploy.yaml b/.github/workflows/ghp-deploy.yaml similarity index 94% rename from .github/workflows/deploy.yaml rename to .github/workflows/ghp-deploy.yaml index 29bfc57..3e6c30a 100644 --- a/.github/workflows/deploy.yaml +++ b/.github/workflows/ghp-deploy.yaml @@ -9,6 +9,6 @@ on: branches: [ "main", "master" ] workflow_dispatch: jobs: - deploy: + ghp-deploy: runs-on: ubuntu-latest steps: [uses: fastai/workflows/quarto-ghp@master] diff --git a/.github/workflows/test.yaml b/.github/workflows/nbdev-test.yaml similarity index 80% rename from .github/workflows/test.yaml rename to .github/workflows/nbdev-test.yaml index 5608592..4a389d8 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/nbdev-test.yaml @@ -1,7 +1,7 @@ -name: CI +name: nbdev-test on: [workflow_dispatch, pull_request, push] jobs: - test: + nbdev-test: runs-on: ubuntu-latest steps: [uses: fastai/workflows/nbdev-ci@master] diff --git a/.github/workflows/python.yaml b/.github/workflows/python.yaml new file mode 100644 index 0000000..a560099 --- /dev/null +++ b/.github/workflows/python.yaml @@ -0,0 +1,39 @@ +name: python-check +on: [ pull_request, push ] + +jobs: + python-check: + strategy: + fail-fast: false + matrix: + python-version: [ 3.11 ] + os: [ ubuntu-latest, macos-latest, windows-latest ] + runs-on: ${{ matrix.os }} + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + - name: Install deps + run: make install + - name: Check + run: make check + + python-test: + needs: + - python-check + strategy: + fail-fast: false + matrix: + python-version: [ 3.11 ] + os: [ ubuntu-latest, macos-latest, windows-latest ] + runs-on: ${{ matrix.os }} + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + - name: Install deps + run: make install + - name: Check + run: make test diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..22f8677 --- /dev/null +++ b/Makefile @@ -0,0 +1,21 @@ +lint_dirs := juddges scripts notebooks dashboards tests +mypy_dirs := juddges scripts dashboards tests + +fix: + ruff check $(lint_dirs) --fix + ruff format $(lint_dirs) + +check: + ruff check $(lint_dirs) + ruff format $(lint_dirs) --check + mypy --install-types --non-interactive $(mypy_dirs) + +test: + coverage run -m pytest + coverage report -mi + +all: check test + +install: + pip install -r requirements.txt + diff --git a/dashboards/app.py b/dashboards/app.py new file mode 100644 index 0000000..f0f5ddf --- /dev/null +++ b/dashboards/app.py @@ -0,0 +1,3 @@ +import streamlit as st + +st.title("JuDDGES Dashboard") diff --git a/docker-compose.yml b/docker-compose.yml index f88c536..497ad6a 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -4,7 +4,7 @@ name: juddges services: web: build: . - command: streamlit run /app/juddges/dashboards/app.py + command: streamlit run /app/dashboards/app.py volumes: - ./:/app - ~/.cache:/root/.cache diff --git a/juddges/dashboards/app.py b/juddges/dashboards/app.py deleted file mode 100644 index eba8a0b..0000000 --- a/juddges/dashboards/app.py +++ /dev/null @@ -1,3 +0,0 @@ -import streamlit as st - -st.title("JuDDGES Dashboard") \ No newline at end of file diff --git a/notebooks/.gitkeep b/notebooks/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..bdd837e --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,9 @@ +[tool.ruff] +line-length = 100 +extend-include = ["*.ipynb"] +exclude = ["_modidx.py"] + +[tool.mypy] +python_version = "3.10" +strict = true +plugins = "numpy.typing.mypy_plugin" diff --git a/requirements.txt b/requirements.txt index 01e42f9..177b977 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,2 +1,6 @@ nbdev==2.3.13 -streamlit==1.31.1 \ No newline at end of file +streamlit==1.31.1 +ruff==0.2.2 +coverage==7.4.3 +pytest==8.0.2 +mypy==1.8.0 diff --git a/scripts/run_dummy.py b/scripts/run_dummy.py new file mode 100644 index 0000000..d14c7cd --- /dev/null +++ b/scripts/run_dummy.py @@ -0,0 +1,2 @@ +# mypy requires .py file in the directory +# file should be deleted later diff --git a/tests/test_judgges.py b/tests/test_judgges.py new file mode 100644 index 0000000..56d7427 --- /dev/null +++ b/tests/test_judgges.py @@ -0,0 +1,5 @@ +from juddges import __version__ + + +def test_version() -> None: + assert __version__ == "0.0.1"