Saravanan666/pypi-org huggingface dataset:
Package: grpcio-fips
Package for gRPC Python.Supported Python VersionsPython >= 3.7InstallationgRPC Python is available for Linux, macOS, and Windows.Installing From PyPIIf you are installing locally…$ pip install grpcioElse system wide (on Ubuntu)…$ sudo pip install grpcioIf you’re on Windows make sure that you installed thepip.execomponent
when you installed Python (if not go back and install it!) then invoke:$ pip.exe install grpcioWindows users may need to invokepip.exefrom a command line ran as
administrator.n.b. On Windows and on Mac OS X onemusthave a recent release ofpipto retrieve the proper wheel from PyPI. Be sure to upgrade to the latest
version!Installing From SourceBuilding from source requires that you have the Python headers (usually a
package namedpython-dev).$ export REPO_ROOT=grpc  # REPO_ROOT can be any directory of your choice
$ git clone -b RELEASE_TAG_HERE https://github.com/grpc/grpc $REPO_ROOT
$ cd $REPO_ROOT
$ git submodule update --init

# For the next two commands do `sudo pip install` if you get permission-denied errors
$ pip install -rrequirements.txt
$ GRPC_PYTHON_BUILD_WITH_CYTHON=1 pip install .You cannot currently install Python from source on Windows. Things might work
out for you in MSYS2 (follow the Linux instructions), but it isn’t officially
supported at the moment.TroubleshootingHelp, I …… see apkg_resources.VersionConflictwhen I try to install
grpcThis is likely becausepipdoesn’t own the offending dependency,
which in turn is likely because your operating system’s package manager owns
it. You’ll need to force the installation of the dependency:pip install --ignore-installed $OFFENDING_DEPENDENCYFor example, if you get an error like the following:Traceback (most recent call last):
File "<string>", line 17, in <module>
 ...
File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 509, in find
  raise VersionConflict(dist, req)
pkg_resources.VersionConflict: (six 1.8.0 (/usr/lib/python2.7/dist-packages), Requirement.parse('six>=1.10'))You can fix it by doing:sudo pip install --ignore-installed six… see the following error on some platforms/tmp/pip-build-U8pSsr/cython/Cython/Plex/Scanners.c:4:20: fatal error: Python.h: No such file or directory
#include "Python.h"
                ^
compilation terminated.You can fix it by installingpython-devpackage. i.esudo apt-get install python-dev
Package: grpcio-gcp
Package for gRPC-GCP Python.InstallationgRPC-GCP Python is available wherever gRPC is available.From PyPIIf you are installing locally…$ pip install grpcio-gcpElse system wide (on Ubuntu)…$ sudo pip install grpcio-gcpUsageCreate a config file (e.g.spanner.grpc.config) defining API configuration,
with ChannelPoolConfig and MethodConfig.channel_pool: {
  max_size: 10
  max_concurrent_streams_low_watermark: 1
}
method: {
  name: "/google.spanner.v1.Spanner/CreateSession"
  affinity: {
    command: BIND
    affinity_key: "name"
  }
}
method: {
  name: "/google.spanner.v1.Spanner/GetSession"
  affinity: {
    command: BOUND
    affinity_key: "name"
  }
}
method: {
  name: "/google.spanner.v1.Spanner/DeleteSession"
  affinity: {
    command: UNBIND
    affinity_key: "name"
  }
}Load configuration file to ApiConfig object.importgoogle.protobuf.text_formatconfig=grpc_gcp.api_config_from_text_pb(pkg_resources.resource_string(__name__,'spanner.grpc.config'))Create channel pool using grpc_gcp.importgrpc_gcpimportgrpccredentials=grpc.ssl_channel_credentials()# Add api config key-value pair to optionsoptions=[(grpc_gcp.API_CONFIG_CHANNEL_ARG,config)]channel_pool=grpc_gcp.secure_channel(target,credentials,options)The generated channel pool is inherited from the original grpc.Channel,
with underlying support for multiple grpc channels.
Package: grpcio-helpers
gRPC ImporterThis package contains helper tools for working with gRPC services in Python.
Specifically it provides import hooks for the Python import machinery which lets users import.protofiles directly
without having to precompile them, and a gRPC server setup wrapper to streamline the process of hosting gRPC services.UsageRegister import hooks by callingregister_import_hook(). This call optionally takes the argumentssave_compiled,well_known_protos, andextra_args, which specifies if compiled Python files should be written into the project
folder and gives additional arguments toprotoc. All arguments are specified per package, for which the closest parent
package or__main__'s configuration is used.After registration the gRPC importer will auto-magically be used to import modules ending in_pb2or_pb2_grpcif
a corresponding.protofile is present in the same package. The importer checks the modified time on the produced
Python source files to determine if a fresh compile is needed for every import.This package also includes a helper functionserve()which can be used to start a gRPC server.
Package: grpclib
This project is based onhyper-h2andrequires Python >= 3.7.ExampleClientServerInstallationprotocpluginContributingExampleSeeexamplesdirectory in the project’s repository for all available
examples.Clientimportasynciofromgrpclib.clientimportChannel# generated by protocfrom.helloworld_pb2importHelloRequest,HelloReplyfrom.helloworld_grpcimportGreeterStubasyncdefmain():asyncwithChannel('127.0.0.1',50051)aschannel:greeter=GreeterStub(channel)reply=awaitgreeter.SayHello(HelloRequest(name='Dr. Strange'))print(reply.message)if__name__=='__main__':asyncio.run(main())Serverimportasynciofromgrpclib.utilsimportgraceful_exitfromgrpclib.serverimportServer# generated by protocfrom.helloworld_pb2importHelloReplyfrom.helloworld_grpcimportGreeterBaseclassGreeter(GreeterBase):asyncdefSayHello(self,stream):request=awaitstream.recv_message()message=f'Hello,{request.name}!'awaitstream.send_message(HelloReply(message=message))asyncdefmain(*,host='127.0.0.1',port=50051):server=Server([Greeter()])# Note: graceful_exit isn't supported in Windowswithgraceful_exit([server]):awaitserver.start(host,port)print(f'Serving on{host}:{port}')awaitserver.wait_closed()if__name__=='__main__':asyncio.run(main())Installation$pip3install"grpclib[protobuf]"Bug fixes and new features are frequently published via release candidates:$pip3install--upgrade--pre"grpclib[protobuf]"For the code generation you will also need aprotoccompiler, which can be
installed withprotobufsystem package:$brewinstallprotobuf# example for macOS users$protoc--versionlibprotoc ...Oryou can useprotoccompiler from thegrpcio-toolsPython package:$pip3installgrpcio-tools$python3-mgrpc_tools.protoc--versionlibprotoc ...Note:grpcioandgrpcio-toolspackages arenot required in
runtime,grpcio-toolspackage will be used only during code generation.protocpluginIn order to use this library you will have to generate special stub files using
plugin provided, which can be used like this:$python3-mgrpc_tools.protoc-I.--python_out=.--grpclib_python_out=.helloworld/helloworld.proto^----- note -----^This command will generatehelloworld_pb2.pyandhelloworld_grpc.pyfiles.Plugin which implements--grpclib_python_outoption should be available for
theprotoccompiler as theprotoc-gen-grpclib_pythonexecutable which
should be installed bypipinto your$PATHduring installation of thegrpcliblibrary.Changed in v0.3.2:--python_grpc_outoption was renamed into--grpclib_python_out.ContributingPlease submit an issue before working on a Pull RequestDo not merge/squash/rebase your development branch while you work on a Pull
Request, use rebase if this is really necessaryYou may useToxin order to test and lint your changes, but it is Ok to rely
on CI for this matter
Package: grpc-load-balancer
gRPC Load Balancergrpc_load_balanceris a Python package that allows you to easily configure and manage separate gRPC server and client instances using a metrics-based load balancing approach. This is useful when you have multiple services running and want to distribute the load efficiently among them. The package includes a connection forwarder, a metrics-based server finder, and a configuration loader.
It implemetns the following design:FeaturesForward connections from clients to gRPC servers.Use Prometheus metrics to select the best server to handle a request.Configure and manage gRPC server finder using environment variables.InstallationYou can installgrpc_load_balancerusing pip:pipinstallgrpc_load_balancerInstall promethus-client:pipinstallprometheus-clientUsageConfiguring and running a gRPC serverHere's a simple example of how to use grpc_load_balancer with a gRPC server and prometeus-client:Import the required modules:importgrpcfromgrpc_load_balancerimportGrpcConnnectionForwarderfromprometheus_clientimportstart_http_server,GaugeInitialize your gRPC server(s)grpc_server=create_example_grpc_server()# implement this function yourselfconnection_counter=Gauge('connections_num','Number of connections forwarded')forwarder=GrpcConnnectionForwarder(grpc_server,callback=lambdavalue:connection_counter.set(value))start_http_server(prometheus_port)# forwarder_port - port to listen connections from gRPC clients# Note this call is blockingforwarder.serve(host="0.0.0.0",port=forwarder_port)# If you want to run the server in a separate thread, and want to stop it later, use the forwarder.stop() methodConfiguring and running a gRPC clientImport the required modules:importgrpcfromgrpc_load_balancerimportEnvConfigLoader,MetricsBasedServerFinderInitialize the configuration loader# This is example how your environment variables can look like# os.environ['LB_METRICS_NAME'] = 'connections_num'# os.environ['LB_HOST1_HOST'] = 'localhost'# os.environ['LB_HOST1_PORT'] = '20000'# os.environ['LB_HOST1_METRICS_PORT'] = '20001'# os.environ['LB_HOST2_HOST'] = 'localhost'# os.environ['LB_HOST2_PORT'] = '30000'# os.environ['LB_HOST2_METRICS_PORT'] = '30001'env_config_loader=EnvConfigLoader(prefix="LB")Initialize the server finder, find the best server and connect to itmetrics_based_server_finder=env_config_loader.init_metrics_based_server_finder()best_host=metrics_based_server_finder.fetch_metrics()channel=grpc.insecure_channel(f"{best_host[0]}:{best_host[1]}")client=create_example_grpc_client(channel)# implement this function yourself# Use the client to send requests to the serverTroubleshootingIf you have any problems withgrpc_load_balancer, please open an issue on GitHub.
Also, you can checktests/test_grpc_load_balancer.pyfor more information.ContributingWe welcome contributions togrpc_load_balancer. If you find a bug or want to propose a new feature, please open a GitHub issue or submit a pull request.LicenseThis project is licensed under the MIT License. SeeLICENSEfor details.
Package: grpc-protoc-annotations
gRPC Gateway SupportThis repo generates the missing Python code to support code generated usinggRPC Gatewayprotoc annotations.This package depends ongoogleapis-common-protosto providegoogle.api.annotations_pb2and others
that the generated code will depend on.Usagepipinstallgrpc-protoc-annotationsBuildingRunmake initRunmake buildto generate the code from grpc-gateway and build the packageRunpip install dist/grpc_protoc_annotations-2.14.0-py3-none-any.whlto install in the current Python
distributionPublishing (optional)Setup PyPi credentials andmake distributeCreditsOriginal implementation from HackEdu, but Github repository is not available anymore and the Pypi package unmaintained.
Package: grpc-proto-validator
plugin of validate request field for python grpc server.TODO:type hint for different field type.(such as only string field can do
a string length check.)test case & Makefile.a cli to help protoc withvalidator.proto.anymore bugs or improves?How Toinstallpipinstallgrpc-proto-validator2. copyvalidator.prototo your project proto path and do protoc.(TODO a
cli help to copy or build proto.)Thevalidator.protois included in this package, you can find it in
python site-packages path.A example on how to generate the grpc files:$python-mgrpc_tools.protoc\--proto_path={/path/to/validator/proto}\--proto_path={/path/to/your/project/proto}\--python_out={/path/to/project/src}\--grpc_python_out={/path/to/project/src}\path/to/your.protochange your service and *_pb2 code.To avoid protobuf import error, change one line in the generated
python file(likehello_bro_pb2.py).from:importvalidator_pb2asvalidator__pb2to:importgrpc_proto_validator.validator_pb2asvalidator__pb2.Then create service with validator:importsixfromgrpc_validator.validatorimportValidateMetaclassclassYourService(six.with_metaclass(ValidateMetaclass,YourService_pb2_grpc.YourServiceServer)):defbehaviour1(self,request,context)...Also, you can select individual service handler to do the field check:fromgrpc_validator.validatorimportvalidator_wrapclassYourService(YourService_pb2_grpc.YourServiceServer):defbehaviour(self,request,context):"""request will not be validated."""...@validator_wrapdefbehaviour2(self,request,context):...NoticeSomeone has usedgo-proto-validatorbefore will notice
that I almost reuse its proto file which make it easier
to co-work with our golang service team.But please don’t mix these two proto files.!!!THEY ARE NOT IN COMMON USE!!!Any help or idea is favourably receive. Please just make aissue.LICENSEMIT.
Package: grpc-route
DocumentationThe documentation is hosted athttps://github.com/BingerYang/grpc_routeInstallationpipinstallgrpc_routeUsageserver run:from grpc_route.server import Router

app = Router()


@app.route("index")
def test(n):
    # n / 0
    print("-> to index: ", n)
    return "server back ->"


if __name__ == "__main__":
    app.run_forever("0.0.0.0", port=5656)client run:from grpc_route.client import RouteClient
from grpc_route import AddrConf

addr1 = AddrConf("127.0.0.1", 5656)
app = RouteClient(addr1)
app.connect()


@app.register(handler="index", to_addr=addr1)
def run_index(n):
    pass
Package: grpc-stubs
This is a PEP-561-compliant stub-only package which provides type information of
[gRPC](https://grpc.io>).Install using pip:pip install grpc-stubsTests (courtesy of [pytest-mypy-plugins](https://github.com/typeddjango/pytest-mypy-plugins>):pip install -r requirements-dev.txt
./tools.sh test## Call for assistanceThere are several areas wheregrpc-stubscould use some TLC. If you’d like to
help with any of this, please reach out.### MaintainersIt’s unlikely I’ll be returning to grpc full-time for the foreseeable future,
and my knowledge of the minutiae fades with each passing year. If anyone wishes
to assume maintainership of this project ongoing, please reach out. An attempt to
merge into typeshed is underway here:https://github.com/python/typeshed/pull/11204## Python Supportgrpc-stubs is tested with 3.7 or later, but ideally it should support Python 3.6 as
grpc still supports this. Python 3.6 had to be disabled in the tests due to
various cascading fiascos and a lack of time to contend with them. Feel free
to submit a PR if you’d like to see it returned, or open issues. Ensure that
you supply an MRE as per the contributing guidelines below.## Contributing### Minimum Reproducible Examples (MRE)Unfortunately, due to the fussy nature ofgrpcand its dependencies, and the
huge amount of time required to construct a context in which to verify and
debug issues, starting from 2022-04-16, fairly strict issue and pull request
templates have been added.Minimum Reproducible Examples are now a hard requirement for pull requests that
touch the typing surface, and a soft requirement for issues. PRs without a
functioning MRE transfer the burden entirely from the contributor to the
maintainer, and I simply don’t have time to do the deep-dives required to build
out MREs from scratch when issues inevitably crop up. PRs without a trivially
executable MRE will be closed without further consideration; of course you are
always welcome to reopen once you have added a verified MRE!### TestsThis project uses a slightly old version ofhttps://github.com/TypedDjango/pytest-mypy-pluginsfor testing. All new
contributions will be required to include at least one, but probably multiple
tests. Seetypesafety/test_*.yml.### Code-generated stubsPRs containing auto-generated stubs have had to be reverted several times due
to issues. Starting from 2022-04-16, autogenerated stubs frommypy-protobufwill not be accepted without extensive tests, and will not be accepted with
edit warnings left in. It’s ok to use this tool to seed stubs, but not to
refresh stubs - once contributed to this repo, the stubs should be presumed to
have been written by hand.## Other Very Useful Typed Python Stuffhttps://github.com/TypedDjangohttps://github.com/typeddjango/pytest-mypy-pluginshttps://github.com/typeddjango/awesome-python-stubs
Package: grpc-tls
# gRPC toolsThis is tool for auto generating *.proto and mapping django model with protobuf.## Requirements- Python (2.7, 3.4, 3.5, 3.6, 3.7)- Django (1.11, 2.0, 2.1, 2.2)## InstallationInstall using pip```pip install grpc-tls```Add 'grpc_tls' to your INSTALLED_APPS setting.```INSTALLED_APPS = (...'grpc_tls',)```Update list apps your want migrate to protobuf:`GRPC_TLS_MODELS_APP=['core']`Update proto file name:`GRPC_TLS_BASE_PROTO='app_name'`.*Note*: This name must be unique if your app run multiple *.proto file## UsageGenerate *.proto file```python manage.py grpc_tls```All files will be generated in `grpc_dir/*`## ExampleLet's take a look at a quick example of running gRPC server.First generate proto files by running command line above.Then create a django command line: `run_grpc.py`.```import grpcfrom concurrent import futuresfrom django.core.management.base import BaseCommandfrom grpc_dir import auto_grpc_app, grpc_app_pb2_grpcclass Command(BaseCommand):help = 'Start gRPC server'def handle(self, *args, **options):server = grpc.server(futures.ThreadPoolExecutor(max_workers=10))grpc_app_pb2_grpc.add_GRPCAPPServicer_to_server(auto_grpc_app.AutoGRPC(), server)server.add_insecure_port('[::]:50051')server.start()print('server started on port 50051 ...')try:while True:passexcept KeyboardInterrupt:server.stop(0)```Start gRPC server:```python manage.py run_grpc```You can now send request at `http://127.0.0.1:50051/`## NotesDO NOT FILES IN `grpc_dir`
Package: grpc-web-proto-compile
This is a small script tailored to be used in CI environments and piplines to completely take care of generating typescript grpc stubs from protobuf files.$pipinstallgrpc_web_proto_compileTo compile a directory with your proto files, simply run:$grpc_web_proto_compilepath/to/your/proto/sources./out$grpc_web_proto_compile--help# For a list of available optionsIf you cloned the repository, the command looks like:$gitclonehttps://github.com/romnn/grpc-web-proto-compile$cdgrpc-web-proto-compile/$python-mgrpc_web_proto_compile.cli./tests/sample/./outDevelopmentFor detailed instructions seeCONTRIBUTING.TestsYou can run tests with$invoketest$invoketest--min-coverage=90# Fail when code coverage is below 90%$invoketype-check# Run mypy type checksLinting and formattingLint and format the code with$invokeformat$invokelintAll of this happens when you runinvokepre-commit.NoteThis project is still in the alpha stage and should not be considered production ready.
Package: grpcWSGI
gRPC-WSGIA gRPC-Web implementation based on Python's WSGI standard.Why?gRPC has a lot going for it but is awkward to use in some environments. gRPC-WSGI makes it easy to integrate gRPC when you need to use HTTP/1.1 load balancers or proxies, or want to integrate gRPC into existing services such as Django or Flask apps that speak a different protocol most of the time.There are two main capabilities this implementation has over Google's.HTTP/1.1 compatability via gRPC-Web, even for unary_stream RPCs using protobuf. Without the need for a sidecar proxy process like Envoy.Run gRPC and other HTTP stuff on the same socket.How?gRPC-WSGI is designed to require minimal changes to an existing WSGI or gRPC code base.ServerNormally a WSGI application (such as your favourite Django app) will call something such asfromdjango.core.wsgiimportget_wsgi_applicationapplication=get_wsgi_application()in it somewhere so that your application server (uWSGI, Gunicorn etc) knows where your code is.To add gRPC-WSGI to an application like the above all you need to do to enable it is this.fromdjango.core.wsgiimportget_wsgi_applicationfromgrpcWSGI.serverimportgrpcWSGIapplication=get_wsgi_application()application=grpcWSGI(application)The grpcWSGI application object also happens to be compatible with the normal grpc.Server interface.
So all you need to do actually attach your RPCs and start making calls to your new service is the usual gRPC setup of e.g.helloworld_pb2_grpc.add_GreeterServicer_to_server(Greeter(),application)And now you have a combined HTTP/1.1 Django + gRPC application all under a single port.ClientSetting up a client is similarly very simple and similar to standard gRPC calls.Instead of using gRPCs nativeinsecure_channelAPI we havegrpcWSGI.client.insecure_web_channelinstead which provides ahttps://github.com/kennethreitz/requestspowered client channel to a gRPC-Web server. e.g.importgRPCWSGI.clientwithgrpcWSGI.client.insecure_web_channel(f"http://localhost:8080")aschannel:stub=helloworld_pb2_grpc.GreeterStub(channel)print(stub.SayHello("world"))TODOError handlingCompression?Benchmarks?Clean up the CORS stuff.StreamStream/StreamUnary RPCs?Retries, caching and other client options.Quality of life integrations for Django, Flask etc.application/grpc-web-text support? Do I care about IE10? JSON is potentially faster than Protobuf sometimes...aiohttp / grpc-aiohttp / ASGI integration?MyPy annotations?https://github.com/dropbox/mypy-protobufAlready makes this pretty OK.Use more of the ABCs and other standard stuff from the grpc packageMake support for chunked encoding vaguely reliableSome kind of metaclass magic to make it easier to ensure you've actually implemented a servers interface
Package: grphpkg
grphpkggrphpkgis a simple graph library that has DFS and BFS implemented that you can create your own operation.GraphfromgrphpkgimportGraphmatrix_representation=[[0,1,0,1,0,0,0,0,1],[1,0,1,0,0,1,0,0,0],[0,1,0,0,0,0,1,0,0],[1,0,0,0,1,0,0,1,0],[0,0,0,1,0,1,0,0,0],[0,1,0,0,1,0,1,0,0],[0,0,1,0,0,1,0,1,0],[0,0,0,1,0,0,1,0,1],[1,0,0,0,0,0,0,1,0]]g=Graph(matrix_representation)# Initialize weighted graph with a matrixg.print_graph()# Print the graphg.dfs(0,lambdax:print(str(x)+" ",end=""))# Run DFS or BFS with custom callbackg.draw_graph()# Graph visualizationCreate your callback function and pass it in dfs or bfs to execute your operationWeighted Graphfrom grphpkg import Graphmatrix=[[0,2,3,float('inf')],[2,0,1,4],[3,1,0,5],[float('inf'),4,5,0]]weighted_graph=WeightedGraph(matrix)# Initialize weighted graph with a matrixweighted_graph.print_graph()# Print the graphmst_edges,mst_cost=weighted_graph.prim_mst(0)# Get minimun spanning and the edgesweighted_graph.draw_graph()# Graph visualizationGraph visualizationCall draw graph functiong.draw_graph()Installingpip install grphpkgDocumentation
Package: grplot
grplot: lazy statistical data visualizationgrplot is a Python visualization library based on numpy, scipy, matplotlib, seaborn, squarify, pandas, and ipython. It supports human laziness in drawing complete and attractive statistical graphs in just one line of code.DocumentationDocumentation atgrplot repositoryincludes aDocumentation Notebookand other useful information.Dependenciesgrplot supports Python 3.6+.Installation requiresnumpy,scipy,matplotlib,pandas, andipython. Some functions will optionally usestatsmodelsif it is installed.InstallationThe latest stable release (and required dependencies) can be installed from PyPI:pip install grplotThe latest stable release (and required dependencies) can be installed from Conda:conda install -c conda-forge grplotDevelopmentgrplot development takes place on Github:https://github.com/ghiffaryr/grplot/tree/devPlease submit bugs that you encounter to theissue trackerwith a reproducible example demonstrating the problem.