Skip to content

Commit bcf7ba9

Browse files
WilliamBergaminClaude
andcommitted
fix: improve script consistency and safety following bolt-python patterns
- Add -U flag to all pip install commands in install.sh for consistent upgrades - Add PIP_REQUIRE_VIRTUALENV=1 to lint.sh for virtualenv safety - Chain twine upload with && in deploy_to_test_pypi.sh for proper error handling - Simplify flake8 invocation (single command instead of two separate calls) - Quote all variables consistently across scripts for bash best practices - Always run format and lint before tests in install_and_run_tests.sh These changes align with bolt-python patterns and improve script reliability. Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
1 parent 32cfc23 commit bcf7ba9

File tree

8 files changed

+28
-29
lines changed

8 files changed

+28
-29
lines changed

scripts/build_pypi_package.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/bin/bash
22

3-
script_dir=$(dirname $0)
4-
cd ${script_dir}/..
3+
script_dir=$(dirname "$0")
4+
cd "${script_dir}/.."
55

66
rm -rf dist/ build/ slack_cli_hooks.egg-info/
77

scripts/deploy_to_test_pypi.sh

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
#!/bin/bash
22

3-
script_dir=$(dirname $0)
4-
cd ${script_dir}/..
3+
script_dir=$(dirname "$0")
4+
cd "${script_dir}/.."
55

66
rm -rf dist/ build/ slack_cli_hooks.egg-info/
77

88
pip install -r requirements/build.txt && \
99
python -m build && \
10-
twine check dist/*
11-
10+
twine check dist/* && \
1211
twine upload --repository testpypi dist/*

scripts/format.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
#!/bin/bash
22
# ./scripts/format.sh [--no-install]
33

4-
script_dir=$(dirname $0)
5-
cd ${script_dir}/..
4+
script_dir=$(dirname "$0")
5+
cd "${script_dir}/.."
66

77
if [[ "$1" != "--no-install" ]]; then
88
export PIP_REQUIRE_VIRTUALENV=1

scripts/install.sh

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
#!/bin/bash
22

3-
script_dir=$(dirname $0)
4-
cd ${script_dir}/..
3+
script_dir=$(dirname "$0")
4+
cd "${script_dir}/.."
55

66
export PIP_REQUIRE_VIRTUALENV=1
77
pip install -U pip
8-
pip install -e .
9-
pip install -r requirements/testing.txt
10-
pip install -r requirements/format.txt
8+
pip install -U -e .
9+
pip install -U -r requirements/testing.txt
10+
pip install -U -r requirements/format.txt

scripts/install_and_run_tests.sh

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,18 @@
33
# all: ./scripts/install_and_run_tests.sh
44
# single: ./scripts/install_and_run_tests.sh tests/scenario_tests/test_app.py
55

6-
script_dir=$(dirname $0)
7-
cd ${script_dir}/..
6+
script_dir=$(dirname "$0")
7+
cd "${script_dir}/.."
88

99
test_target="$1"
1010

1111
./scripts/install.sh
12+
./scripts/format.sh --no-install
13+
./scripts/lint.sh --no-install
1214

13-
if [[ $test_target != "" ]]
15+
if [[ "$test_target" != "" ]]
1416
then
15-
./scripts/format.sh --no-install
16-
pytest -vv $test_target
17+
pytest -vv "$test_target"
1718
else
18-
./scripts/format.sh --no-install
19-
./scripts/lint.sh --no-install
2019
pytest
2120
fi

scripts/lint.sh

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
#!/bin/bash
22
# ./scripts/lint.sh [--no-install]
33

4-
script_dir=$(dirname $0)
5-
cd ${script_dir}/..
4+
script_dir=$(dirname "$0")
5+
cd "${script_dir}/.."
66

77
if [[ "$1" != "--no-install" ]]; then
8+
export PIP_REQUIRE_VIRTUALENV=1
89
pip install -U pip
910
pip install -U -r requirements/format.txt
1011
fi
1112

1213
black --check slack_cli_hooks/ tests/
13-
flake8 slack_cli_hooks/ && flake8 tests/
14+
flake8 slack_cli_hooks/ tests/

scripts/run_mypy.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
#!/bin/bash
22
# ./scripts/run_mypy.sh [--no-install]
33

4-
script_dir=$(dirname $0)
5-
cd ${script_dir}/..
4+
script_dir=$(dirname "$0")
5+
cd "${script_dir}/.."
66

77
if [[ "$1" != "--no-install" ]]; then
88
./scripts/install.sh

scripts/run_tests.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,16 @@
33
# all: ./scripts/run_tests.sh
44
# single: ./scripts/run_tests.sh tests/scenario_tests/test_app.py
55

6-
script_dir=$(dirname $0)
7-
cd ${script_dir}/..
6+
script_dir=$(dirname "$0")
7+
cd "${script_dir}/.."
88

99
test_target="$1"
1010

1111
./scripts/format.sh --no-install
1212

13-
if [[ $test_target != "" ]]
13+
if [[ "$test_target" != "" ]]
1414
then
15-
pytest -vv $test_target
15+
pytest -vv "$test_target"
1616
else
1717
pytest
1818
fi

0 commit comments

Comments
 (0)