Developing with the Python SDK
Gradle can build and test python, and is used by the Jenkins jobs, so needs to be maintained.
You can directly use the Python toolchain instead of having Gradle orchestrate it, which may be faster for you, but it is your preference. If you do want to use Python tools directly, we recommend setting up a virtual environment before testing your code.
If you update any of the cythonized files in Python SDK, you must install the
cython package before running following command to properly test your code.
The following commands should be run in the
sdks/python directory. This installs Python from source and includes the test and gcp dependencies.
This command runs all Python tests. The nose dependency is installed by [test] in pip install.
You can use following command to run a single test method.
You can deactivate the virtualenv when done.
To check just for Python lint errors, run the following command.
tox commands to run the lint tasks:
This step is only required for testing SDK code changes remotely (not using directrunner). In order to do this you must build the Beam tarball. From the root of the git repository, run:
--sdk_location flag to use the newly built version.