Skip to content

Commit b53cab3

Browse files
WilliamBergaminClaude
andauthored
fix: simplify scripts following bolt-python and python-sdk patterns (#95)
Co-authored-by: Claude <svc-devxp-claude@slack-corp.com>
1 parent 51b350d commit b53cab3

File tree

13 files changed

+80
-79
lines changed

13 files changed

+80
-79
lines changed

.github/maintainers_guide.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,14 @@ This project uses [mypy](https://mypy.readthedocs.io/en/stable/index.html) to ch
8484
./scripts/run_mypy.sh
8585
```
8686

87+
To clean your virtual environment (useful when testing scripts in isolation):
88+
89+
```sh
90+
./scripts/uninstall_all.sh
91+
```
92+
93+
> **Note**: Several scripts support a `--no-install` flag to prevent redundant dependency installation when scripts call other scripts internally.
94+
8795
#### Develop Locally
8896

8997
If you want to test the package locally you can.

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,3 +122,8 @@ cython_debug/
122122
# and can be added to the global gitignore or merged into this file. For a more nuclear
123123
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
124124
.idea/
125+
126+
# LLM
127+
.claude/
128+
.cursor/
129+

scripts/_utils.sh

Lines changed: 0 additions & 27 deletions
This file was deleted.

scripts/build_pypi_package.sh

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,14 @@
11
#!/bin/bash
2-
source ./scripts/_utils.sh
2+
script_dir=$(dirname $0)
3+
cd ${script_dir}/..
34

4-
set_prj_as_cwd
5+
# Clean previous builds
6+
rm -rf dist/ build/ slack_cli_hooks.egg-info/
57

6-
clean_project
8+
# Install build dependencies unless --no-install is specified
9+
if [[ "$1" != "--no-install" ]]; then
10+
pip install -r requirements/build.txt
11+
fi
712

8-
build
13+
# Build package
14+
python -m build && twine check dist/*

scripts/deploy_to_test_pypi.sh

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
#!/bin/bash
2-
source ./scripts/_utils.sh
2+
script_dir=$(dirname $0)
3+
cd ${script_dir}/..
34

4-
set_prj_as_cwd
5-
6-
clean_project
7-
8-
build
5+
./scripts/build_pypi_package.sh
96

7+
# Upload to test PyPI
108
twine upload --repository testpypi dist/*

scripts/format.sh

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
#!/bin/bash
2-
source ./scripts/_utils.sh
2+
script_dir=$(dirname $0)
3+
cd ${script_dir}/..
34

4-
set_prj_as_cwd
5+
# Install dependencies unless --no-install is specified
6+
if [[ "$1" != "--no-install" ]]; then
7+
pip install -U pip
8+
pip install -r requirements/dev-tools.txt
9+
fi
510

6-
pip install -U pip
7-
pip install -r requirements/format.txt
8-
9-
format
11+
black slack_cli_hooks/ tests/

scripts/install.sh

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
#!/bin/bash
2-
source ./scripts/_utils.sh
2+
script_dir=$(dirname $0)
3+
cd ${script_dir}/..
34

4-
set_prj_as_cwd
5-
6-
install_development_requirements
5+
pip install -U pip
6+
pip install -e .
7+
pip install -r requirements/testing.txt
8+
pip install -r requirements/dev-tools.txt

scripts/install_and_run_tests.sh

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,19 @@
22
# all: ./scripts/install_and_run_tests.sh
33
# single: ./scripts/install_and_run_tests.sh tests/scenario_tests/test_app.py
44

5-
test_target="$1"
6-
source ./scripts/_utils.sh
7-
8-
set_prj_as_cwd
5+
script_dir=$(dirname $0)
6+
cd ${script_dir}/..
97

10-
install_development_requirements
8+
test_target="$1"
119

12-
format
10+
./scripts/install.sh
11+
./scripts/format.sh --no-install
12+
./scripts/lint.sh --no-install
1313

14-
if [[ $test_target != "" ]]
15-
then
16-
pytest -vv $1
14+
# Run tests
15+
if [[ $test_target != "" ]]; then
16+
pytest -vv $test_target
1717
else
18-
pytest && \
19-
mypy --config-file pyproject.toml
18+
pytest
19+
./scripts/run_mypy.sh --no-install
2020
fi

scripts/lint.sh

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
#!/bin/bash
2-
3-
source ./scripts/_utils.sh
4-
5-
set_prj_as_cwd
6-
7-
pip install -U pip
8-
pip install -r requirements/format.txt
2+
script_dir=$(dirname $0)
3+
cd ${script_dir}/..
4+
5+
# Install dependencies unless --no-install is specified
6+
if [[ "$1" != "--no-install" ]]; then
7+
pip install -U pip
8+
pip install -r requirements/dev-tools.txt
9+
fi
910

1011
flake8 slack_cli_hooks/ && flake8 tests/

0 commit comments

Comments
 (0)