Update manage_virtualenv.sh script for Pants 2.9
We need to tweak how we find all our Python dependencies in this
script, as things have changed.
@@ -26,13 +26,27 @@ function populate() {
exit_message
}
+# Retrieve a list of all Python dependencies in this project.
+#
+# Previously we used `./pants dependencies --type=3rdparty ::`, but
+# the `--type` option was removed in 2.9.0.dev0. Pants recommends this
+# implementation as an equivalent, and mentions that "in the future
+# there will be a more robust way of querying and filtering
+# dependencies." At that point, this function implementation can
+# likely be simplified.
+function python_dependencies() {
+ ./pants dependencies :: |
+ xargs ./pants filter --target-type=python_requirement |
+ xargs ./pants peek | jq -r '.[]["requirements"][]'
+}
+
# Main command function
function regenerate_constraints() {
log "Re-generating ${constraints_file} from ${requirements_file} and Pants dependencies"
create_base_venv
"${pip}" install \
--requirement "${requirements_file}" \
- --requirement <(./pants dependencies --type=3rdparty ::)
+ --requirement <(python_dependencies)
create_constraints_file
exit_message
}
