Skip to content

Commit c31a5bc

Browse files
[PYTHON-4037] Failures on semantic-kernel-python do to missing .env file. (#17)
* Cleanup of run.sh for semantic-kernel-python. Adds .env file. * Updated poetry calls * Typo in CONN_STRING
1 parent 52ced27 commit c31a5bc

File tree

1 file changed

+17
-8
lines changed

1 file changed

+17
-8
lines changed

semantic-kernel-python/run.sh

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,25 @@ set -x
77
CONN_STRING=$($atlas deployments connect $DIR --connectWith connectionString)
88
PYTHON_BINARY=$(find_python3)
99

10+
1011
# WORKING_DIR = src/semantic-kernel-python/semantic-kernel
1112
cd python
1213

13-
$PYTHON_BINARY -m venv .
14-
source ./bin/activate
1514

16-
pip install poetry
17-
pip install pytest
18-
pip install grpcio
19-
poetry install
15+
# Install Poetry into base python
16+
$PYTHON_BINARY -m pip install -U pip poetry
17+
# Create a package specific poetry environment
18+
$PYTHON_BINARY -m poetry env use $PYTHON_BINARY
19+
# Activate the poetry env, which itself does not include poetry
20+
source $($PYTHON_BINARY -m poetry env info --path)/bin/activate
21+
# Recreate the poetry lock file
22+
$PYTHON_BINARY -m poetry lock --no-update
23+
# Install from pyproject.toml into package specific environment
24+
$PYTHON_BINARY -m poetry install --with dev
25+
26+
# Create .env file
27+
python -c "from dotenv import set_key; set_key('.env', 'OPENAI_API_KEY', '$openai_api_key')"
28+
python -c "from dotenv import set_key; set_key('.env', 'MONGODB_ATLAS_CONNECTION_STRING', '$CONN_STRING')"
2029

2130
# Workaround to test vector search first
2231
OPENAI_API_KEY=$openai_api_key \
@@ -26,7 +35,7 @@ AZURE_OPENAI_ENDPOINT="" \
2635
AZURE_OPENAI_API_KEY="" \
2736
MONGODB_ATLAS_CONNECTION_STRING=$CONN_STRING \
2837
Python_Integration_Tests=1 \
29-
poetry run pytest tests/integration/connectors/memory/test_mongodb_atlas.py -k test_collection_knn
38+
$PYTHON_BINARY -m poetry run pytest tests/integration/connectors/memory/test_mongodb_atlas.py -k test_collection_knn
3039

3140
# Stored in evergreen VARIABLES
3241
OPENAI_API_KEY=$openai_api_key \
@@ -36,4 +45,4 @@ AZURE_OPENAI_ENDPOINT="" \
3645
AZURE_OPENAI_API_KEY="" \
3746
MONGODB_ATLAS_CONNECTION_STRING=$CONN_STRING \
3847
Python_Integration_Tests=1 \
39-
poetry run pytest tests/integration/connectors/memory/test_mongodb_atlas.py
48+
$PYTHON_BINARY -m poetry run pytest tests/integration/connectors/memory/test_mongodb_atlas.py

0 commit comments

Comments
 (0)