Skip to content

Commit f4312b3

Browse files
authored
Merge pull request #71 from CBroz1/dev
Add pre-commit & utilities for pytests
2 parents 4e2a412 + b291be6 commit f4312b3

23 files changed

+230
-92
lines changed

.markdownlint.yaml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Markdown Linter configuration for docs
2+
# https://github.com/DavidAnson/markdownlint
3+
# https://github.com/DavidAnson/markdownlint/blob/main/doc/Rules.md
4+
MD009: false # permit trailing spaces
5+
MD007: false # List indenting - permit 4 spaces
6+
MD013:
7+
line_length: "88" # Line length limits
8+
tables: false # disable for tables
9+
headings: false # disable for headings
10+
MD030: false # Number of spaces after a list
11+
MD033: # HTML elements allowed
12+
allowed_elements:
13+
- "br"
14+
MD034: false # Permit bare URLs
15+
MD031: false # Spacing w/code blocks. Conflicts with `??? Note` and code tab styling
16+
MD046: false # Spacing w/code blocks. Conflicts with `??? Note` and code tab styling

.pre-commit-config.yaml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
default_stages: [commit, push]
2+
exclude: (^.github/|^docs/|^images/)
3+
4+
repos:
5+
- repo: https://github.com/pre-commit/pre-commit-hooks
6+
rev: v4.4.0
7+
hooks:
8+
- id: trailing-whitespace
9+
- id: end-of-file-fixer
10+
- id: check-yaml
11+
- id: check-added-large-files # prevent giant files from being committed
12+
- id: requirements-txt-fixer
13+
- id: mixed-line-ending
14+
args: ["--fix=lf"]
15+
description: Forces to replace line ending by the UNIX 'lf' character.
16+
17+
# black
18+
- repo: https://github.com/psf/black
19+
rev: 22.12.0
20+
hooks:
21+
- id: black
22+
- id: black-jupyter
23+
args:
24+
- --line-length=88
25+
26+
# isort
27+
- repo: https://github.com/pycqa/isort
28+
rev: 5.11.2
29+
hooks:
30+
- id: isort
31+
args: ["--profile", "black"]
32+
description: Sorts imports in an alphabetical order
33+
34+
# flake8
35+
- repo: https://github.com/pycqa/flake8
36+
rev: 4.0.1
37+
hooks:
38+
- id: flake8
39+
args: # arguments to configure flake8
40+
# making isort line length compatible with black
41+
- "--max-line-length=88"
42+
- "--max-complexity=18"
43+
- "--select=B,C,E,F,W,T4,B9"
44+
45+
# these are errors that will be ignored by flake8
46+
# https://www.flake8rules.com/rules/{code}.html
47+
- "--ignore=E203,E501,W503,W605"
48+
# E203 - Colons should not have any space before them.
49+
# Needed for list indexing
50+
# E501 - Line lengths are recommended to be no greater than 79 characters.
51+
# Needed as we conform to 88
52+
# W503 - Line breaks should occur after the binary operator.
53+
# Needed because not compatible with black
54+
# W605 - a backslash-character pair that is not a valid escape sequence now
55+
# generates a DeprecationWarning. This will eventually become a SyntaxError.
56+
# Needed because we use \d as an escape sequence

CHANGELOG.md

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,16 @@
11
# Changelog
22

3-
Observes [Semantic Versioning](https://semver.org/spec/v2.0.0.html) standard and [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) convention.
3+
Observes [Semantic Versioning](https://semver.org/spec/v2.0.0.html) standard and
4+
[Keep a Changelog](https://keepachangelog.com/en/1.0.0/) convention.
5+
6+
## [0.5.0] - 2023-01-09
7+
8+
+ Remove - `recursive_search` function
9+
+ Add - pre-commit checks to the repo to observe flake8, black, isort
10+
+ Add - `value_to_bool` and `QuietStdOut` utilities
411

512
## [0.4.2] - 2022-12-16
13+
614
+ Update - PrairieView loader checks for multi-plane vs single-plane scans.
715

816
## [0.4.1] - 2022-12-15
@@ -17,10 +25,10 @@ Observes [Semantic Versioning](https://semver.org/spec/v2.0.0.html) standard and
1725

1826
## [0.3.0] - 2022-10-7
1927

20-
+ Add - Function `prairieviewreader` to parse metadata from Bruker PrarieView acquisition system
28+
+ Add - Function `prairieviewreader` to parse metadata from Bruker PrarieView acquisition
29+
system
2130
+ Update - Changelog with tag links
2231

23-
2432
## [0.2.1] - 2022-07-13
2533

2634
+ Add - Adopt `black` formatting
@@ -33,7 +41,8 @@ Observes [Semantic Versioning](https://semver.org/spec/v2.0.0.html) standard and
3341
+ Add - Function `run_caiman` to trigger CNMF algorithm.
3442
+ Add - Function `ingest_csv_to_table` to insert data from CSV files into tables.
3543
+ Add - Function `recursive_search` to search through nested dictionary for a key.
36-
+ Add - Function `upload_to_dandi` to upload Neurodata Without Borders file to the DANDI platform.
44+
+ Add - Function `upload_to_dandi` to upload Neurodata Without Borders file to the DANDI
45+
platform.
3746
+ Update - Remove `extras_require` feature to allow this package to be published to PyPI.
3847

3948
## [0.1.0a1] - 2022-01-12
@@ -44,6 +53,7 @@ Observes [Semantic Versioning](https://semver.org/spec/v2.0.0.html) standard and
4453

4554
+ Add - Readers for: `ScanImage`, `Suite2p`, `CaImAn`.
4655

56+
[0.5.0]: https://github.com/datajoint/element-interface/releases/tag/0.5.0
4757
[0.4.2]: https://github.com/datajoint/element-interface/releases/tag/0.4.2
4858
[0.4.1]: https://github.com/datajoint/element-interface/releases/tag/0.4.1
4959
[0.4.0]: https://github.com/datajoint/element-interface/releases/tag/0.4.0

CONTRIBUTING.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
# Contribution Guidelines
22

3-
This project follows the [DataJoint Contribution Guidelines](https://docs.datajoint.io/python/community/02-Contribute.html). Please reference the link for more full details.
3+
This project follows the
4+
[DataJoint Contribution Guidelines](https://datajoint.com/docs/community/contribute/).
5+
Please reference the link for more full details.

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1818
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1919
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
2020
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21-
SOFTWARE.
21+
SOFTWARE.

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,5 @@ corresponding database tables that can be combined with other Elements to assemb
77
fully functional pipeline. Element Interface is home to a number of utilities that make
88
this possible.
99

10-
Installation and usage instructions can be found at the
10+
Installation and usage instructions can be found at the
1111
[Element documentation](https://datajoint.com/docs/elements/element-interface).

cspell.json

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
// cSpell Settings
2+
//https://github.com/streetsidesoftware/vscode-spell-checker
3+
{
4+
"version": "0.2", // Version of the setting file. Always 0.2
5+
"language": "en", // language - current active spelling language
6+
"enabledLanguageIds": [
7+
"markdown",
8+
"yaml"
9+
],
10+
// flagWords - list of words to be always considered incorrect
11+
// This is useful for offensive words and common spelling errors.
12+
// For example "hte" should be "the"
13+
"flagWords": [],
14+
"allowCompoundWords": true,
15+
"ignorePaths": [
16+
],
17+
"words": [
18+
"isort",
19+
"Bruker",
20+
"Neurodata",
21+
"Prairie",
22+
"CNMF",
23+
"deconvolution"
24+
]
25+
}

docs/mkdocs.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ nav:
4343
# HOST_UID=$(id -u) docker compose -f docs/docker-compose.yaml up --build
4444
# ```
4545
# 02. Site analytics depend on a local environment variable GOOGLE_ANALYTICS_KEY
46-
# You can find this in LastPass or declare with any string to suprress errors
46+
# You can find this in LastPass or declare with any string to suppress errors
4747
# 03. The API section will pull docstrings.
4848
# A. Follow google styleguide e.g.,
4949
# https://sphinxcontrib-napoleon.readthedocs.io/en/latest/example_google.html

docs/src/citation.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@ Resource Identifier (RRID).
88
Neurophysiology. bioRxiv. 2021 Jan 1. doi: https://doi.org/10.1101/2021.03.30.437358
99

1010
+ DataJoint Elements ([RRID:SCR_021894](https://scicrunch.org/resolver/SCR_021894)) -
11-
Element Interface (version {{ PATCH_VERSION }})
11+
Element Interface (version {{ PATCH_VERSION }})

docs/src/concepts.md

Lines changed: 23 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -11,26 +11,30 @@ across other packages, without causing issues in the respective Element.
1111

1212
### General utilities
1313

14-
`utils.find_full_path` and `utils.find_root_directory` are used
15-
across many Elements and Workflows to allow for the flexibility of providing
14+
`utils.find_full_path` and `utils.find_root_directory` are used
15+
across many Elements and Workflows to allow for the flexibility of providing
1616
one or more root directories in the user's config, and extrapolating from a relative
1717
path at runtime.
1818

19-
`utils.ingest_csv_to_table` is used across workflow examples to ingest from sample data from
20-
local CSV files into sets of manual tables. While researchers may wish to manually
19+
`utils.ingest_csv_to_table` is used across workflow examples to ingest from sample data
20+
from local CSV files into sets of manual tables. While researchers may wish to manually
2121
insert for day-to-day operations, it helps to have a more complete dataset when learning
2222
how to use various Elements.
2323

24+
`utils.str_to_bool` converts a set of strings to boolean True or False. This is implemented
25+
as the equivalent item in Python's `distutils` which will be removed in future versions.
26+
2427
### Suite2p
2528

2629
This Element provides functions to independently run Suite2p's motion correction,
2730
segmentation, and deconvolution steps. These functions currently work for single plane
28-
tiff files. If one is running all Suite2p pre-processing steps concurrently, these functions
29-
are not required and one can run `suite2p.run_s2p()`. The wrapper functions here were developed primarily because `run_s2p` cannot individually
30-
run deconvolution using the `spikedetect` flag (
31+
tiff files. If one is running all Suite2p pre-processing steps concurrently, these
32+
functions are not required and one can run `suite2p.run_s2p()`. The wrapper functions
33+
here were developed primarily because `run_s2p` cannot individually run deconvolution
34+
using the `spikedetect` flag (
3135
[Suite2p Issue #718](https://github.com/MouseLand/suite2p/issues/718)).
3236

33-
**Requirements**
37+
Requirements:
3438

3539
- [ops dictionary](https://suite2p.readthedocs.io/en/latest/settings.html)
3640

@@ -42,13 +46,13 @@ run deconvolution using the `spikedetect` flag (
4246

4347
### PrairieView Reader
4448

45-
This Element provides a function to read the PrairieView Scanner's metadata
46-
file. The PrairieView software generates one `.ome.tif` imaging file per frame acquired. The
47-
metadata for all frames is contained in one `.xml` file. This function locates the `.xml`
48-
file and generates a dictionary necessary to populate the DataJoint ScanInfo and
49-
Field tables. PrairieView works with resonance scanners with a single field,
50-
does not support bidirectional x and y scanning, and the `.xml` file does not
51-
contain ROI information.
49+
This Element provides a function to read the PrairieView Scanner's metadata file. The
50+
PrairieView software generates one `.ome.tif` imaging file per frame acquired. The
51+
metadata for all frames is contained in one `.xml` file. This function locates the
52+
`.xml` file and generates a dictionary necessary to populate the DataJoint ScanInfo and
53+
Field tables. PrairieView works with resonance scanners with a single field, does not
54+
support bidirectional x and y scanning, and the `.xml` file does not contain ROI
55+
information.
5256

5357
## Element Architecture
5458

@@ -58,14 +62,14 @@ module.
5862
- Acquisition packages: [ScanImage](../api/element_interface/scanimage_utils)
5963
- Analysis packages:
6064

61-
- Suite2p [loader](../api/element_interface/suite2p_loader) and [trigger](../api/element_interface/suite2p_trigger)
62-
63-
- CaImAn [loader](../api/element_interface/caiman_loader) and [trigger](../api/element_interface/run_caiman)
65+
- Suite2p [loader](../api/element_interface/suite2p_loader) and [trigger](../api/element_interface/suite2p_trigger)
66+
67+
- CaImAn [loader](../api/element_interface/caiman_loader) and [trigger](../api/element_interface/run_caiman)
6468

6569
- Data upload: [DANDI](../api/element_interface/dandi/)
6670

6771
## Roadmap
6872

6973
Further development of this Element is community driven. Upon user requests and based
7074
on guidance from the Scientific Steering Group we will additional features to
71-
this Element.
75+
this Element.

0 commit comments

Comments
 (0)