-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* styling actions inspired by iohub * iohub -> waveorder * skip flake8 * black and isort * fix gh action * black versioning * black versioning * remove mention of flake8
- Loading branch information
1 parent
1451bf1
commit 1f84072
Showing
39 changed files
with
462 additions
and
237 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,101 @@ | ||
# This workflow will install Python dependencies, run tests and lint with a single version of Python | ||
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions | ||
|
||
name: lint, style, and tests | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
style: | ||
name: Style Check | ||
runs-on: ubuntu-latest | ||
|
||
strategy: | ||
matrix: | ||
python-version: ["3.10"] | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Set up Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install black==25.1.0 | ||
- name: Check code styling with Black | ||
run: | | ||
black --diff -S -t py310 waveorder | ||
black --check -S -t py310 waveorder | ||
# lint: | ||
# name: Lint Check | ||
# runs-on: ubuntu-latest | ||
|
||
# strategy: | ||
# matrix: | ||
# python-version: ["3.10"] | ||
|
||
# steps: | ||
# - uses: actions/checkout@v3 | ||
# - name: Set up Python | ||
# uses: actions/setup-python@v4 | ||
# with: | ||
# python-version: ${{ matrix.python-version }} | ||
# - name: Install dependencies | ||
# run: | | ||
# python -m pip install --upgrade pip | ||
# pip install flake8 | ||
# - name: Check code with Flake8 | ||
# # E203 conflicts with black | ||
# run: | | ||
# flake8 waveorder --extend-ignore=E203 | ||
|
||
isort: | ||
name: isort Check | ||
runs-on: ubuntu-latest | ||
|
||
strategy: | ||
matrix: | ||
python-version: ["3.10"] | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Set up Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install isort | ||
- name: Check code with isort | ||
run: | | ||
isort --check waveorder | ||
tests: | ||
needs: [style, isort] # lint | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
python-version: ["3.10", "3.11", "3.12"] | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- uses: actions/setup-python@v4 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
|
||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install ".[dev]" | ||
- name: Test with pytest | ||
run: | | ||
pytest -v --cov=./ --cov-report=xml |
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,34 @@ | ||
|
||
repos: | ||
# basic pre-commit | ||
- repo: https://github.com/pre-commit/pre-commit-hooks | ||
rev: v4.4.0 | ||
hooks: | ||
- id: trailing-whitespace | ||
- id: end-of-file-fixer | ||
- id: check-added-large-files | ||
- id: check-yaml | ||
- id: check-toml | ||
- id: detect-private-key | ||
# sorting imports | ||
- repo: https://github.com/pycqa/isort | ||
rev: 5.12.0 | ||
hooks: | ||
- id: isort | ||
# syntax linting and formatting | ||
- repo: https://github.com/myint/autoflake | ||
rev: v2.1.1 | ||
hooks: | ||
- id: autoflake | ||
args: [--in-place, --remove-all-unused-imports, | ||
--ignore-init-module-imports] | ||
# - repo: https://github.com/PyCQA/flake8 | ||
# rev: 6.0.0 | ||
# hooks: | ||
# - id: flake8 | ||
# args: [--ignore, "E203,W503", --min-python-version, '3.10'] | ||
# additional_dependencies: [flake8-typing-imports==1.12.0] | ||
- repo: https://github.com/psf/black | ||
rev: 25.1.0 | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
# Contributing guide | ||
|
||
Thanks for your interest in contributing to `waveorder`! | ||
|
||
Please see the following steps for our workflow. | ||
|
||
## Getting started | ||
|
||
Please read the [README](./README.md) for an overview of the project, | ||
and how you can install and use the package. | ||
|
||
## Issues | ||
|
||
We use [issues](https://github.com/mehta-lab/waveorder/issues) to track | ||
bug reports, feature requests, and provide user support. | ||
|
||
Before opening a new issue, please first search existing issues (including closed ones), | ||
to see if there is an existing discussion about it. | ||
|
||
### Setting up development environment | ||
|
||
For local development, first install [Git](https://git-scm.com/) | ||
and Python with an environment management tool | ||
(e.g. [miniforge](https://github.com/conda-forge/miniforge), a minimal community distribution of Conda). | ||
|
||
If you use Conda, set up an environment with: | ||
|
||
```sh | ||
conda create -n waveorder-dev python=3.10 | ||
conda activate waveorder-dev | ||
``` | ||
|
||
If you have push permission to the repository, | ||
clone the repository (the code blocks below are shell commands): | ||
|
||
```sh | ||
cd # to the directory you want to work in | ||
git clone https://github.com/mehta-lab/waveorder.git | ||
``` | ||
|
||
Otherwise, you can follow [these instructions](https://docs.github.com/en/get-started/quickstart/fork-a-repo) | ||
to [fork](https://github.com/mehta-lab/waveorder/fork) the repository. | ||
|
||
Then install the package in editable mode with the development dependencies: | ||
|
||
```sh | ||
cd waveorder/ # or the renamed project root directory | ||
pip install -e ".[dev]" | ||
``` | ||
|
||
Then make the changes and [track them with Git](https://docs.github.com/en/get-started/using-git/about-git#example-contribute-to-an-existing-repository). | ||
|
||
|
||
### Code style | ||
|
||
We use [pre-commit](https://pre-commit.com/) to sort imports with [isort](https://github.com/PyCQA/isort) and format code with [black](https://black.readthedocs.io/en/stable/) automatically prior to each commit. To minimize test errors when submitting pull requests, please install pre-commit in your environment as follows: | ||
|
||
```bash | ||
pre-commit install | ||
``` | ||
|
||
When these packages are executed within the project root directory, they should automatically use the [project settings](./pyproject.toml). |
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
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
Oops, something went wrong.