lookout-sdk

Toolkit for writing new analyzers for source{d} Lookout.
What Does the SDK Provide?
For the complete documentation of source{d} Lookout, please take a look at https://docs.sourced.tech/lookout.
For detailed information about the different parts of Lookout, and how they interact you can go to the Lookout architecture guide.
lookout-sdk provides:
- proto definitions.
- pre-generated libraries for Golang and Python, offering:
- an easy access to the DataService API though a gRPC service. Lookout will take care of dealing with Git repositories, UAST extraction, programming language detection, etc.
- low-level helpers to work around some protobuf/gRPC caveats.
- quickstart examples of an Analyzer that detects language and number of functions (written in Go and in Python).
Caveats
For the gRPC client and server please follow these requirements:
- set a common maximum gRPC message size in gRPC servers and clients. This is required to avoid hitting different gRPC limits when handling UASTs, that can be huge —see grpc/grpc#7927—. To do so use the included helpers in lookout-sdk:
- go: using
pb.NewServerandpb.DialContext. - python: using
lookout.sdk.grpc.create_serverandlookout.sdk.grpc.create_channel.
- go: using
- support RFC 3986 URI scheme; lookout-sdk includes helpers for this:
- go: using
pb.ToGoGrpcAddressandpb.Listen. - python: using
lookout.sdk.grpc.to_grpc_address.
- go: using
- use insecure connection:
- currently lookout expects to use insecure gRPC connections, as provided by
pb.DialContext - python: run server using
server.add_insecure_port(address)(example).
- currently lookout expects to use insecure gRPC connections, as provided by
DataService
When DataService is being dialed, you should:
- turn on gRPC Wait for Ready mode if your analyzer creates a connection to DataServer before it was actually started. This way the RPCs are queued until the chanel is ready:
- go: using
grpc.WaitForReady(true). - python: using the
wait_for_readyflag.
- go: using
- golang: reset connection backoff to DataServer on event:
if you keep the connection to DataServer open you need to reset the backoff when your analyzer receives a new event. Use the
conn.ResetConnectBackoffmethod in your event handlers. It's needed to avoid broken connections after alookoutdredeployment. In case of a long restart oflookoutdgRPC server, the backoff timeout may increase so much that the analyzer will not be able to reconnect before it makes the new request to DataServer.
Contributing
Contributions are welcome and very much appreciated 🙌
Please refer to our Contribution Guide for more details.
Community
source{d} has an amazing community of developers and contributors who are interested in Code As Data and/or Machine Learning on Code. Please join us! 👋
Code of Conduct
All activities under source{d} projects are governed by the source{d} code of conduct.
License
Apache License Version 2.0, see LICENSE
Metadata
Release files for lookout-sdk 0.6.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| lookout-sdk-0.6.3.tar.gz | 20.6 kB | Without provenance | Details for lookout-sdk-0.6.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| lookout_sdk-0.6.3-py3-none-any.whl | Python 3 | none | any | Details for lookout_sdk-0.6.3-py3-none-any.whl |
Total release size: 46.8 kB
Release files / lookout-sdk-0.6.3.tar.gz
| Download URL | lookout-sdk-0.6.3.tar.gz |
|---|---|
| Size | 20.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
175304719f5e37666073ec0989700a73ad7d2d65cdd91962d474468ac222e252
|
|
BLAKE2b-256 checksum How to use checksums |
a5911f279f7ee50941458d006094446414e63076b0e5b637b74b9c9f5e909580
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.6.3 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.7
|
Release files / lookout_sdk-0.6.3-py3-none-any.whl
| Download URL | lookout_sdk-0.6.3-py3-none-any.whl |
|---|---|
| Size | 26.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
3e775ff0c4142fefe14658c32244bb54b020000cee6a18e343b621e23093068a
|
|
BLAKE2b-256 checksum How to use checksums |
8dacbb5477474a8374ec10c7d1326610df10d422add2cfaa26def9479098d397
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.6.3 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.7
|
Security for lookout-sdk 0.6.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.