From 7e1683407d786497690a2fa2781c261ccb5c44f4 Mon Sep 17 00:00:00 2001 From: Jameel Al-Aziz Date: Mon, 10 Jan 2022 18:25:37 -0800 Subject: [PATCH] Update Dependabot for python virtual envs * Simplify virtualenv installation to use multiple requirements files in a single directory. This eliminates the packages.txt file and provides an easier path to adding new tools in the future. It also allows us to simplify the dependenabot configuration as all requirements files are in a single directory. * Update dependabot.yml to point to the new Python dependencies folder. --- .github/dependabot.yml | 2 +- .../requirements.txt => ansible-lint.txt} | 0 .../python/{black/requirements.txt => black.txt} | 0 dependencies/python/build-venvs.sh | 11 ++++------- .../{cfn-lint/requirements.txt => cfn-lint.txt} | 0 .../{cpplint/requirements.txt => cpplint.txt} | 0 .../python/{flake8/requirements.txt => flake8.txt} | 0 .../python/{isort/requirements.txt => isort.txt} | 0 .../python/{mypy/requirements.txt => mypy.txt} | 0 dependencies/python/packages.txt | 13 ------------- .../python/{pylint/requirements.txt => pylint.txt} | 0 .../{snakefmt/requirements.txt => snakefmt.txt} | 0 .../{snakemake/requirements.txt => snakemake.txt} | 0 .../{sqlfluff/requirements.txt => sqlfluff.txt} | 0 .../{yamllint/requirements.txt => yamllint.txt} | 0 dependencies/python/{yq/requirements.txt => yq.txt} | 0 16 files changed, 5 insertions(+), 21 deletions(-) rename dependencies/python/{ansible-lint/requirements.txt => ansible-lint.txt} (100%) rename dependencies/python/{black/requirements.txt => black.txt} (100%) rename dependencies/python/{cfn-lint/requirements.txt => cfn-lint.txt} (100%) rename dependencies/python/{cpplint/requirements.txt => cpplint.txt} (100%) rename dependencies/python/{flake8/requirements.txt => flake8.txt} (100%) rename dependencies/python/{isort/requirements.txt => isort.txt} (100%) rename dependencies/python/{mypy/requirements.txt => mypy.txt} (100%) delete mode 100644 dependencies/python/packages.txt rename dependencies/python/{pylint/requirements.txt => pylint.txt} (100%) rename dependencies/python/{snakefmt/requirements.txt => snakefmt.txt} (100%) rename dependencies/python/{snakemake/requirements.txt => snakemake.txt} (100%) rename dependencies/python/{sqlfluff/requirements.txt => sqlfluff.txt} (100%) rename dependencies/python/{yamllint/requirements.txt => yamllint.txt} (100%) rename dependencies/python/{yq/requirements.txt => yq.txt} (100%) diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 80fd6233..0808a577 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -33,7 +33,7 @@ updates: # Maintain dependencies for python with pip - package-ecosystem: "pip" - directory: "/dependencies" + directory: "/dependencies/python/" schedule: interval: "weekly" open-pull-requests-limit: 10 diff --git a/dependencies/python/ansible-lint/requirements.txt b/dependencies/python/ansible-lint.txt similarity index 100% rename from dependencies/python/ansible-lint/requirements.txt rename to dependencies/python/ansible-lint.txt diff --git a/dependencies/python/black/requirements.txt b/dependencies/python/black.txt similarity index 100% rename from dependencies/python/black/requirements.txt rename to dependencies/python/black.txt diff --git a/dependencies/python/build-venvs.sh b/dependencies/python/build-venvs.sh index 13a378e1..e08510c2 100755 --- a/dependencies/python/build-venvs.sh +++ b/dependencies/python/build-venvs.sh @@ -21,15 +21,12 @@ pip install virtualenv ######################################################### # Itterate through requirments.txt to install bainaries # ######################################################### -while read -r LINE; do +for DEP_FILE in *.txt; do # split the package name from its version - PACKAGE_NAME=$(cut -d'=' -f1 <<<"${LINE}") - if [[ "${PACKAGE_NAME}" == *"["* ]]; then - PACKAGE_NAME=$(cut -d'[' -f1 <<<"${PACKAGE_NAME}") - fi + PACKAGE_NAME=${DEP_FILE%.txt} echo "-------------------------------------------" mkdir -p "/venvs/${PACKAGE_NAME}" - cp "${PACKAGE_NAME}/requirements.txt" "/venvs/${PACKAGE_NAME}/requirements.txt" + cp "${DEP_FILE}" "/venvs/${PACKAGE_NAME}/requirements.txt" echo "Generating virtualenv for: [${PACKAGE_NAME}]" pushd "/venvs/${PACKAGE_NAME}" virtualenv . @@ -40,4 +37,4 @@ while read -r LINE; do deactivate # pop the stack popd -done