You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@beam.apache.org by vt...@apache.org on 2025/08/21 11:08:57 UTC
(beam) branch fix-python-arm-postcommit updated: Simple setup
This is an automated email from the ASF dual-hosted git repository.
vterentev pushed a commit to branch fix-python-arm-postcommit
in repository https://gitbox.apache.org/repos/asf/beam.git
The following commit(s) were added to refs/heads/fix-python-arm-postcommit by this push:
new 03aded6ecd4 Simple setup
03aded6ecd4 is described below
commit 03aded6ecd462c0fd7a44beae723bee5830a9f6c
Author: Vitaly Terentyev <vi...@akvelon.com>
AuthorDate: Thu Aug 21 15:08:46 2025 +0400
Simple setup
---
.../examples/complete/juliaset/setup.py | 97 ++--------------------
1 file changed, 5 insertions(+), 92 deletions(-)
diff --git a/sdks/python/apache_beam/examples/complete/juliaset/setup.py b/sdks/python/apache_beam/examples/complete/juliaset/setup.py
index 8439300f754..f8413a976d2 100644
--- a/sdks/python/apache_beam/examples/complete/juliaset/setup.py
+++ b/sdks/python/apache_beam/examples/complete/juliaset/setup.py
@@ -27,102 +27,15 @@ when running the workflow for remote execution.
# pytype: skip-file
-import subprocess
-
-import setuptools
-
# It is recommended to import setuptools prior to importing distutils to avoid
# using legacy behavior from distutils.
# https://setuptools.readthedocs.io/en/latest/history.html#v48-0-0
-from setuptools.command.build_py import build_py as _build
-
-
-# This class handles the pip install mechanism.
-class build(_build): # pylint: disable=invalid-name
- """A build command class that will be invoked during package install.
-
- The package built using the current setup.py will be staged and later
- installed in the worker using `pip install package'. This class will be
- instantiated during install for this specific scenario and will trigger
- running the custom commands specified.
- """
- sub_commands = _build.sub_commands + [('CustomCommands', None)]
-
-
-# Some custom command to run during setup. The command is not essential for this
-# workflow. It is used here as an example. Each command will spawn a child
-# process. Typically, these commands will include steps to install non-Python
-# packages. For instance, to install a C++-based library libjpeg62 the following
-# two commands will have to be added:
-#
-# ['apt-get', 'update'],
-# ['apt-get', '--assume-yes', 'install', 'libjpeg62'],
-#
-# First, note that there is no need to use the sudo command because the setup
-# script runs with appropriate access.
-# Second, if apt-get tool is used then the first command needs to be 'apt-get
-# update' so the tool refreshes itself and initializes links to download
-# repositories. Without this initial step the other apt-get install commands
-# will fail with package not found errors. Note also --assume-yes option which
-# shortcuts the interactive confirmation.
-#
-# Note that in this example custom commands will run after installing required
-# packages. If you have a PyPI package that depends on one of the custom
-# commands, move installation of the dependent package to the list of custom
-# commands, e.g.:
-#
-# ['pip', 'install', 'my_package'],
-#
-# TODO(https://github.com/apache/beam/issues/18568): Output from the custom
-# commands are missing from the logs. The output of custom commands (including
-# failures) will be logged in the worker-startup log.
-CUSTOM_COMMANDS = [['echo', 'Custom command worked!']]
-
-
-class CustomCommands(setuptools.Command):
- """A setuptools Command class able to run arbitrary commands."""
- def initialize_options(self):
- pass
-
- def finalize_options(self):
- pass
-
- def RunCustomCommand(self, command_list):
- print('Running command: %s' % command_list)
- p = subprocess.Popen(
- command_list,
- stdin=subprocess.PIPE,
- stdout=subprocess.PIPE,
- stderr=subprocess.STDOUT)
- # Can use communicate(input='y\n'.encode()) if the command run requires
- # some confirmation.
- stdout_data, _ = p.communicate()
- print('Command output: %s' % stdout_data)
- if p.returncode != 0:
- raise RuntimeError(
- 'Command %s failed: exit code: %s' % (command_list, p.returncode))
-
- def run(self):
- for command in CUSTOM_COMMANDS:
- self.RunCustomCommand(command)
-
-
-# Configure the required packages and scripts to install.
-# Note that the Python Dataflow containers come with numpy already installed
-# so this dependency will not trigger anything to be installed unless a version
-# restriction is specified.
-REQUIRED_PACKAGES = [
- 'numpy',
-]
+from setuptools import setup, find_packages
-setuptools.setup(
+setup(
name='juliaset',
version='0.0.1',
description='Julia set workflow package.',
- install_requires=REQUIRED_PACKAGES,
- packages=setuptools.find_packages(),
- cmdclass={
- # Command class instantiated and run during pip install scenarios.
- 'build': build,
- 'CustomCommands': CustomCommands,
- })
+ packages=find_packages(),
+ install_requires=[], # keep empty for staging
+)