mirror of
https://github.com/davidhalter/typeshed.git
synced 2026-02-08 10:50:59 +08:00
Require black and isort for contributions (#3329)
* Add explanation to CONTRIBUTNG.md * Add sample pre-commit script * Check for correctly formatted files in CI Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
This commit is contained in:
@@ -15,6 +15,7 @@ are important to the project's success.
|
||||
but [contact us](#discussion) before starting significant work.
|
||||
* Create your stubs [conforming to the coding style](#stub-file-coding-style).
|
||||
* Make sure your tests pass cleanly on `mypy`, `pytype`, and `flake8`.
|
||||
* Reformat your stubs with `black` and `isort`.
|
||||
4. [Submit your changes](#submitting-changes) by opening a pull request.
|
||||
5. You can expect a reply within a few days:
|
||||
* Diffs are merged when considered ready by the core team.
|
||||
@@ -222,8 +223,14 @@ rule is that they should be as concise as possible. Specifically:
|
||||
* use variable annotations instead of type comments, even for stubs
|
||||
that target older versions of Python;
|
||||
* for arguments with a type and a default, use spaces around the `=`.
|
||||
The code formatter [black](https://github.com/psf/black) will format
|
||||
stubs according to this standard.
|
||||
|
||||
Stubs should be reformatted with the formatters
|
||||
[black](https://github.com/psf/black) and
|
||||
[isort](https://github.com/timothycrosley/isort) before submission.
|
||||
These formatters are included in typeshed's `requirements-tests-py3.txt` file.
|
||||
A sample `pre-commit` file is included in the typeshed repository. Copy it
|
||||
to `.git/hooks` and adjust the path to your virtual environment's `bin`
|
||||
directory to automatically reformat stubs before commit.
|
||||
|
||||
Stub files should only contain information necessary for the type
|
||||
checker, and leave out unnecessary detail:
|
||||
|
||||
Reference in New Issue
Block a user