From db768158781e501f2f3f108d35ba537a8dd51fff Mon Sep 17 00:00:00 2001 From: William Bergamin Date: Mon, 9 Feb 2026 12:35:14 -0500 Subject: [PATCH 1/4] fix: simplify scripts following bolt-python and python-sdk patterns Remove shared utility file (scripts/_utils.sh) and make all scripts self-contained for improved readability and maintainability. Scripts now call each other to reduce duplication while keeping logic independently visible. Key changes: - Delete scripts/_utils.sh and inline all functions into scripts - Rename requirements/format.txt to requirements/dev-tools.txt (contains black, flake8, mypy) - Add --no-install flag to format.sh, lint.sh, run_mypy.sh, build_pypi_package.sh for composability - Scripts call other scripts (e.g., run_tests.sh calls format.sh --no-install) to avoid duplication - Improve uninstall_all.sh robustness with individual package uninstall loop - Update .gitignore to exclude .claude/ and .cursor/ directories All scripts follow consistent pattern: script_dir=$(dirname $0); cd ${script_dir}/.. Co-Authored-By: Claude --- .gitignore | 5 ++++ requirements/{format.txt => dev-tools.txt} | 0 scripts/_utils.sh | 27 ---------------------- scripts/build_pypi_package.sh | 14 +++++++---- scripts/deploy_to_test_pypi.sh | 10 ++++---- scripts/format.sh | 14 ++++++----- scripts/install.sh | 10 ++++---- scripts/install_and_run_tests.sh | 21 ++++++++--------- scripts/lint.sh | 15 ++++++------ scripts/run_mypy.sh | 11 +++++---- scripts/run_tests.sh | 14 +++++------ scripts/uninstall_all.sh | 10 ++++++-- 12 files changed, 72 insertions(+), 79 deletions(-) rename requirements/{format.txt => dev-tools.txt} (100%) delete mode 100644 scripts/_utils.sh diff --git a/.gitignore b/.gitignore index 0f1359b..a0a4ac7 100644 --- a/.gitignore +++ b/.gitignore @@ -122,3 +122,8 @@ cython_debug/ # and can be added to the global gitignore or merged into this file. For a more nuclear # option (not recommended) you can uncomment the following to ignore the entire idea folder. .idea/ + +# LLM +.claude/ +.cursor/ + diff --git a/requirements/format.txt b/requirements/dev-tools.txt similarity index 100% rename from requirements/format.txt rename to requirements/dev-tools.txt diff --git a/scripts/_utils.sh b/scripts/_utils.sh deleted file mode 100644 index 73ee0b6..0000000 --- a/scripts/_utils.sh +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/bash - -set_prj_as_cwd() { - script_dir=`dirname $0` - cd ${script_dir}/.. -} - -clean_project() { - rm -rf dist/ build/ slack_cli_hooks.egg-info/ -} - -install_development_requirements() { - pip install -U pip - pip install -e . - pip install -r requirements/testing.txt - pip install -r requirements/format.txt -} - -build() { - pip install -r requirements/build.txt && \ - python -m build && \ - twine check dist/* -} - -format() { - black slack_cli_hooks/ tests/ -} diff --git a/scripts/build_pypi_package.sh b/scripts/build_pypi_package.sh index 1f6e893..d1f71f7 100755 --- a/scripts/build_pypi_package.sh +++ b/scripts/build_pypi_package.sh @@ -1,8 +1,14 @@ #!/bin/bash -source ./scripts/_utils.sh +script_dir=$(dirname $0) +cd ${script_dir}/.. -set_prj_as_cwd +# Clean previous builds +rm -rf dist/ build/ slack_cli_hooks.egg-info/ -clean_project +# Install build dependencies unless --no-install is specified +if [[ "$1" != "--no-install" ]]; then + pip install -r requirements/build.txt +fi -build +# Build package +python -m build && twine check dist/* diff --git a/scripts/deploy_to_test_pypi.sh b/scripts/deploy_to_test_pypi.sh index 57d2f22..ac0c0e3 100755 --- a/scripts/deploy_to_test_pypi.sh +++ b/scripts/deploy_to_test_pypi.sh @@ -1,10 +1,8 @@ #!/bin/bash -source ./scripts/_utils.sh +script_dir=$(dirname $0) +cd ${script_dir}/.. -set_prj_as_cwd - -clean_project - -build +./scripts/build_pypi_package.sh +# Upload to test PyPI twine upload --repository testpypi dist/* diff --git a/scripts/format.sh b/scripts/format.sh index d0b21ce..dd76af0 100755 --- a/scripts/format.sh +++ b/scripts/format.sh @@ -1,9 +1,11 @@ #!/bin/bash -source ./scripts/_utils.sh +script_dir=$(dirname $0) +cd ${script_dir}/.. -set_prj_as_cwd +# Install dependencies unless --no-install is specified +if [[ "$1" != "--no-install" ]]; then + pip install -U pip + pip install -r requirements/dev-tools.txt +fi -pip install -U pip -pip install -r requirements/format.txt - -format +black slack_cli_hooks/ tests/ diff --git a/scripts/install.sh b/scripts/install.sh index bf45bc9..94284f0 100755 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -1,6 +1,8 @@ #!/bin/bash -source ./scripts/_utils.sh +script_dir=$(dirname $0) +cd ${script_dir}/.. -set_prj_as_cwd - -install_development_requirements +pip install -U pip +pip install -e . +pip install -r requirements/testing.txt +pip install -r requirements/dev-tools.txt diff --git a/scripts/install_and_run_tests.sh b/scripts/install_and_run_tests.sh index e6fdcc2..263b9b4 100755 --- a/scripts/install_and_run_tests.sh +++ b/scripts/install_and_run_tests.sh @@ -2,19 +2,18 @@ # all: ./scripts/install_and_run_tests.sh # single: ./scripts/install_and_run_tests.sh tests/scenario_tests/test_app.py -test_target="$1" -source ./scripts/_utils.sh - -set_prj_as_cwd +script_dir=$(dirname $0) +cd ${script_dir}/.. -install_development_requirements +test_target="$1" -format +./scripts/install.sh +./scripts/format.sh --no-install +./scripts/lint.sh --no-install -if [[ $test_target != "" ]] -then - pytest -vv $1 +# Run tests +if [[ $test_target != "" ]]; then + pytest -vv $test_target else - pytest && \ - mypy --config-file pyproject.toml + pytest && mypy --config-file pyproject.toml fi diff --git a/scripts/lint.sh b/scripts/lint.sh index 0f86131..ce1efae 100755 --- a/scripts/lint.sh +++ b/scripts/lint.sh @@ -1,10 +1,11 @@ #!/bin/bash - -source ./scripts/_utils.sh - -set_prj_as_cwd - -pip install -U pip -pip install -r requirements/format.txt +script_dir=$(dirname $0) +cd ${script_dir}/.. + +# Install dependencies unless --no-install is specified +if [[ "$1" != "--no-install" ]]; then + pip install -U pip + pip install -r requirements/dev-tools.txt +fi flake8 slack_cli_hooks/ && flake8 tests/ diff --git a/scripts/run_mypy.sh b/scripts/run_mypy.sh index 706b3f2..d3c9cde 100755 --- a/scripts/run_mypy.sh +++ b/scripts/run_mypy.sh @@ -1,9 +1,10 @@ #!/bin/bash +script_dir=$(dirname $0) +cd ${script_dir}/.. -source ./scripts/_utils.sh - -set_prj_as_cwd - -install_development_requirements +# Install dependencies unless --no-install is specified +if [[ "$1" != "--no-install" ]]; then + ./scripts/install.sh +fi mypy --config-file pyproject.toml diff --git a/scripts/run_tests.sh b/scripts/run_tests.sh index fd91348..3e64c7d 100755 --- a/scripts/run_tests.sh +++ b/scripts/run_tests.sh @@ -2,16 +2,16 @@ # all: ./scripts/run_tests.sh # single: ./scripts/run_tests.sh tests/scenario_tests/test_app.py -test_target="$1" -source ./scripts/_utils.sh +script_dir=$(dirname $0) +cd ${script_dir}/.. -set_prj_as_cwd +test_target="$1" -format +./scripts/format.sh --no-install -if [[ $test_target != "" ]] -then - pytest -vv $1 +# Run tests +if [[ $test_target != "" ]]; then + pytest -vv $test_target else pytest fi diff --git a/scripts/uninstall_all.sh b/scripts/uninstall_all.sh index 15f5527..85e7c4a 100755 --- a/scripts/uninstall_all.sh +++ b/scripts/uninstall_all.sh @@ -1,4 +1,10 @@ #!/bin/bash -pip uninstall -y slack-cli-hooks && \ - pip freeze | grep -v "^-e" | xargs pip uninstall -y +# Remove slack-cli-hooks without a version specifier so that local builds are cleaned up +pip uninstall -y slack-cli-hooks +# Collect all installed packages +PACKAGES=$(pip freeze | grep -v "^-e" | sed 's/@.*//' | sed 's/\=\=.*//') +# Uninstall packages without exiting on a failure +for package in $PACKAGES; do + pip uninstall -y $package +done From 799f979363108b04d6dbaffc38cd92b964290c14 Mon Sep 17 00:00:00 2001 From: William Bergamin Date: Mon, 9 Feb 2026 14:47:57 -0500 Subject: [PATCH 2/4] Update maintainers_guide.md --- .github/maintainers_guide.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.github/maintainers_guide.md b/.github/maintainers_guide.md index f19f3b9..5669a58 100644 --- a/.github/maintainers_guide.md +++ b/.github/maintainers_guide.md @@ -84,6 +84,13 @@ This project uses [mypy](https://mypy.readthedocs.io/en/stable/index.html) to ch ./scripts/run_mypy.sh ``` +To clean your virtual environment (useful when testing scripts in isolation): + +./scripts/uninstall_all.sh +``` + +> **Note**: Several scripts support a `--no-install` flag to prevent redundant dependency installation when scripts call other scripts internally. + #### Develop Locally If you want to test the package locally you can. From efc12e1b2c0043a33da81135cc4ee36057716871 Mon Sep 17 00:00:00 2001 From: William Bergamin Date: Mon, 9 Feb 2026 14:48:06 -0500 Subject: [PATCH 3/4] Update maintainers_guide.md --- .github/maintainers_guide.md | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/maintainers_guide.md b/.github/maintainers_guide.md index 5669a58..b86b0b9 100644 --- a/.github/maintainers_guide.md +++ b/.github/maintainers_guide.md @@ -86,6 +86,7 @@ This project uses [mypy](https://mypy.readthedocs.io/en/stable/index.html) to ch To clean your virtual environment (useful when testing scripts in isolation): +```sh ./scripts/uninstall_all.sh ``` From f1d06ff8ce85425b44269af37d51b63fdaf32bbb Mon Sep 17 00:00:00 2001 From: William Bergamin Date: Tue, 10 Feb 2026 12:11:08 -0500 Subject: [PATCH 4/4] minor improvements --- scripts/install_and_run_tests.sh | 3 ++- scripts/uninstall_all.sh | 5 ++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/install_and_run_tests.sh b/scripts/install_and_run_tests.sh index 263b9b4..f77ee0b 100755 --- a/scripts/install_and_run_tests.sh +++ b/scripts/install_and_run_tests.sh @@ -15,5 +15,6 @@ test_target="$1" if [[ $test_target != "" ]]; then pytest -vv $test_target else - pytest && mypy --config-file pyproject.toml + pytest + ./scripts/run_mypy.sh --no-install fi diff --git a/scripts/uninstall_all.sh b/scripts/uninstall_all.sh index 85e7c4a..9b006b6 100755 --- a/scripts/uninstall_all.sh +++ b/scripts/uninstall_all.sh @@ -1,10 +1,9 @@ #!/bin/bash -# Remove slack-cli-hooks without a version specifier so that local builds are cleaned up pip uninstall -y slack-cli-hooks -# Collect all installed packages + PACKAGES=$(pip freeze | grep -v "^-e" | sed 's/@.*//' | sed 's/\=\=.*//') -# Uninstall packages without exiting on a failure + for package in $PACKAGES; do pip uninstall -y $package done