Skip to content

Commit

Permalink
Merge pull request #119 from EIT-ALIVE/181_refactor_sequence_psomhorst
Browse files Browse the repository at this point in the history
Restructuring code base for `Sequence` and attached classes
  • Loading branch information
DaniBodor authored Mar 11, 2024
2 parents 129b86c + 7e60cbf commit 3537050
Show file tree
Hide file tree
Showing 39 changed files with 2,827 additions and 1,302 deletions.
19 changes: 8 additions & 11 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,26 @@ name: Python package
on:
push:
branches:
- main
- drcandacemakedamoore/docker
- main
- drcandacemakedamoore/docker
pull_request:
types: [opened, synchronize, reopened, ready_for_review]
paths-ignore:
- "**.md"
- "**.rst"
- "**.ipynb"
branches:
- main
- main

jobs:

build:
if: github.event.pull_request.draft == false
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: ['ubuntu-latest']
python-version: ['3.10']
os: ["ubuntu-latest"]
python-version: ["3.10"]
name: Build for ${{ matrix.python-version }}, ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
Expand Down Expand Up @@ -57,7 +56,7 @@ jobs:
- name: Set up Python 3.10
uses: actions/setup-python@v3
with:
python-version: '3.10'
python-version: "3.10"
- name: Python info
shell: bash -l {0}
run: |
Expand All @@ -67,10 +66,8 @@ jobs:
run: |
python3 -m pip install --upgrade pip setuptools
python3 -m pip install .[dev,publishing]
- name: Check style against standards using prospector
run: prospector
- name: Check import order
run: isort --check-only eitprocessing --diff
- name: Check linting with ruff
run: ruff .

coveralls:
if: github.event.pull_request.draft == false
Expand Down
44 changes: 33 additions & 11 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,36 @@
{
"[python]": {
"editor.codeActionsOnSave": {
"source.organizeImports": "explicit"
},
"editor.formatOnSave": true,
// Python
"[python]": {
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.fixAll": "explicit"
},
"notebook.lineNumbers": "on",
"python.testing.pytestArgs": [
"tests"
],
"python.testing.unittestEnabled": false,
"python.testing.pytestEnabled": true,
"editor.defaultFormatter": "charliermarsh.ruff",
"editor.rulers": [120]
},
"autoDocstring.docstringFormat": "google",

// Notebooks
"notebook.lineNumbers": "on",
"notebook.formatOnSave.enabled": true,
"notebook.codeActionsOnSave": {
"notebook.source.fixAll": "explicit"
},
"notebook.diff.ignoreMetadata": true,

// Pytest
"python.testing.unittestEnabled": false,
"python.testing.pytestEnabled": true,

// Format all files on save
"rewrap.wrappingColumn": 120,
"rewrap.autoWrap.enabled": true,
"editor.formatOnSave": true,
"editor.defaultFormatter": "esbenp.prettier-vscode",
"[ignore]": {
"editor.defaultFormatter": "foxundermoon.shell-format"
},
"[properties]": {
"editor.defaultFormatter": "foxundermoon.shell-format"
}
}
31 changes: 10 additions & 21 deletions README.dev.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,11 @@ We welcome all contributions to this open-source project, as long as they follow
We appreciate it if you adhere to our naming and style [conventions](#conventions) below.

Please follow these steps:
1. (**important**) announce your plan to the rest of the community *before you start working*. This announcement should be in the form of a (new) issue;

1. (**important**) announce your plan to the rest of the community _before you start working_. This announcement should be in the form of a (new) issue;
1. (**important**) wait until some kind of consensus is reached about your idea being a good idea;
1. if needed, fork the repository to your own Github profile and create your own feature branch off of the latest master commit. While working on your feature branch, make sure to stay up to date with the master branch by pulling in changes, possibly from the 'upstream' repository (follow the instructions [here](https://help.github.com/articles/configuring-a-remote-for-a-fork/) and [here](https://help.github.com/articles/syncing-a-fork/));
1. make sure the existing tests still work by running ``pytest`` (see also [here](#testing-locally));
1. make sure the existing tests still work by running `pytest` (see also [here](#testing-locally));
1. add your own tests (if necessary);
1. update or expand the documentation;
1. update the `CHANGELOG.md` file with change;
Expand All @@ -21,7 +22,6 @@ Please follow these steps:

In case you feel like you've made a valuable contribution, but you don't know how to write or run tests for it, or how to generate the documentation: don't let this discourage you from making the pull request; we can help you! Just go ahead and submit the pull request, but keep in mind that you might be asked to append additional commits to your pull request.


### Conventions

#### Readability vs complexity/correctness
Expand Down Expand Up @@ -73,9 +73,9 @@ We have set up continuous integration for linting and testing, among other thing
that all checks pass before requesting code review.

Please create a "draft PR" until your work is ready for review, as this will avoid triggering
the CI prematurely (which uses unnecessary computing power, see [here](<https://blog.esciencecenter.nl/reduce-reuse-recycle-save-the-planet-one-github-action-at-a-time-4ab602255c3f>)).
the CI prematurely (which uses unnecessary computing power, see [here](https://blog.esciencecenter.nl/reduce-reuse-recycle-save-the-planet-one-github-action-at-a-time-4ab602255c3f)).

You can run the [tests](#testing-locally) and [linter](#linting-locally) locally before activating
You can run the [tests](#testing-locally) and [linter](#linting-and-formatting) locally before activating
the CI.

#### Testing locally
Expand All @@ -101,26 +101,15 @@ coverage report

`coverage` can also generate output in HTML and other formats; see `coverage help` for more information.

#### Linting locally
#### Linting and Formatting

For linting we will use [prospector](https://pypi.org/project/prospector/).
To sort imports we will use [isort](https://pycqa.github.io/isort/). Note that if you use VS Code,
sorting is automated upon file saving.
We use [ruff](https://docs.astral.sh/ruff/) for linting, sorting imports and formatting of python (notebook) files. The configurations of `ruff` are set in [pyproject.toml](pyproject.toml) file.

```shell
# linter
prospector
If you are using VS code, please install and activate the [Ruff extension](https://marketplace.visualstudio.com/items?itemName=charliermarsh.ruff) to automatically format and check linting.

# recursively check import style for the eitprocessing module only
isort --check-only eitprocessing
Otherwise, please ensure check both linting (`ruff fix .`) and formatting (`ruff format .`) before requesting a review.

# recursively check import style for the eitprocessing module only and show
# any proposed changes as a diff
isort --check-only --diff eitprocessing

# recursively fix import style for the eitprocessing module only
isort eitprocessing
```
We use [prettier](https://prettier.io/) for formatting most other files. If you are editing or adding non-python files and using VS code, the [Prettier extension](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode) can be installed to auto-format these files as well.

# The following sections are untested

Expand Down
9 changes: 0 additions & 9 deletions eitprocessing/__init__.py
Original file line number Diff line number Diff line change
@@ -1,9 +0,0 @@
"""Documentation about eitprocessing"""
import logging


logging.getLogger(__name__).addHandler(logging.NullHandler())

__author__ = "Dani Bodor"
__email__ = "d.bodor@esciencecenter.nl"
__version__ = "0.1.0"
24 changes: 0 additions & 24 deletions eitprocessing/binreader/__init__.py
Original file line number Diff line number Diff line change
@@ -1,24 +0,0 @@
"""Loading and processing binary EIT data from the Dräger Pulmovista 500"""

__version__ = "0.1"

from .frameset import Frameset
from .phases import MaxValue
from .phases import MinValue
from .phases import QRSMark
from .sequence import DraegerSequence
from .sequence import Sequence
from .sequence import TimpelSequence
from .sequence import Vendor


__all__ = [
"Frameset",
"MaxValue",
"MinValue",
"QRSMark",
"Sequence",
"DraegerSequence",
"TimpelSequence",
"Vendor",
]
17 changes: 0 additions & 17 deletions eitprocessing/binreader/event.py

This file was deleted.

Loading

0 comments on commit 3537050

Please sign in to comment.