forked from oceanmodeling/searvey
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update pre-commit, linting and dev requirements
1. Disable autofix from pre-commit.ci 2. Add `nbstripout` in pre-commit which is a tool for stripping output from jupyter notebooks. This is useful for keeping notebook size small and notebook diffs (semi-)sane. 3. Replace `prospector` with `ruff`. `ruff` is way faster and works great as a pre-commit hook. Furthermore is under very active development and it is quite easy to enable more checks. 4. Remove deptry. 5. Require poetry 1.2+ for development since we make use of dependency groups. For example in the sample notebooks we use use `matplotlib` for visualization and `scipy` for filling missing IOC data. These are **not** `searvey` dependencies. They are just something we chose to use in our examples. In this sense it doesn't make sense to have them as "extras", because installing them will not add any functionality to `searvey`. Still we want them to be present in the dev environment in order to be able to develop/use the notebooks. Dependency groups is an elegant way to both allow installing them and to keep them separated from "core" and "dev" dependencies. Note: I removed `black` and `ruff` from the dev-dependencies because we can run them through pre-commit. The benefit of this approach is that these tools run into their own dedicated environments and thus we have fewer dependencies in the searvey environment. Running them should be done with `make style` and `make lint` respectively.
- Loading branch information
Showing
18 changed files
with
1,389 additions
and
7,790 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 |
---|---|---|
|
@@ -143,3 +143,5 @@ cython_debug/ | |
|
||
Notebooks/ | ||
conda.recipe/ | ||
|
||
ignored/ |
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 was deleted.
Oops, something went wrong.
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,18 +1,31 @@ | ||
.PHONY: list docs | ||
|
||
list: | ||
@LC_ALL=C $(MAKE) -pRrq -f $(lastword $(MAKEFILE_LIST)) : 2>/dev/null | awk -v RS= -F: '/^# File/,/^# Finished Make data base/ {if ($$1 !~ "^[#.]") {print $$1}}' | sort | egrep -v -e '^[^[:alnum:]]' -e '^$@$$' | ||
@LC_ALL=C $(MAKE) -pRrq -f $(lastword $(MAKEFILE_LIST)) : 2>/dev/null | awk -v RS= -F: '/^# File/,/^# Finished Make data base/ {if ($$1 !~ "^[#.]") {print $$1}}' | sort | grep -E -v -e '^[^[:alnum:]]' -e '^$@$$' | ||
|
||
init: | ||
poetry install --with dev --with docs --with jupyter --sync | ||
pre-commit install | ||
|
||
style: | ||
pre-commit run black -a | ||
|
||
lint: | ||
prospector --absolute-paths --no-external-config --profile-path .prospector.yaml -w profile-validator searvey | ||
pre-commit run ruff -a | ||
|
||
mypy: | ||
dmypy run searvey | ||
|
||
test: | ||
python -m pytest -vlx | ||
|
||
cov: | ||
coverage erase | ||
python -m pytest --cov=searvey -n auto --durations=10 | ||
|
||
docs: | ||
make -C docs html | ||
|
||
deps: | ||
deptry --ignore-notebooks ./ | ||
poetry export --without-hashes -f requirements.txt -o requirements/requirements.txt | ||
poetry export --without-hashes -f requirements.txt --with dev -o requirements/requirements-dev.txt | ||
pre-commit run poetry-lock -a | ||
pre-commit run poetry-export -a |
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.