delphix / virtualization-sdk

Delphix vSDK.
Apache License 2.0
7 stars 25 forks source link

CP-6007 Futurize vSDK - Stage 2 CP-6009 Add to_str and to_byte helpers #407

Closed mrburke closed 3 years ago

mrburke commented 3 years ago

CP-6007 Futurize vSDK - Stage 2 CP-6009 Add to_str and to_byte helpers CP-6010 Add Github Action(s) to run vSDK unit tests in py3 CP-6250 Remove tools from py2.7 unit tests in github actions

Context:

This diff introduces Python3.8 support for the Delphix vSDK.

What does this mean for plugin authors?

  1. The Delphix Engine will continue to accept Python2.7-based plugin uploads.
  2. The Delphix Engine will also accept Python3.8-based plugin uploads
  3. dvp may only be installed and used with Python 3.8

What exactly is in this diff?

  1. futurize --stage2 was run and I then manually cleaned up some of its changes. For example it wraps any instance of <dict object>.[keys|values|items]() with list(), which is not always necessary and should in some situations have the potential to be slower (though in truth it shouldn't be a significant slowdown for our use cases)
  2. We've added common to_bytes and to_str functions which work with python 2 and 3 and handles a number of data types.
    1. These helpers are used throughout the SDK to ensure data is converted properly just after entering and before leaving the program.
  3. Updated our pre-commit actions to run the following 4 jobs against the same matrix of platforms
    1. Python 2.7 unit tests
      1. Packages: common, libs, platform
    2. Python 3.8 unit tests
      1. Packages: common, libs, platform, tools
    3. Python 2.7 linting
      1. Packages: common, libs, platform
    4. Python 3.8 linting
      1. Packages: common, libs, platform, tools
    5. Note: I kept both 2.7 and 3.8 linting with the thought that it could help us catch code that is not both py2 and py3 compatible, when it should be
    6. Note: common, libs, and platform were not being linted prior to this diff, so there are a handful of simple formatting fixes throughout the diff as well.
  4. Fixed a lot of unit tests to account for moderate changes in many messages/exceptions that come with the switch to python3. When we eventually deprecate py2 support we can simply go through and remove all the if six.PY2: ... else: lines from the relevant test files.
  5. Updated dvp/setup.cfg to require Python 3.8

Testing

qa-gate and qa-toolkits changes must be made before we can automate py3 plugin testing. These changes are in progress. However py2 still looks good, and manual testing with py3 looks good so far as well.

Testing with new PY38 qa-appdata-toolkits plugins looks good. Continuing on automation.

All the pre-commit actions have passed.