30 Commits

Author SHA1 Message Date
Esun Kim db53a45e2b [Deps] Removed vendored python deps from Bazel builds (#38716)
Roll-forward of https://github.com/grpc/grpc/pull/38692

Closes #38716

PiperOrigin-RevId: 725813827
2025-02-11 16:28:07 -08:00
Esun Kim 16715aab00 [Deps] Revert "Removed vendored python deps from Bazel builds (#38692)" (#38705)
This reverts commit 68b5dc5125 (https://github.com/grpc/grpc/pull/38692).

Copybara missed the load statement, which shouldn't happen, causing many build failures on master.

Closes #38705

PiperOrigin-RevId: 724474971
2025-02-07 14:40:40 -08:00
Esun Kim 68b5dc5125 [Deps] Removed vendored python deps from Bazel builds (#38692)
With the Bazel build transitioning to BzlMod, all vendored Bazel Python targets must be removed.  These targets are not available in the BCR and need be managed via a pip `requirements.bazel.txt` file. gRPC already uses this approach, so it is going to be extended to include those target. (e.g. see [test utils](https://github.com/grpc/grpc/blob/e06ad82c3fdde9ec6598d314998d88e848f4c577/test/cpp/naming/utils/BUILD#L27-L45) to understand how those targets are used)

Additionally, the generation of the `requirements.bazel.lock` file has been improved.  Because this file is a lock file, including all transitive dependencies, manual maintenance is not managable.  Its new source file, `requirements.bazel.txt` is created to list only the direct dependencies used by gRPC, along with instructions for generating the full lock file.  This source file omits specific version requirements to use the latest available versions, but version constraints can be added as needed.

Closes #38692

PiperOrigin-RevId: 724427578
2025-02-07 12:10:20 -08:00
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 2cf60d72f388a95d642b2c99a775d88a6248f788.

* 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
nanahpang e4ead4bec0 Update docgen.py
Fix a RexAnalyzer error during the import, and update in github as well. 

Parentheses around a single item in Python has no effect: (foo) is exactly equivalent to foo. In many cases this is harmless, but it can suggest a subtle bug when used in string formatting.  A '%'-formatted string with a single format specifier can be formatted using a single value or a one element tuple: 'hello %s' % name or 'hello %s' % (name,). Consequently, a line like error_msg = 'Cannot process %s' % (data) may leave code reviewers and future readers unsure if there is a subtle bug if data is a tuple. 

Since the args.repo_owner here is a single string, drop the parentheses is better.
2020-08-04 13:51:23 -07:00
Lidi Zheng 38530cc2bc Make docgen work better with virtualenv 2020-08-03 11:44:16 -07:00
Lidi Zheng 981baff79b Fix the docgen script:
1. Make it use python3 by default;
2. Simplify its arguments.
2020-08-03 11:28:56 -07:00
Esun Kim 7be821ac47 Yapf all target python sources 2020-01-03 09:25:10 -08:00
Lidi Zheng 016d03fbad Update the docgen.py 2019-12-19 10:53:55 -08:00
Lidi Zheng 0404939ad0 Let our CI use the latest pip version 2019-12-19 10:53:55 -08:00
Lidi Zheng 7095f5acbe Use requirements.bazel.txt to generate Python documents 2019-04-16 11:27:31 -07:00
Lidi Zheng d1776af2ff Make docgen.py work
* Merge unnecessary arguments
* Remove the build command (CI should make sure it works, not this script)
* Speed up the GitHub operations with proper flags
* Adding Sphinx to setup requirement
2018-11-15 17:39:22 -08:00
Mehrdad Afshari d0d8ce8568 Bump pip version to 10.0.1 2018-04-19 15:48:23 -04:00
ncteisen 7a2be20a8a yapf tools/distrib 2017-12-11 16:49:19 -08:00
Nathaniel Manista 8bba3bfc25 Pin pip at 9.0.1 2017-09-28 17:28:01 +00:00
Jan Tattermusch 7897ae9308 auto-fix most of licenses 2017-06-08 11:22:41 +02:00
Masood Malekghassemi aa7089a549 Be more verbose when generating Python documentation 2017-01-20 18:55:09 -05:00
Masood Malekghassemi db422d7eba Provide doc dir even if user interrupts docgen 2016-12-27 09:57:13 -08:00
Masood Malekghassemi 2da4666bdd Don't set up Python doc packages every time 2016-10-25 18:06:18 -07:00
Masood Malekghassemi 6f7d4221af Upgrade virtualenv pip in Python docgen
Also ignore the docgen-generated directories under doc/.
2016-07-20 17:23:45 -07:00
Masood Malekghassemi 48d07c6489 Add special methods to generated Python docs
Also removes an old-now-spurious `make` invocation from the docgen.py
helper script.
2016-07-12 16:20:29 -07:00
Craig Tiller 6169d5f7b0 Update copyrights 2016-03-31 07:46:18 -07:00
Stanley Cheung 6156f0962e Simplify PHP installation for release 0.13 2016-02-28 19:14:07 -08:00
Masood Malekghassemi 3ee1f9b778 Update Python docgen 2016-02-22 18:37:51 -08:00
Nathaniel Manista ae4fbcd643 Use "#!/usr/bin/env python2.7" only in utilities 2015-09-23 16:29:44 +00:00
Masood Malekghassemi 38fc0bb3d5 Fix Python docgen
The old package directory handling was stale in grpcio's setup.py
command support module and docgen had a typo.
2015-09-10 08:57:40 -07:00
Masood Malekghassemi fe8dc883d0 Reorganize Python packages
This is in preparation of moving all tests into a separate package to
enable ease of coverage checking and testing.
2015-07-30 16:25:55 -07:00
Masood Malekghassemi d65632ab04 Add Python documentation generation 2015-07-29 14:43:16 -07:00