Repository: kubeflow/pipelines

Issue:
SDK - Drop support for Python 3.5
Python 3.5 has reached EoL: https://www.python.org/downloads/release/python-3510/#:~:text=Python%203.5%20will%20reach%20its,release%20of%20the%203.5%20series.

We're going to stop supporting Python 3.5 soon.

Please feel free to comment or vote on this issue.


Discussion:
@Ark-kun Dropping support for Python 3.5 enables declaring class fields with type hint, which enables using data classes. Data classes have lots of properties that are now implemented by custom classes in kubeflow-pipelines. Some of them include:

* `repr` and `str` implementation
* equality and hash implementations
* immutability (`frozen=True`) and creating a modified instance (`.replace(...)`)
* `dataclass.asdict(obj)` --- basically `ModelBase`'s `.to_dict()`
* `dataclass.fields(obj)` --- listing all fields, basically `ModelBase`'s `._get_field_names()`
* constructors
* some libraries (such as [typed-json-dataclass](https://pypi.org/project/typed-json-dataclass/), Python >= 3.7 or [data classes-json](https://pypi.org/project/dataclasses-json/), Python >= 3.6) even implement `to_json`, `from_json`, `to_dict`, `from_dict`

Data classes also have good IDE support for listing, contrary to `ModelBase` which has some issues in that matter.
> enables using data classes

I totally agree. When I was creating the structure classes and ModelBase I really wished I could use dataclasses.  Having dataclasses probably won't eliminate the Modelbase or even simplify it much, but the structure classes themselves will become more IDE-friendly.
`data classes-json` might eventually provide a replacement for ModelBase (although we need to check whether it properly supports `typing.Union`, `typing.Optional` and strict type validation). It would also be great to just generate the structure classes from the ComponentSpec JsonSchema.
@Ark-kun I think I saw it having support for Union, although it was a little buggy for deserialisation (serialisation works just fine), e.g. `Union[str, int]` works, but `Union[some_other_dataclass, yet_another_data_class]` does not (or so it seems based on the example I used).

And even without dataclasses-json, dataclasses may replace `NamedTuple`s, as these are used in many places for no good reason other than lack of dataclasses, while having serious disadvantages:
* they are iterables, which makes `list(some_named_tuple)` vastly different from `[some_named_tuple]`, `len` is defined for them etc.
* are also always "frozen" (in dataclasses' terminology)
* can't have methods
* can't be kwargs-only (may be confusing if many fields have the same type)
* default values requires using `class`+annotations-based definition, only available since Python 3.6, as it requires field annotations
* can't redefine `__init__` / `__post_init__`

Dataclasses also play well with inheritance and can be generics, but those aren't probably that much of advantages in this case.

Resolving patch:
diff --git a/sdk/python/setup.py b/sdk/python/setup.py
--- a/sdk/python/setup.py
+++ b/sdk/python/setup.py
@@ -96,16 +96,16 @@ def find_version(*file_path_parts):
         'Intended Audience :: Science/Research',
         'License :: OSI Approved :: Apache Software License',
         'Programming Language :: Python :: 3',
-        'Programming Language :: Python :: 3.5',
         'Programming Language :: Python :: 3.6',
         'Programming Language :: Python :: 3.7',
+        'Programming Language :: Python :: 3.8',
         'Topic :: Scientific/Engineering',
         'Topic :: Scientific/Engineering :: Artificial Intelligence',
         'Topic :: Software Development',
         'Topic :: Software Development :: Libraries',
         'Topic :: Software Development :: Libraries :: Python Modules',
     ],
-    python_requires='>=3.5.3',
+    python_requires='>=3.6.1',
     include_package_data=True,
     entry_points={
         'console_scripts': [


Test patch: