Commit Graph

148 Commits

Author SHA1 Message Date
Shantanu
67c858408d Upgrade to termcolor>=2 (#8766) 2022-09-19 08:17:30 +02:00
Alex Waygood
2eaa63b8fa stubsabot: checkout the branch you were on after script completion (#8742) 2022-09-18 12:52:03 +01:00
Alex Waygood
a4e5ad8aab stubsabot: link to diff between releases on GitHub, where possible (#8744) 2022-09-15 17:11:31 -07:00
Alex Waygood
5a3595a5d6 stubsabot: refuse to run if uncommitted changes are present locally (#8741) 2022-09-15 13:45:53 -07:00
Alex Waygood
2fd0180bb1 stubsabot: Add the PR body to the commit message (#8740) 2022-09-15 20:12:35 +01:00
Alex Waygood
3a397a2252 stubsabot: improve argparse for --action-level (#8682) 2022-09-04 16:16:05 -07:00
Alex Waygood
eb6431c4cc stubsabot: warn if stubtest won't test an update (#8681)
Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
2022-09-04 13:56:58 -07:00
Samuel T
bfe56cd471 create_baseline_stubs: fix pyright config on windows, write to stubs (#8653) 2022-09-02 14:53:37 -07:00
Alex Waygood
bc26a98bd7 create_baseline_stubs.py: Modernize a few type annotations (#8642) 2022-08-29 13:49:00 +01:00
Alex Waygood
c8a679657b Delete scripts/update-stubtest-allowlist.py (#8606) 2022-08-29 13:50:26 +02:00
Nipunn Koorapati
7beaebff40 Bump to mypy-protobuf 3.3.0 (#8612)
* Bump to mypy-protobuf 3.3.0

* Remove some ignores for formatting
2022-08-26 07:24:11 +01:00
Nipunn Koorapati
c17c0d5607 Bump protobuf to 3.20.1 (#8609)
There are even newer versions available (4.*), but I had found a bug
in it which prevented it from working with mypy-protobuf. For now,
sticking to just 3.20.1
2022-08-25 13:28:08 +01:00
Kevin Kirsche
bd7a02fad4 refactor: prefer f-strings to other format/concatentation styles (#8474) 2022-08-03 14:04:27 +02:00
Shantanu
936314b979 Add stubsabot Github Action (#8303) 2022-07-17 13:21:51 -07:00
Shantanu
b941cfffde create_baseline_stubs: check all defs by default (#8227)
Since stubgen will usually create definition complete stubs, we should have
stubtest check missing definitions so we can know to reflect any future
additions.

Co-authored-by: hauntsaninja <>
2022-07-06 22:55:29 +05:30
Shantanu
a9fb8c5119 stubsabot: add project links (#8158)
See https://github.com/python/typeshed/pull/8157 for an example
2022-06-25 06:42:48 -07:00
Alex Waygood
a527bf27d5 Run mypy on the scripts directory in CI (#8133) 2022-06-22 14:13:38 +01:00
Shantanu
c31baed61d [stubsabot] add script (#8035) 2022-06-17 21:52:36 -07:00
Rogdham
6e0520a9bd create_baseline_stubs: improve package detection (#7283) 2022-02-19 12:20:10 -08:00
Nipunn Koorapati
470ea31ccd Use relax_strict_optional_primitives on protobuf generated code (#7038)
Per the suggestion in https://github.com/dropbox/mypy-protobuf/issues/344
This generates more permissive constructors (which protobuf itself actually
accepts).

Philosophically, I think it makes sense for the generated code hosted on
typeshed to be most permissive, while the generated code of individual
projects can make individual decisions (defaulting to less permissive).
2022-01-28 17:37:57 -08:00
Nipunn Koorapati
35064a7f75 Bump to mypy-protobuf 3.2.0 (#7013) 2022-01-23 14:49:33 -08:00
Nipunn Koorapati
fc4ba3ac64 Bump protobuf to 3.19.2 (#6879) 2022-01-10 10:03:41 +01:00
Akuli
950cff21f6 create_baseline_stubs.py: Fix stubgen invocation (#6856) 2022-01-08 12:33:29 +01:00
Nikita Sobolev
de8beb1399 Run shellcheck on generate_proto_stubs.sh (#6709) 2021-12-26 23:41:05 +01:00
Sebastian Rittau
34721fcadc Make create_baseline_stubs script executable (#6511) 2021-12-06 13:49:32 +02:00
Sebastian Rittau
206e1ae91b Remove 'py3' from requirements filename (#6509) 2021-12-06 12:59:04 +02:00
Nipunn Koorapati
39867f1096 Bump protobuf stub to 3.18.1 and mypy-protobuf 3.0.0 (#6157)
* Bump protobuf stub to 3.18.1 and mypy-protobuf 3.0.0

* Fix ConsumeInteger in google/protobuf/text_format.pyi

The arg was removed in protobuf 3.18
2021-10-12 14:33:22 -07:00
Sebastian Rittau
9f86972350 Add star to all non-0.1 versions (#6146) 2021-10-11 13:41:19 -07:00
Akuli
afad78343a change prints in scripts/create_baseline_stubs.py (#6051) 2021-09-19 12:38:23 -07:00
Nipunn Koorapati
581b2d5180 Update protobuf generated stubs from mypy-protobuf 2.8 (#5804) 2021-07-23 16:21:26 -07:00
Jukka Lehtosalo
b3b8daed2e Fix import sorting in create_baseline_stubs script (#5781)
Run isort before black since changes made by isort don't follow stub
conventions.
2021-07-15 13:24:46 +02:00
Jukka Lehtosalo
d85c54dc47 Add simple tool for creating baseline stubs (#5777)
This tool is a simple wrapper around stubgen and other tools that simplifies the
creation of "baseline" stubs with minimal annotation coverage. These stubs allow
basic type checking (e.g. number of arguments, whether X is valid as a base class),
and once we have baseline stubs, it's easy to contribute incremental changes that
add type annotations.

Here's a summary of what the tool does:
1. Check that the package is installed
2. Run stubgen
3. Copy generated stubs to the correct directory under `stubs/`
4. Run black
5. Run isort
6. Generate basic metadata with correct package version
7. Update pyright exclusions (needed since there are missing types)
8. Print suggestions about next steps needed to contribute stubs to typeshed

For example, to generate stubs for `iso8601`, you can run it like this:
```
python scripts/create_baseline_stubs.py iso8601
```

Sometimes the project name is different from the runtime package name. In
this case run the tool with `--package <runtime-package>`.
2021-07-15 11:22:28 +01:00
Nipunn Koorapati
42eec29eed Update proto stubs with latest mypy-protobuf 2.6 (#5753) 2021-07-10 17:10:39 -07:00
Shantanu
e66ceceed0 Rename whitelist to allowlist (#5614)
Resolves #4436

I want to add stubtest for third party stubs, and figured it'd be easier
to make this change now.

Co-authored-by: hauntsaninja <>
2021-06-10 14:33:44 -07:00
Sebastian Rittau
d7d3926b2c Fix generate protobuf script and run formatters (#5605)
* Fix generate protobuf script

* Install and run black and isort
2021-06-09 19:13:31 +03:00
Sebastian Rittau
8971c242cb Remove migration script; migration has happened (#5446)
* Remove migration script; migration has happened
2021-05-14 19:33:57 +03:00
Shantanu
3fa5988a2a Fix allowlist updater script (#5375)
Co-authored-by: hauntsaninja <>
2021-05-07 23:13:36 -07:00
Ivan Levkivskyi
16ae4c6120 Re-organize directory structure (#4971)
See discussion in #2491

Co-authored-by: Ivan Levkivskyi <ilevkivskyi@dropbox.com>
2021-01-27 12:00:39 +00:00
Ivan Levkivskyi
a1a51f5aac Add another (newly added) package name to ditribution map (#4970)
Co-authored-by: Ivan Levkivskyi <ilevkivskyi@dropbox.com>
2021-01-25 12:25:50 +00:00
Ivan Levkivskyi
83c18117d5 Update known package to distribution map for migration script (#4963)
Co-authored-by: Ivan Levkivskyi <ilevkivskyi@dropbox.com>
2021-01-22 16:12:04 +00:00
Shantanu
c3854d26f6 migrate_script: prefix @ to python2 (#4931)
As suggested by Jukka in https://github.com/python/typeshed/issues/2491

Co-authored-by: hauntsaninja <>
2021-01-15 09:27:30 -08:00
Nipunn Koorapati
4f81ac10ae Update mypy protobuf pin to include well_known_types (#4850) 2020-12-23 09:47:33 +01:00
Nipunn Koorapati
9af49c0b69 Protobuf stubs update using mypy-protobuf (#4785)
* Add script to generate protoc stubs using mypy-protobuf generated stubs

* Use generate_proto_stubs to generate stubs for protobuf 3.14.0

* Skip _pb2.pyi from flake8,black,isort,pytype
2020-11-25 10:48:26 -08:00
Sebastian Rittau
d2a7889fe0 Drop support for Python 3.5 (#4675)
Python 3.5 EOL was on 2020-09-30.
2020-11-02 16:18:20 +01:00
Shantanu
48970d31de tests / scripts: blacken and isort (#4704)
I often run black and isort in typeshed root and then have to undo these
changes.

Co-authored-by: hauntsaninja <>
2020-10-25 11:21:03 +01:00
Shantanu
734d91f90b update-stubtest-whitelist: fix type errors (#4581)
Co-authored-by: hauntsaninja <>
2020-09-26 07:33:57 +02:00
Sebastian Rittau
6acf0ef5f2 Create a PR when there are unused stubtest whitelist entries (#4334) 2020-07-18 14:48:55 +02:00
Ivan Levkivskyi
5c7cf9f75c Script for modular typeshed migration (#4259)
This reshuffles directory structure according to the specification in https://github.com/python/typeshed/issues/2491#issuecomment-611607557
2020-07-01 12:36:23 +01:00