Skip to content

Commit 1223e3d

Browse files
authored
Specify venv in Python checks (#1940)
Related tiny-pilot/tinypilot-pro#1731 This PR specifies the Python virtual environment when checking Python code. This change is needed to simplify working with multiple Python virtual environments in the Pro repo: - tiny-pilot/tinypilot-pro#1755 <a data-ca-tag href="https://codeapprove.com/pr/tiny-pilot/tinypilot/1940"><img src="https://codeapprove.com/external/github-tag-allbg.png" alt="Review on CodeApprove" /></a>
1 parent 5fefb07 commit 1223e3d

1 file changed

Lines changed: 11 additions & 9 deletions

File tree

dev-scripts/check-python

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,13 @@ find . \
2020

2121
# Run unit tests and calculate code coverage.
2222
# Load module `app.log` to initialize our custom logger.
23-
coverage run \
23+
./venv/bin/coverage run \
2424
--source app/ \
2525
--omit '*_test.py' \
2626
--module \
2727
unittest discover --pattern '*_test.py' \
2828
app.log
29-
coverage report
29+
./venv/bin/coverage report
3030

3131
# Check for Python init files.
3232
INIT_FILES_OK=true
@@ -47,7 +47,14 @@ done < <(
4747
"${INIT_FILES_OK}" || exit 1
4848

4949
# Check that source has correct formatting.
50-
yapf --diff --recursive ./
50+
./venv/bin/yapf \
51+
--diff \
52+
--recursive \
53+
./
54+
55+
# Run static analysis for Python bugs/cruft.
56+
./venv/bin/ruff check \
57+
./
5158

5259
# Gather names of all Python scripts in the scripts/ folder.
5360
PYTHON_SCRIPTS=()
@@ -56,13 +63,8 @@ while read -r line; do
5663
done < <(grep --recursive --files-with-matches '^#!.*python' scripts/)
5764
readonly PYTHON_SCRIPTS
5865

59-
# Run static analysis for Python bugs/cruft.
60-
ruff check \
61-
app/ \
62-
"${PYTHON_SCRIPTS[@]}"
63-
6466
# Check for other style violations.
6567
PYTHONPATH='app/' \
66-
pylint \
68+
./venv/bin/pylint \
6769
app/ \
6870
"${PYTHON_SCRIPTS[@]}"

0 commit comments

Comments
 (0)