-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #23 from Aharoni-Lab/linting
Linting - add Ruff and Black
- Loading branch information
Showing
33 changed files
with
1,130 additions
and
511 deletions.
There are no files selected for viewing
This file contains 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,17 @@ | ||
name: Lint | ||
|
||
on: | ||
push: | ||
|
||
jobs: | ||
ruff: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: chartboost/ruff-action@v1 | ||
|
||
black: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: psf/black@stable |
This file contains 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 |
---|---|---|
|
@@ -2,7 +2,6 @@ name: Run Python tests | |
|
||
on: | ||
push: | ||
pull_request: | ||
workflow_dispatch: | ||
|
||
jobs: | ||
|
This file contains 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,10 @@ | ||
repos: | ||
- repo: https://github.com/astral-sh/ruff-pre-commit | ||
rev: v0.4.10 | ||
hooks: | ||
- id: ruff | ||
args: [ --fix ] | ||
- repo: https://github.com/psf/black | ||
rev: 24.1.1 | ||
hooks: | ||
- id: black |
This file contains 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 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,71 @@ | ||
# Contributing | ||
|
||
Standard flow: | ||
- Fork the repository | ||
- Create a new branch from `main` | ||
- ~ do work ~ | ||
- Open pull request against `miniscope-io:main` | ||
- Code review and discussion happens | ||
- Merge contribution | ||
|
||
normal i guess. | ||
|
||
## Norms | ||
|
||
- All new code should be tested if possible. Since this is a hardware | ||
interface package, some things may be impossible to test. For any | ||
major new hardware functionality, a mock class should be written | ||
to isolate software and hardware testing. | ||
- All modifications to code should be documented: this includes both | ||
API documentation in docstrings as well as narrative usage documentation | ||
in the `docs` directory. | ||
|
||
## Code of Conduct | ||
|
||
(forthcoming, for now BDFLs enforce kindness and inclusiveness with their | ||
arbitrary and expansive power) | ||
|
||
## Development Environment | ||
|
||
Install using the `dev` extra, which should have all other extras in it | ||
|
||
```shell | ||
poetry install --extras dev | ||
# or | ||
pip install '.[dev]' | ||
``` | ||
|
||
### Linting | ||
|
||
`miniscope-io` uses `black` for code formatting and `ruff` for linting. | ||
We recommend you configure your IDE to do both automatically. | ||
|
||
There are a few ways you can run linting manually: | ||
|
||
First, just by running the raw commands: | ||
|
||
```shell | ||
ruff check --fix | ||
black miniscope_io | ||
``` | ||
|
||
Or you can use the `pre-commit` action to automatically run them | ||
before committing code: | ||
|
||
```shell | ||
pre-commit install | ||
``` | ||
|
||
Or you can use the `noxfile.py` | ||
|
||
```shell | ||
# just lint without formatting | ||
nox -s lint | ||
# lint and apply formatting | ||
nox -s format | ||
``` | ||
|
||
|
||
|
||
|
||
|
This file contains 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 |
---|---|---|
|
@@ -3,6 +3,7 @@ | |
|
||
```{toctree} | ||
changelog | ||
contributing | ||
todo | ||
``` | ||
|
This file contains 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 |
---|---|---|
@@ -1,19 +1,23 @@ | ||
""" | ||
I/O SDK for UCLA Miniscopes | ||
""" | ||
|
||
from pathlib import Path | ||
|
||
from miniscope_io.models.config import Config | ||
from miniscope_io.logging import init_logger | ||
from miniscope_io.io import SDCard | ||
from miniscope_io.logging import init_logger | ||
from miniscope_io.models.config import Config | ||
|
||
BASE_DIR = Path(__file__).parent.resolve() | ||
DATA_DIR = BASE_DIR / 'data' | ||
CONFIG_DIR = DATA_DIR / 'config' | ||
DEVICE_DIR = BASE_DIR / 'devices' | ||
DATA_DIR = BASE_DIR / "data" | ||
CONFIG_DIR = DATA_DIR / "config" | ||
DEVICE_DIR = BASE_DIR / "devices" | ||
|
||
__all__ = [ | ||
'BASE_DIR', | ||
'DATA_DIR', | ||
'CONFIG_DIR', | ||
'Config', | ||
'SDCard', | ||
'init_logger', | ||
] | ||
"BASE_DIR", | ||
"DATA_DIR", | ||
"CONFIG_DIR", | ||
"Config", | ||
"SDCard", | ||
"init_logger", | ||
] |
This file contains 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 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 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 @@ | ||
""" | ||
Control interfaces for external hardware devices | ||
""" |
Oops, something went wrong.