Commit Graph

33 Commits

Author SHA1 Message Date
Sergii Tkachenko de6ed9ba9f
[Python] Migrate from yapf to black (#33138)
- Switched  from yapf to black
- Reconfigure isort for black
- Resolve black/pylint idiosyncrasies 

Note: I used `--experimental-string-processing` because black was
producing "implicit string concatenation", similar to what described
here: https://github.com/psf/black/issues/1837. While currently this
feature is experimental, it will be enabled by default:
https://github.com/psf/black/issues/2188. After running black with the
new string processing so that the generated code merges these `"hello" "
world"` strings concatenations, then I removed
`--experimental-string-processing` for stability, and regenerated the
code again.

To the reviewer: don't even try to open "Files Changed" tab 😄 It's
better to review commit-by-commit, and ignore `run black and isort`.
2023-06-09 15:08:55 -07:00
Richard Belleville 59693b7e72
Migrate Infrastructure Scripts to Python 3 (#27135)
* Run 2to3 on tools directory

* Delete github_stats_tracking

* Re-run 2to3

* Remove unused script

* Remove unused script

* Remove unused line count utility

* Yapf. Isort

* Remove accidentally included file

* Migrate tools/distrib directory to python 3

* Remove unnecessary shebang

* Restore line_count directory

* Immediately convert subprocess.check_output output to string

* Take care of Python 2 shebangs

* Invoke scripts using a Python 3 interpreter

* Yapf. Isort

* Try installing Python 3 first

* See if we have any Python 3 versions installed

* Add Python 3.7 to Windows path

* Try adding a symlink

* Try to symlink differently

* Install six for Python 3

* Run run_interop_tests with python 3

* Try installing six in python3.7 explicitly

* Revert "Try installing six in python3.7 explicitly"

This reverts commit 2cf60d72f3.

* And debug some more

* Fix issue with jobset.py

* Add debug for CI failure

* Revert microbenchmark changes
2021-11-08 08:55:25 -08:00
Lidi Zheng 2231c2ba77
Introduce Python import sorting to our sanity test suite (#26768)
* Add isort_code.sh to sanity tests

* Run tools/distrib/isort_code.sh

* Fine tune the import order for relative imports

* Make pylint and project generation happy

* Fix a few corner cases

* Use --check instead of --diff

* The import order impacts test result somehow

* Make isort print diff and check output at the same time

* Let tools/run_tests/python_utils be firstparty library

* Run isort against latest HEAD
2021-07-26 12:31:21 -07:00
Ben Beasley d483841001
Explicitly import importlib.abc; required on Python 3.10. Fixes #26062. (#26083) 2021-04-26 16:44:12 -07:00
Richard Belleville f13b324941 Include well-known types in sys.path when using runtime protos 2020-10-19 13:02:33 -07:00
Richard Belleville d743defdaf Fix import errors on Windows 2020-09-10 19:26:43 -04:00
Richard Belleville 47dc875801 Make version check more stringent 2020-09-09 15:32:52 -07:00
Richard Belleville b50110b583 Fix Windows 2020-08-10 14:49:48 -07:00
Richard Belleville 60f88e20a4 Fix bazel grpc_tools test 2020-08-06 17:04:22 -07:00
Richard Belleville 2c1efcd0ae Add documentation 2020-08-06 12:25:21 -07:00
Richard Belleville 9448150eec Remove option to specify path 2020-07-17 16:46:38 -07:00
Richard Belleville 999bbf1401 Format 2020-07-15 13:09:53 -07:00
Richard Belleville 928c6f23ea Be completely safe for Python 2 2019-12-10 17:37:53 -08:00
Richard Belleville 12cf83fd70 Run under setuptools 2019-12-10 16:02:05 -08:00
Richard Belleville 447eba1ed7 Make imports thread-safe 2019-12-10 11:53:47 -08:00
Richard Belleville 5c76f50e2f Format Python code 2019-12-10 11:41:59 -08:00
Richard Belleville 467bc90a6f Simplify naming 2019-12-03 16:29:27 -08:00
Richard Belleville b9b126a237 Add new functions to grpc api surface 2019-12-03 16:14:40 -08:00
Richard Belleville 7400bc0657 Readability 2019-12-03 11:08:44 -08:00
Richard Belleville ecab62dc31 Support services too 2019-12-02 17:08:00 -08:00
Richard Belleville 595807e0c5 Create importlib path for protos 2019-12-02 16:47:15 -08:00
Richard Belleville 709143d1f5 Support multiple include paths. Pretty print errors. Support combined import 2019-12-02 13:01:33 -08:00
Richard Belleville 70d61da47e Test mixing of static and dynamic loading 2019-11-27 15:30:11 -08:00
Richard Belleville 4d3790271a Support importing a dependency tree of protos. 2019-11-27 13:47:37 -08:00
Richard Belleville 555019b098 Clean up service import 2019-11-27 10:34:02 -08:00
Richard Belleville 01031e2fca Generate services in a dirty way 2019-11-27 10:09:19 -08:00
Richard Belleville 94ca493f4e Instantiate a module with the generated code 2019-11-26 16:46:49 -08:00
Richard Belleville 9cc62a6208 WIP. Output protos in memory, not to STDOUT 2019-11-26 15:23:08 -08:00
Richard Belleville 0cfe955068 Add a simple unified importer 2019-11-22 16:32:23 -08:00
ncteisen 7a2be20a8a yapf tools/distrib 2017-12-11 16:49:19 -08:00
Jan Tattermusch 7897ae9308 auto-fix most of licenses 2017-06-08 11:22:41 +02:00
Masood Malekghassemi f1cdf59b7f Patch overlooked strings from Python un-namespacing 2016-12-14 11:51:40 -08:00
Masood Malekghassemi fb261bf748 Un-namespace Python packages
Setuptools was updated and our hacky namespace-package-chickens came
back to roost. This removes the unsupported namespace package hacks.
2016-12-12 15:04:30 -08:00