# execute default build default: fmt # builds the python module using poetry # build: # echo "building..." # poetry build # print a message displaying whether nix is being used checknix: #!/usr/bin/env bash set -euxo pipefail if [[ "${DO_NIX_CUSTOM:=0}" -eq 1 ]]; then echo "In an interactive nix env." else echo "Using poetry as runner, no nix detected." fi # update all test snapshots, use if snapshots are out of date update-snapshots: #!/usr/bin/env bash set -euxo pipefail if [[ "${DO_NIX_CUSTOM:=0}" -eq 1 ]]; then pytest --snapshot-update else poetry run pytest --snapshot-update fi # run all tests test: fmt #!/usr/bin/env bash set -euxo pipefail if [[ "${DO_NIX_CUSTOM:=0}" -eq 1 ]]; then echo "testing, using nix..." flake8 kalpaa tests mypy kalpaa pytest else echo "testing..." poetry run flake8 kalpaa tests poetry run mypy kalpaa poetry run pytest fi # format code fmt: #!/usr/bin/env bash set -euxo pipefail if [[ "${DO_NIX_CUSTOM:=0}" -eq 1 ]]; then black . else poetry run black . fi find kalpaa -type f -name "*.py" -exec sed -i -e 's/ /\t/g' {} \; # find bin -type f -name "*.py" -exec sed -i -e 's/ /\t/g' {} \; find tests -type f -name "*.py" -exec sed -i -e 's/ /\t/g' {} \; # release the app, checking that our working tree is clean and ready for release, optionally takes target version release version="": #!/usr/bin/env bash set -euxo pipefail if [[ -n "{{version}}" ]]; then ./scripts/release.sh {{version}} else ./scripts/release.sh fi # htmlcov: # poetry run pytest --cov-report=html # build docker image build-container: #!/usr/bin/env bash set -euxo pipefail nix build .#kalpaa-docker-image # load the image into docker load-container: #!/usr/bin/env bash set -euxo pipefail docker load < result # build and load in one step build-load-container: build-container load-container echo "Image loaded successfully!" exec-container: #!/usr/bin/env bash set -euxo pipefail docker run -it -v $(pwd)/kalpaa.toml:/workspace/kalpaa.toml -v $(pwd)/dots.json:/workspace/dots.json -v $(pwd)/indexes.json:/workspace/indexes.json kalpaa /bin/bash