Skip to content

Commit

Permalink
release 0.5.1
Browse files Browse the repository at this point in the history
  • Loading branch information
tillbiskup committed Feb 24, 2024
2 parents a1ab57d + 4daea9a commit 01ed455
Show file tree
Hide file tree
Showing 41 changed files with 2,426 additions and 1,429 deletions.
4 changes: 4 additions & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# First black run on all code
7cd00161dece9ce2a1d9387bd48e569f59f851bf
# Second black run
d3c260e9fb64fab2c4b9cb7d58e05f7d8ca0424e
7 changes: 7 additions & 0 deletions .prospector.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,13 @@ pylint:
max-attributes: 12
max-module-lines: 3000

pycodestyle:
disable:
- E203
- W503
enable:
- W504

pyroma:
run: true

Expand Down
33 changes: 33 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Minimal Makefile for automating recurring tasks during development
#
# Copyright (c) 2023, Till Biskup
# 2023-12-06

.PHONY: docs tests help
.DEFAULT_GOAL := help

help:
@echo "This makefile automates different recurring tasks"
@echo ""
@echo "The following targets are available:"
@echo ""
@echo "docs - create documentation using Sphinx"
@echo "tests - run unittests"
@echo "check - check code using prospector"
@echo "black - format code using Black"

docs:
@echo "Create documentation using Sphinx"
$(MAKE) -C docs html

tests:
@echo "Run unittests"
cd tests/ && python -m unittest discover -s . -t .

check:
@echo "Check code using prospector... this may take a while"
prospector

black:
@echo "Automatically format code using Black"
black -l 78 . --extend-exclude templates
3 changes: 2 additions & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ What is even better: Actual data processing and analysis **no longer requires pr
- first-dataset.pdf
- second-dataset.pdf

For more general information on the cwepr package and for how to use it, see its `documentation <https://doc.cwepr.de/>`_.
For more general information on the cwepr package and for how to use it, see
its `documentation <https://docs.cwepr.de/>`_.


Features
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.5.0
0.5.1
43 changes: 43 additions & 0 deletions bin/formatPythonCode.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#!/usr/bin/env bash
#
# Autoformat Python files currently in git staging area.
#
# Intended for using in pre-commit hook
#
# Formatter, formatter options and exclude pattern can be set.
#
# Note that due to calling the formatter explicitly for files, exclude patterns
# via formatter options are likely to not work. Hence the list of files to be
# reformatted needs to be filtered beforehand.
#
# Existence of the formatter is checked, and if it is not present,
# the script silently exits.
#
# Only Python files in the staging area are reformatted and afterwards
# re-added to the staging area.
#
# Copyright (c) 2023, Till Biskup
# 2023-12-06

FORMATTER="black"
FORMATTER_OPTIONS="-l 78"
EXCLUDE_PATTERN="templates"

if ! command -v $FORMATTER &> /dev/null
then
exit
fi

if \[ -n "$EXCLUDE_PATTERN" \];
then
CHANGED_FILES=$(git diff --cached --name-only --diff-filter=ACMR -- '*.py' | grep -v $EXCLUDE_PATTERN)
else
CHANGED_FILES=$(git diff --cached --name-only --diff-filter=ACMR -- '*.py')
fi

for file in $CHANGED_FILES
do
echo "Reformat '$file' using '$FORMATTER $FORMATTER_OPTIONS'"
$FORMATTER $FORMATTER_OPTIONS "$file"
git add "$file"
done
Loading

0 comments on commit 01ed455

Please sign in to comment.