Skip to content

Commit 52d147b

Browse files
authored
Merge pull request #13 from henribru/v14-support
2 parents 065efdb + b059a85 commit 52d147b

7,356 files changed

Lines changed: 84876 additions & 307146 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

README.md

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,11 @@
33
[![PyPI version](https://badge.fury.io/py/google-ads-stubs.svg)](https://badge.fury.io/py/google-ads-stubs)
44

55
This package provides type stubs for the [Google Ads API Client Library for Python](https://github.com/googleads/google-ads-python).
6-
It's currently compatible with v.9.0.0 of this library. It allows you to type check usage of the library with e.g. [mypy](http://mypy-lang.org/) and will also improve autocomplete in many editors.
6+
It's currently compatible with v14.0.0 of this library. It allows you to type check usage of the library with e.g. [mypy](http://mypy-lang.org/) and will also improve autocomplete in many editors.
77

88
**This is in no way affiliated with Google.**
99

10-
The stubs for protobuf messages were created by [mypy-protobuf](https://github.com/dropbox/mypy-protobuf).
11-
The rest were created either by hand or by self-made scripts, with the output of MyPy's `stubgen` as
12-
a starting point.
10+
Most stubs were created automatically by [stubgen](https://mypy.readthedocs.io/en/stable/stubgen.html), the rest are handwritten or generated by self-made scripts.
1311

1412
If you find incorrect annotations, please create an issue. Contributions for fixes are also welcome.
1513

@@ -29,28 +27,23 @@ the object directly.
2927
# Replace this:
3028
campaign_operation = client.get_type('CampaignOperation')
3129
# With this:
32-
from google.ads.google_ads.v3.types import CampaignOperation
30+
from google.ads.googleads.v8 import CampaignOperation
3331
campaign_operation: CampaignOperation = client.get_type('CampaignOperation')
3432
# Or this:
35-
from google.ads.google_ads.v3.types import CampaignOperation
33+
from google.ads.googleads.v8 import CampaignOperation
3634
campaign_operation = CampaignOperation()
3735

3836
# Replace this:
3937
google_ads_service = client.get_service('GoogleAdsService')
4038
# With this:
41-
from google.ads.google_ads.v3.services import GoogleAdsServiceClient
39+
from google.ads.googleads.v8 import GoogleAdsServiceClient
4240
google_ads_service: GoogleAdsServiceClient = client.get_service('GoogleAdsService')
4341
```
4442

4543
While it is technically possible to type these methods using a combination of overloading and literal types,
46-
this is not included in these stubs. The reason is that it requires about 10,000 overloads, which, while simple
47-
to generate, slows type checking to a crawl.
44+
this is not included in these stubs. The reason is that it requires about 10,000 overloads, which makes most typecheckers fairly slow.
4845

49-
This package does not provide complete type annotations, although it should cover what's used by most developers.
50-
The bare output from `stubgen` is used by the ransport classes. These may be typed in the future if there is a need for it.
46+
Another big caveat since v8.0.0 of this package is that the attributes and constructor arguments of the protobuf messages are all typed as `Any` instead of their proper types. This is due to `google-ads-python` switching from raw protobuf message classes to `proto-plus` classes. Better types for these might be introduced in the future. `GoogleAdsClient.enums` is also typed as `Any`.
5147

52-
Some service methods allow you to pass in either a protobuf message or a dictionary for certain arguments.
53-
There is no check that the dictionary conforms to the message structure, as this would require a `TypedDict` subclass
54-
for each message.
5548

56-
Note that if you're using Mypy you need to use the `--namespace-packages` option as `google` and `google.ads` are namespace packages.
49+
Note that if you're using Mypy you need to use the `--namespace-packages` option as `google` and `google.ads` are namespace packages.

google-stubs/ads/google_ads/__init__.pyi

Lines changed: 0 additions & 5 deletions
This file was deleted.

google-stubs/ads/google_ads/client.pyi

Lines changed: 0 additions & 38 deletions
This file was deleted.

google-stubs/ads/google_ads/errors.pyi

Lines changed: 0 additions & 28 deletions
This file was deleted.

google-stubs/ads/google_ads/interceptors/__init__.pyi

Lines changed: 0 additions & 7 deletions
This file was deleted.

google-stubs/ads/google_ads/interceptors/exception_interceptor.pyi

Lines changed: 0 additions & 19 deletions
This file was deleted.

google-stubs/ads/google_ads/oauth2.pyi

Lines changed: 0 additions & 28 deletions
This file was deleted.

google-stubs/ads/google_ads/py.typed

Lines changed: 0 additions & 1 deletion
This file was deleted.

google-stubs/ads/google_ads/util.pyi

Lines changed: 0 additions & 14 deletions
This file was deleted.

0 commit comments

Comments
 (0)