gapic-generator-python
                                
                                
                                
                                    gapic-generator-python copied to clipboard
                            
                            
                            
                        Create a macro utility function to parse the version of dependencies
See this comment from PR #1999 related to duplication of code to extract the version.
https://github.com/googleapis/gapic-generator-python/blob/617222dab9138c8831be349e75e4b65973ba276f/gapic/templates/tests/unit/gapic/%25name_%25version/%25sub/test_%25service.py.j2#L243-L252
We're using this construct to get the version number of a dependency in other places as well. We should factor it out into a static member function that can be called like this is_version_atleast(api_core_version, (2,19,0))
No need to block this PR, but we should at least file an issue. And come to think of it, we should consider wherever we have version strings, to have the SoT be a tuple like (2, 19, 0, "rc0"). The version string can then be automatically constructed from the tuple, and we would continue to export it. But we would also export the tuple. This would get rid of string splitting/manipulation in various places of the generated code.