Skip to content

Commit

Permalink
Updated dev container to dynamically set the python path for Poetry. (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
rsforbes authored Sep 14, 2023
1 parent 8480b57 commit 70780d4
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 10 deletions.
16 changes: 9 additions & 7 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,24 +1,26 @@
{
"containerEnv": {
"PYTHON_VERSION": "3.11",
"PYTHON_PATH": ""
"PYTHON_VERSION": "3.11"
},
"features": {
"ghcr.io/devcontainers/features/python:latest": {
"version": "3.11"
},
"ghcr.io/devcontainers/features/python:latest": {},
"ghcr.io/devcontainers-contrib/features/poetry:2": {}
},
"image": "mcr.microsoft.com/devcontainers/base:debian",
"name": "nba_data",
"name": "nba_api",
"postCreateCommand": "bash .devcontainer/postCreateCommand.sh",
"remoteEnv": {
"PYTHONUTF8": "1"
},
"customizations": {
"vscode": {
"extensions": [
"ms-python.python"
"ms-python.python",
"ms-toolsai.jupyter-keymap",
"ms-python.black-formatter",
"ms-toolsai.jupyter",
"ms-toolsai.vscode-jupyter-powertoys",
"ms-toolsai.jupyter-renderers"
]
}
}
Expand Down
9 changes: 6 additions & 3 deletions .devcontainer/postCreateCommand.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
CONSTRAINT_URL=https://raw.githubusercontent.com/apache/airflow/constraints-${AIRFLOW_VERSION}/constraints-${PYTHON_VERSION}.txt
pip install --upgrade pip
poetry install --no-root
# pip install "apache-airflow==${AIRFLOW_VERSION}" --constraint "${CONSTRAINT_URL}"
#(airflow standalone) &

# Activate poetry environment
source $(poetry env info --path)/bin/activate

# Update PYTHONPATH to include the virtual environment's Python interpreter
echo "export PYTHON_PATH=$(poetry env info --path)/bin/python" >> ~/.bashrc

0 comments on commit 70780d4

Please sign in to comment.