Commit Graph

56 Commits

Author SHA1 Message Date
Alex Waygood
d91e5f0eff Further enhance check_consistent.py (#8604) 2022-08-26 07:50:26 -07:00
Shantanu
49062f53c3 Improve check_consistent (#8581)
- Use pathlib for convenience
- Share more logic between check_stubs and check_stdlib
- Better recursive checking, e.g. if a README.md is in the wrong place
- Fixes bug in checking directories in stubs/
- Test distribution names are valid
- Errors now contain full paths
- I believe pathlib normalises separators, but someone with Windows
  might want to double check this continues to work
2022-08-23 23:18:07 -07:00
Shantanu
19beaba9e7 Disallow adding stubs for types- packages (#8579)
This would lead to confusion. The types prefix is special cased in
various ways in stub_uploader
2022-08-20 15:44:17 -07:00
Kevin Kirsche
8c51fab4e2 Support extras in stubtest_third_party.py (#8467) 2022-08-18 14:12:36 -07:00
Shantanu
5ef20e8021 Use packaging to parse versions (#8314)
packaging is the standard tool for dealing with versions and
requirements. This allows us to easily support all PEP 508 specs.
packaging also has good error messages, so I don't create our own here.
This lets us get rid of our handrolled half parser and sanity checks.
I kept the whitespace consistency check, since that's just a formatting
lint and isn't testing the correctness of parsing (which we now
definitely do correctly).
2022-07-17 12:35:32 -07:00
Alex Waygood
78d96cd17e Drop support for Python 2 (#8272) 2022-07-12 09:08:56 +02:00
Shantanu
305f10b808 stubtest: per project --ignore-missing-stub (#8122) 2022-06-21 05:52:24 -07:00
Shantanu
64181e8dad stubtest: use separate table in METADATA.toml (#8096) 2022-06-19 00:43:24 -07:00
Sebastian Rittau
d8c0f25f0d Explain the no_longer_updated METADATA field (#8037) 2022-06-08 18:46:41 +02:00
Alex Waygood
9d450cb50c Make test scripts pass mypy --strict (#7745)
- Add several type hints to untyped functions.
- While we're at it, upgrade several annotations to use modern syntax by using `from __future__ import annotations`. This means that the tests can't be run on Python 3.6, but 3.6 is EOL, and it is already the case that some scripts in this directory can only be run on more recent Python versions. E.g. `check_new_syntax.py` uses `ast.unparse`, which is only available in Python 3.9+.
- Fix a few pieces of code that didn't type check.
2022-04-29 21:55:12 -06:00
Sebastian Rittau
f7aa41245e Drop Python 2 support in third-party stubs (#7703) 2022-04-27 15:32:17 +03:00
Sebastian Rittau
c3907ab26b Remove Python 2 support from some third-party distributions (#7466)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2022-03-09 20:19:22 +02:00
Sebastian Rittau
7a81bd41e9 Re-introduce the 'stubtest' key for third-party packages (#7351)
Some distributions can't be tested with stubtest for a variety of
reasons or because of bugs in stubtest. This key:

* let's us keep metadata about a distribution in one place,
* prevents us from modifying the scripts because of issues with a
  specific distribution, and
* will trigger tests if only the key is changed.
2022-02-22 15:59:27 +01:00
Sebastian Rittau
38811a4495 Fix check consistent (#6860) 2022-01-08 15:35:42 +02:00
Sebastian Rittau
14e5d16c3a Replace METADATA stubtest key with stubtest_apt_packages (#6704) 2021-12-27 17:28:59 +01:00
Sebastian Rittau
bb77f39b7c Add a 'stubtest' flag to METADATA.toml (#6687)
Co-authored-by: Akuli <akuviljanen17@gmail.com>
2021-12-25 17:02:57 +02:00
Shantanu
c47ed98b3e dummy_thread/ing: remove in 3.9 (#6408)
https://bugs.python.org/issue37312
2021-11-27 20:50:14 -08:00
Sebastian Rittau
bb24e77404 Update remaining versions for third-party stubs (#6094)
Also remove the python2 markers of packages that don't list Python 2
as supported in the latest version.

Don't special case version '0.1'

Co-authored-by: Akuli <akuviljanen17@gmail.com>
2021-10-12 12:30:45 +02:00
Sebastian Rittau
46fc031ee7 Allow third-party versions to end in asterisk (#6129)
This is a first step towards #6095, where x.y and x.y.* are treated as
equivalent. The next step is to update existing versions to use x.y.*
where applicable and then treat x.y differently.

Co-authored-by: Akuli <akuviljanen17@gmail.com>
2021-10-11 00:46:18 +02:00
Sebastian Rittau
0506182348 Allow three-component third-party versions (#5995)
Closes: #5992
2021-09-18 20:08:51 -07:00
Nikita Sobolev
392c81d767 Switch from toml to tomli (#6023) 2021-09-10 15:48:15 +02:00
Sebastian Rittau
ad3f0c8e34 Allow non-types dependencies (#5769)
Remove the check in check_consistency that ensures that only other
type packages from typeshed are being depended on. Instead, add an
explanation to CONTRIBUTING that spells out the requirements. This
adds a higher, but reasonable burden on maintainers to check the
dependencies manually.

Part of #5768
2021-07-14 14:29:53 +02:00
Sebastian Rittau
68dc2d132b Move Python 2-only stubs to @python2 directory (#5660) 2021-06-21 11:28:25 -07:00
Shantanu
7244ea1f71 Test third party stubs with stubtest (#5615) 2021-06-13 00:17:40 +02:00
Sebastian Rittau
21e647a184 Document _typeshed (#5501)
* Document _typeshed

Closes: #5486

* Allow README.md files
2021-05-19 22:15:21 +03:00
Sebastian Rittau
54a0bd80ee Add a comment about _typeshed to VERSIONS (#5447) 2021-05-19 11:01:33 +02:00
Sebastian Rittau
35acd2ad6f check_consistent: allow dots in module names (#5472) 2021-05-16 11:01:00 -07:00
Sebastian Rittau
6a4583d0a8 Deprecate pallets stubs (#5424)
Part of #5423

* Support new metadata fields in check_consistent
2021-05-12 19:17:42 +03:00
Sebastian Rittau
1eb64b4372 Mark stdlib modules with upper version bounds (#5394)
* Mark stdlib modules with upper version bounds

* Add minus to all versions and enforce in check_consistent

* Fix check_consistent and mypy_test to work with new VERSIONS format
2021-05-10 16:29:43 +03:00
Ivan Levkivskyi
55549ea01f More consistency checks for dependencies (#4990)
Closes #4988

Co-authored-by: Ivan Levkivskyi <ilevkivskyi@dropbox.com>
2021-02-01 15:16:53 +00:00
Ivan Levkivskyi
e2fd852952 Add more consistency tests (#4983)
Follow up fo #4971

Co-authored-by: Ivan Levkivskyi <ilevkivskyi@dropbox.com>
2021-01-29 17:23:35 +00: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
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
Sebastian Rittau
5927e5ca30 Remove most consistency checks and split builtins.pyi into py2/3 files (#4686)
Split builtins.pyi in Python 2 and 3 versions

Partly addresses #4674
2020-10-22 13:39:06 -07:00
Rune Tynan
e49c156d92 Add winreg stubs (#3794) 2020-05-27 17:15:08 +02:00
Shantanu
baf107a158 check_consistent: print a copy-pasteable cp command (#3992) 2020-05-14 08:57:18 +02:00
Sebastian Rittau
92f52a2615 flake8 updates and cleanups (#3940)
* flake8 updates and cleanups

* Update to flake8 3.7.9.
* Update to flake8-bugbear 20.1.4.
* Only ignore errors in stub files.
* Remove obsolete error counts.
* Sort error codes alphabetically.
* Don't ignore the following errors (unneeded):
    * E704 Multiple statements on one line (def)
    * W504 Line break occurred after a binary operator
    * B303 __metaclass__ used

* Remove obsolete comment

* Ignore F822 undefined name in __all__
2020-04-23 19:38:47 -07:00
Rune Tynan
85afac3bd5 Add (_)dummy_threading module, identical to threading (#3554)
* Add (_)dummy_threading module, identical to threading

* Remove unnecessary comment, add consistency check
2020-01-18 07:42:32 -08:00
Rune Tynan
b112c20dad Copyreg stubs (#3387) 2019-10-29 19:52:05 -07:00
Sebastian Rittau
6507875f28 Annotate Python 3.8 removals (#3359)
* macpath
* time.clock()
* Some cgi functions
* XMLParser(html) and doctype()
* unicode_internal
* Two sqlite3 classes hidden
* fileinput bufsize arg
* Treeview.selection no longer takes arguments
2019-10-14 09:51:39 +02:00
Vasily Zakharov
57384ce033 Revised stubs for geoip2 third party library (#3317) 2019-10-09 19:28:42 -07:00
Guido van Rossum
95185fa9cf Improve the explanatory comment at the top of check_consistent.py 2019-09-29 09:23:11 -07:00
Sebastian Rittau
9ccf9356bf Remove Python 3.4 support (#3147)
Closes #3123
2019-07-27 10:58:21 +02:00
Sebastian Rittau
eb1788ac39 Merge Python 2 and 3 builtins.pyi (#2533) 2018-12-21 07:12:41 -08:00
Dave Halter
5c69373890 macpath, os/path, posixpath and ntpath should basically be the same files (#2637) 2018-12-17 15:02:18 +01:00
Sebastian Rittau
ece96777a7 Re-export pyexpat instead of using check_consistency (#2649) 2018-11-29 07:29:59 -08:00
Sebastian Rittau
e3a79d0ce6 Remove third_party/3/enum.py (#2563)
All Python 3 versions supported by typeshed (3.4+) have enum as part
of the standard library.

Make the third-party Python 2 version consistent with the Python 3 version.
2018-10-27 08:54:56 -07:00
stevenjackson121
80a0a75f5f Add stubs for contextvars backport (3.5 and 3.6) (#2378)
* Add stubs for contextvars backport (3.5 and 3.6)

* Add contextvars to tests/check_consistent.py
2018-08-14 08:05:02 -07:00
Daniel Li
631d2768d6 Add stub for pathlib2 on Python 2.7 (#2351)
pathlib2 is the Python 2.7 backport of the pathlib module from Python 3.
Hence we use the same stub file for both.

The maintainer of pathlib2 granted permission for stubs to be added in
mcmtroffaes/pathlib2#44.
2018-08-07 10:27:18 -07:00
Gary van der Merwe
c1f89a90b4 Make dataclasses available as a backported third_party library. (#2354) 2018-08-07 10:04:33 -07:00