Skip to content

Commit 15b2bd5

Browse files
szachovyCopilot
andcommitted
Add Python version guard to entry point
Check that the Python interpreter is version 3.10 before proceeding with deployment. This prevents cryptic container errors from incompatible .pyc files when running on newer Python versions. Closes #41 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 0ab8ce7 commit 15b2bd5

2 files changed

Lines changed: 13 additions & 0 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
2626

2727
* Fixed `run_mysql_server()` not instantiating `MySQLServer` class. (#94)
2828
* Disabled MD060 markdownlint rule to fix table column style false positives in documentation. (#94)
29+
* Added Python version guard to entry point for early failure on incompatible versions. (#41)
2930

3031
## 1.0 - 2024-10-13
3132

superset-cluster

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,14 +71,26 @@ parse_arguments() {
7171

7272
parse_arguments "$@"
7373

74+
check_python_version() {
75+
local python_cmd="$1"
76+
local version
77+
version=$($python_cmd -c 'import sys; print(f"{sys.version_info.major}.{sys.version_info.minor}")')
78+
if [ "$version" != "3.10" ]; then
79+
echo "Error: Python 3.10 required (found $version)" >&2
80+
exit 1
81+
fi
82+
}
83+
7484
if python --version &>/dev/null; then
85+
check_python_version python
7586
eval "python ./src/initialize.py \
7687
'${virtual_ip_address}' \
7788
'${virtual_network_interface}' \
7889
'${virtual_network_mask}' \
7990
'${mgmt_nodes[*]}' \
8091
'${mysql_nodes[*]}'"
8192
elif python3 --version &>/dev/null; then
93+
check_python_version python3
8294
eval "python3 ./src/initialize.py \
8395
'${virtual_ip_address}' \
8496
'${virtual_network_interface}' \

0 commit comments

Comments
 (0)