Skip to main content

cpgqls-client-python

cpgqls-client-python is a simple Python library for communicating with an instance of a Code Property Graph Query Language server.

Requirements

Python 3.7+

Installation

pip install cpgqls-client

Example usage

A prerequisite for the following example is access to a running instance of a Code Property Graph server. An easy way to set one up is by using the open source code analyzer joern:

$ ./joern --server
from cpgqls_client import CPGQLSClient, import_code_query, workspace_query

server_endpoint = "localhost:8080"
basic_auth_credentials = ("username", "password")
client = CPGQLSClient(server_endpoint, auth_credentials=basic_auth_credentials)

# execute a simple CPGQuery
query = "val a = 1"
result = client.execute(query)
print(result)

# execute a `workspace` CPGQuery
query = workspace_query()
result = client.execute(query)
print(result['stdout'])

# execute an `importCode` CPGQuery
query = import_code_query("/home/user/code/x42/c", "my-c-project")
result = client.execute(query)
print(result['stdout'])

query = import_code_query("/home/user/code/x42/java/X42.jar", "my-java-project")
result = client.execute(query)
print(result['stdout'])

Running the test suite

# set up the virtual environment
$ python -m venv .venv
$ . .venv/bin/activate

# install the dependencies
$ pip install -r requirements.txt
$ pip install -r requirements-tests.txt

# run the tests
$ python -m pytest

References

Metadata

Release files for cpgqls-client 0.0.9

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for cpgqls-client 0.0.9
File Size Uploaded Provenance Actions
cpgqls-client-0.0.9.tar.gz 7.1 kB Without provenance Details for cpgqls-client-0.0.9.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for cpgqls-client 0.0.9
File Interpreter ABI Platform Actions
cpgqls_client-0.0.9-py2.py3-none-any.whl Python 2, Python 3 none any Details for cpgqls_client-0.0.9-py2.py3-none-any.whl

Total release size: 15.0 kB

Release files / cpgqls-client-0.0.9.tar.gz

Download URL cpgqls-client-0.0.9.tar.gz
Size 7.1 kB
Tags Source
SHA-256 checksum
How to use checksums
16e1009b1774cf88a3dbfb6e3a2ff48376717a218c6004c622fb1489fb7ed1b4
BLAKE2b-256 checksum
How to use checksums
d3d1c5092e4e9a7120b6504c7d71633e7044fcce4acb8432b794dfb64f4c4cbe
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.2 importlib_metadata/4.7.1 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.7.11

Release files / cpgqls_client-0.0.9-py2.py3-none-any.whl

Download URL cpgqls_client-0.0.9-py2.py3-none-any.whl
Size 7.8 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
f4e3f62dc70efd89356c8036782a54ccf591ddd47ed1c053d3f3c17f2ebc656e
BLAKE2b-256 checksum
How to use checksums
42a06a0670675b448aa0d52a04f9e9c77d5138f6392102d8b5b2705e97bdf9fd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.2 importlib_metadata/4.7.1 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.7.11

Security for cpgqls-client 0.0.9

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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page