googleapis / googleapis/google-cloud-python

Generate non-empty `/services/__init__.py` file

Open
#16,231 1 comment 0 reactions 1 assignee Claimed by @ohmayr View on GitHub
priority: p2 type: feature request
Dominant language
Python
Stars
5.4k
Forks
1.8k
Avg merge
3d 4h
Merged PRs (30d)
122

Description

Thanks for stopping by to let us know something could be better!

**Is your feature request related to a problem? Please describe.**

In the Google Ads API we have a number of types that are defined within the service protos, and these types are difficult to import without knowing the name of the file they're defined in. So having a top-level __init__.py file with each type listed helps with our import logic. We had a [similar mechanism](https://github.com/googleads/google-ads-python/blob/6c205c4abdf95a18c70b938e37f448660b280da9/google/ads/googleads/v18/__init__.py) in the old Ads templates.

Currently we work around this by manually copying the [__init__.py file under `/services/types`](https://github.com/googleads/google-ads-python/blob/main/google/ads/googleads/v19/services/types/__init__.py) into `/services/` and appending `.types` to the import paths (see [current file](https://github.com/googleads/google-ads-python/blob/main/google/ads/googleads/v19/services/__init__.py))

**Describe the solution you'd like**

It would be great if this `__init__.py` file under `/services/` was generated automatically.

**Describe alternatives you've considered**

I considered updating our [`get_type` method logic](https://github.com/googleads/google-ads-python/blob/main/google/ads/googleads/client.py#L410) to handle this inconsistency, but it doesn't seem to work when the `/services/__init__.py` file is empty.

**Additional context**
Add any other context or screenshots about the feature request here.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.