Skip to content

Commit 51b350d

Browse files
WilliamBergaminClaude
andcommitted
Revert "fix: improve development scripts with CI optimization and safety guards"
This reverts commits 32cfc23 and bcf7ba9. These commits were mistakenly pushed directly to main instead of being kept on the feature branch. The work will continue on the improve-python-slack-hooks-scripts branch. Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
1 parent bcf7ba9 commit 51b350d

10 files changed

Lines changed: 70 additions & 102 deletions

README.md

Lines changed: 0 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -63,47 +63,6 @@ Below is an example `/slack.json` file that overrides the default `start`:
6363
}
6464
```
6565

66-
## Development Scripts
67-
68-
### Quick Reference
69-
70-
```bash
71-
# Run tests with installation and formatting
72-
./scripts/install_and_run_tests.sh
73-
74-
# Run tests with formatting (no install)
75-
./scripts/run_tests.sh
76-
77-
# Run single test file
78-
./scripts/run_tests.sh tests/scenario_tests/test_app.py
79-
80-
# Format code
81-
./scripts/format.sh
82-
83-
# Lint code (format check + flake8)
84-
./scripts/lint.sh
85-
86-
# Type check
87-
./scripts/run_mypy.sh
88-
89-
# Install dependencies
90-
./scripts/install.sh
91-
92-
# Build package
93-
./scripts/build_pypi_package.sh
94-
```
95-
96-
### Script Options
97-
98-
Most scripts support `--no-install` flag to skip dependency installation:
99-
```bash
100-
./scripts/format.sh --no-install
101-
./scripts/lint.sh --no-install
102-
./scripts/run_mypy.sh --no-install
103-
```
104-
105-
This is useful in CI or when dependencies are already installed.
106-
10766
## Contributing
10867

10968
Contributions are always welcome! Please review the

scripts/_utils.sh

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#!/bin/bash
2+
3+
set_prj_as_cwd() {
4+
script_dir=`dirname $0`
5+
cd ${script_dir}/..
6+
}
7+
8+
clean_project() {
9+
rm -rf dist/ build/ slack_cli_hooks.egg-info/
10+
}
11+
12+
install_development_requirements() {
13+
pip install -U pip
14+
pip install -e .
15+
pip install -r requirements/testing.txt
16+
pip install -r requirements/format.txt
17+
}
18+
19+
build() {
20+
pip install -r requirements/build.txt && \
21+
python -m build && \
22+
twine check dist/*
23+
}
24+
25+
format() {
26+
black slack_cli_hooks/ tests/
27+
}

scripts/build_pypi_package.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
23

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

6-
rm -rf dist/ build/ slack_cli_hooks.egg-info/
6+
clean_project
77

8-
pip install -r requirements/build.txt && \
9-
python -m build && \
10-
twine check dist/*
8+
build

scripts/deploy_to_test_pypi.sh

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
#!/bin/bash
2+
source ./scripts/_utils.sh
23

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

6-
rm -rf dist/ build/ slack_cli_hooks.egg-info/
6+
clean_project
7+
8+
build
79

8-
pip install -r requirements/build.txt && \
9-
python -m build && \
10-
twine check dist/* && \
1110
twine upload --repository testpypi dist/*

scripts/format.sh

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

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

7-
if [[ "$1" != "--no-install" ]]; then
8-
export PIP_REQUIRE_VIRTUALENV=1
9-
pip install -U pip
10-
pip install -U -r requirements/format.txt
11-
fi
6+
pip install -U pip
7+
pip install -r requirements/format.txt
128

13-
black slack_cli_hooks/ tests/
9+
format

scripts/install.sh

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
#!/bin/bash
2+
source ./scripts/_utils.sh
23

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

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

scripts/install_and_run_tests.sh

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
#!/bin/bash
2-
# Run all the tests or a single test with installation
32
# all: ./scripts/install_and_run_tests.sh
43
# single: ./scripts/install_and_run_tests.sh tests/scenario_tests/test_app.py
54

6-
script_dir=$(dirname "$0")
7-
cd "${script_dir}/.."
8-
95
test_target="$1"
6+
source ./scripts/_utils.sh
7+
8+
set_prj_as_cwd
9+
10+
install_development_requirements
1011

11-
./scripts/install.sh
12-
./scripts/format.sh --no-install
13-
./scripts/lint.sh --no-install
12+
format
1413

15-
if [[ "$test_target" != "" ]]
14+
if [[ $test_target != "" ]]
1615
then
17-
pytest -vv "$test_target"
16+
pytest -vv $1
1817
else
19-
pytest
18+
pytest && \
19+
mypy --config-file pyproject.toml
2020
fi

scripts/lint.sh

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,10 @@
11
#!/bin/bash
2-
# ./scripts/lint.sh [--no-install]
32

4-
script_dir=$(dirname "$0")
5-
cd "${script_dir}/.."
3+
source ./scripts/_utils.sh
64

7-
if [[ "$1" != "--no-install" ]]; then
8-
export PIP_REQUIRE_VIRTUALENV=1
9-
pip install -U pip
10-
pip install -U -r requirements/format.txt
11-
fi
5+
set_prj_as_cwd
126

13-
black --check slack_cli_hooks/ tests/
14-
flake8 slack_cli_hooks/ tests/
7+
pip install -U pip
8+
pip install -r requirements/format.txt
9+
10+
flake8 slack_cli_hooks/ && flake8 tests/

scripts/run_mypy.sh

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

4-
script_dir=$(dirname "$0")
5-
cd "${script_dir}/.."
3+
source ./scripts/_utils.sh
64

7-
if [[ "$1" != "--no-install" ]]; then
8-
./scripts/install.sh
9-
fi
5+
set_prj_as_cwd
6+
7+
install_development_requirements
108

119
mypy --config-file pyproject.toml

scripts/run_tests.sh

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,17 @@
11
#!/bin/bash
2-
# Run all the tests or a single test
32
# all: ./scripts/run_tests.sh
43
# single: ./scripts/run_tests.sh tests/scenario_tests/test_app.py
54

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

11-
./scripts/format.sh --no-install
10+
format
1211

13-
if [[ "$test_target" != "" ]]
12+
if [[ $test_target != "" ]]
1413
then
15-
pytest -vv "$test_target"
14+
pytest -vv $1
1615
else
1716
pytest
1817
fi

0 commit comments

Comments
 (0)