Skip to content

Commit

Permalink
Allow specifying extras when using breeze initialize_local_virtualenv (
Browse files Browse the repository at this point in the history
  • Loading branch information
o-nikolas authored Oct 23, 2021
1 parent d3ac010 commit f47d7b9
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
7 changes: 7 additions & 0 deletions LOCAL_VIRTUALENV.rst
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,13 @@ Activate your virtualenv, e.g. by using ``workon``, and once you are in it, run:
./breeze initialize-local-virtualenv
By default Breeze installs the ``devel`` extra only. You can optionally control which extras are installed by exporting ``VIRTUALENV_EXTRAS`` before calling Breeze:

.. code-block:: bash
export VIRTUALENV_EXTRAS="devel,google,postgres"
./breeze initialize-local-virtualenv
5. (optionally) run yarn build if you plan to run the webserver

.. code-block:: bash
Expand Down
5 changes: 4 additions & 1 deletion breeze
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,7 @@ function breeze::setup_default_breeze_constants() {
# PYTHON_MAJOR_MINOR_VERSION
# AIRFLOW_HOME_DIR
# AIRFLOW_SOURCES
# VIRTUALENV_EXTRAS
# DEFAULT_CONSTRAINTS_BRANCH
# OSTYPE
#
Expand All @@ -252,13 +253,15 @@ function breeze::initialize_virtualenv() {
echo
echo "Initializing the virtualenv: $(command -v python)!"
echo
echo "Extras to be installed: ${VIRTUALENV_EXTRAS}"
echo
echo "This will wipe out ${AIRFLOW_HOME_DIR} and reset all the databases!"
echo
"${AIRFLOW_SOURCES}/confirm" "Proceeding with the initialization"
echo
pushd "${AIRFLOW_SOURCES}" >/dev/null 2>&1 || exit 1
set +e
pip install -e ".[devel]" \
pip install -e ".[${VIRTUALENV_EXTRAS}]" \
--constraint "https://raw.githubusercontent.com/${CONSTRAINTS_GITHUB_REPOSITORY}/${DEFAULT_CONSTRAINTS_BRANCH}/constraints-source-providers-${PYTHON_MAJOR_MINOR_VERSION}.txt"
res=$?
set -e
Expand Down
6 changes: 6 additions & 0 deletions scripts/ci/libraries/_initialization.sh
Original file line number Diff line number Diff line change
Expand Up @@ -564,6 +564,11 @@ function initialization::initialize_kubernetes_variables() {
readonly API_SERVER_PORT
}

function initialization::initialize_virtualenv_variables() {
# The extras to install when initializing a virtual env with breeze
export VIRTUALENV_EXTRAS=${VIRTUALENV_EXTRAS:="devel"}
}

function initialization::initialize_git_variables() {
# SHA of the commit for the current sources
COMMIT_SHA="$(git rev-parse HEAD 2>/dev/null || echo "Unknown")"
Expand Down Expand Up @@ -638,6 +643,7 @@ function initialization::initialize_common_environment() {
initialization::initialize_image_build_variables
initialization::initialize_provider_package_building
initialization::initialize_kubernetes_variables
initialization::initialize_virtualenv_variables
initialization::initialize_git_variables
initialization::initialize_github_variables
initialization::initialize_test_variables
Expand Down

0 comments on commit f47d7b9

Please sign in to comment.