robertwb commented on a change in pull request #17035:
URL: https://github.com/apache/beam/pull/17035#discussion_r824320165



##########
File path: 
sdks/java/extensions/python/src/main/resources/org/apache/beam/sdk/extensions/python/bootstrap_beam_venv.py
##########
@@ -0,0 +1,96 @@
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+"""A utility for bootstrapping a BeamPython install.
+
+This utility can be called with any version of Python, and attempts to create
+a Python virtual environment with the requested version of Beam, and any
+extra dependencies as required, installed.
+
+The virtual environment will be placed in Apache Beam's cache directory, and
+will be re-used if the parameters match.
+
+If this script exits successfully, the last line will be the full path to a
+suitable python executable.
+"""
+
+import argparse
+import hashlib
+import os
+import shutil
+import subprocess
+import sys
+
+
+def main():
+    if sys.version_info < (3, ):
+        # Run this script with Python 3.
+        os.execlp('python3', 'python3', *sys.argv)
+        return  # In case windows returns...
+
+    parser = argparse.ArgumentParser()
+    parser.add_argument('--python_version', help="Python major version.")
+    parser.add_argument('--beam_version',
+                        help="Beam version.",
+                        default="2.36.0")

Review comment:
       We could consider making this a required argument. (Note that it's not 
an error to mix and match Beam versions, as long as what you're counting on is 
available, though it's generally best to have the latest. 




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to