-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add makefile to simplify common commands
Such as linting, testing, type-checking etc. Also reformat the code to pass the linting and type-checking requirements.
- Loading branch information
Showing
32 changed files
with
411 additions
and
309 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
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,30 @@ | ||
repos: | ||
- repo: https://github.com/pre-commit/pre-commit-hooks | ||
rev: v3.2.0 | ||
hooks: | ||
- id: trailing-whitespace | ||
- id: end-of-file-fixer | ||
|
||
- repo: local | ||
hooks: | ||
- id: ruff | ||
name: Autoformat python code | ||
language: system | ||
entry: bash | ||
args: [-c, "make format"] | ||
|
||
- repo: local | ||
hooks: | ||
- id: ruff | ||
name: Lint python code | ||
language: system | ||
entry: bash | ||
args: [-c, "make lint"] | ||
|
||
- repo: local | ||
hooks: | ||
- id: mypy | ||
name: Type check python code | ||
language: system | ||
entry: bash | ||
args: [-c, "make type-check"] |
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,3 +1,3 @@ | ||
include CODE_OF_CONDUCT.md | ||
|
||
global-exclude *.py[cod] __pycache__ *.so | ||
global-exclude *.py[cod] __pycache__ *.so |
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,36 @@ | ||
PACKAGE_NAME := red | ||
PACKAGE_DIR := red | ||
|
||
CONDA_ENV_RUN = conda run --no-capture-output --name $(PACKAGE_NAME) | ||
|
||
TEST_ARGS := -v --cov=$(PACKAGE_NAME) --cov-report=term --cov-report=xml --junitxml=unit.xml --color=yes | ||
|
||
.PHONY: env lint format test type-check docs-build docs-deploy | ||
|
||
env: | ||
mamba create --name $(PACKAGE_NAME) | ||
mamba env update --name $(PACKAGE_NAME) --file devtools/conda-envs/test.yaml | ||
$(CONDA_ENV_RUN) pip install --no-deps -e . | ||
$(CONDA_ENV_RUN) pre-commit install || true | ||
|
||
lint: | ||
$(CONDA_ENV_RUN) ruff check $(PACKAGE_DIR) | ||
|
||
format: | ||
$(CONDA_ENV_RUN) ruff format $(PACKAGE_DIR) | ||
$(CONDA_ENV_RUN) ruff check --fix --select I $(PACKAGE_DIR) | ||
|
||
test: | ||
$(CONDA_ENV_RUN) pytest -v $(TEST_ARGS) $(PACKAGE_DIR)/tests/ | ||
|
||
type-check: | ||
$(CONDA_ENV_RUN) mypy --follow-imports=silent --ignore-missing-imports --strict $(PACKAGE_DIR) | ||
|
||
docs-build: | ||
$(CONDA_ENV_RUN) mkdocs build | ||
|
||
docs-deploy: | ||
ifndef VERSION | ||
$(error VERSION is not set) | ||
endif | ||
$(CONDA_ENV_RUN) mike deploy --push --update-aliases $(VERSION) |
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,15 @@ | ||
name: red | ||
|
||
channels: | ||
- conda-forge | ||
- defaults | ||
|
||
dependencies: | ||
# Base depends | ||
- python | ||
- pip | ||
- numpy | ||
- numba | ||
- scipy | ||
- matplotlib | ||
- statsmodels |
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
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.