Skip to main content

UtBot Executor

Util for python code execution and state serialization.

Installation

You can install module from PyPI:

python -m pip install utbot-executor

Usage

From console with socket listener

Run with your <hostname> and <port> for socket connection

$ python -m utbot_executor <hostname> <port> <logfile> [<loglevel DEBUG | INFO | ERROR>] <coverage_hostname> <coverage_port>

Request format

{
  "functionName": "f",
  "functionModule": "my_module.submod1",
  "imports": ["sys", "math", "json"],
  "syspaths": ["/home/user/my_project/"],
  "argumentsIds": ["1", "2"],
  "kwargumentsIds": ["4", "5"],
  "serializedMemory": "string",
  "memoryMode": "REDUCE",
  "filepath": ["/home/user/my_project/my_module/submod1.py"],
  "coverageId": "1"
}
  • functionName - name of the tested function
  • functionModule - name of the module of the tested function
  • imports - all modules which need to run function with current arguments
  • syspaths - all syspaths which need to import modules (usually it is a project root)
  • argumentsIds - list of argument's ids
  • kwargumentsIds - list of keyword argument's ids
  • serializedMemory - serialized memory throw deep_serialization algorithm
  • memoryMode - serialization mode (PICKLE, REDUCE)
  • filepath - path to the tested function's containing file
  • coverageId - special id witch will be used for sending information about covered lines

Response format:

If execution is successful:

{
        "status": "success",
        "isException": false,
        "statements": [1, 2, 3],
        "missedStatements": [4, 5],
        "stateInit": "string",
        "stateBefore": "string",
        "stateAfter": "string",
        "diffIds": ["3", "4"],
        "argsIds": ["1", "2", "3"],
        "kwargs": ["4", "5", "6"],
        "resultId": "7"
}
  • status - always "success"
  • isException - boolean value, if it is true, execution ended with an exception
  • statements - list of the numbers of covered rows
  • missedStatements - list of numbers of uncovered rows
  • stateInit - serialized states from request
  • stateBefore - serialized states of arguments before execution
  • stateAfter - serialized states of arguments after execution
  • diffIds - ids of the objects which have been changed
  • argsIds - ids of the function's arguments
  • kwargsIds - ids of the function's keyword arguments
  • resultId - id of the returned value

or error format if there was exception in running algorith:

{
        "status": "fail",
        "exception": "stacktrace"
}
  • status - always "fail"
  • exception - string representation of the exception stack trace

Submodule deep_serialization

JSON serializer and deserializer for python objects

States memory json-format

{
  "objects": {
    "id": {
      "id": "1",
      "strategy": "strategy name",
      "typeinfo": {
        "module": "builtins",
        "kind": "int"
      },
      "comparable": true,
      
      // iff strategy is 'repr'
      "value": "1",

      // iff strategy is 'list' or 'dict'
      "items": ["3", "2"],

      // iff strategy = 'reduce'
      "constructor": "mymod.A.__new__",
      "args": ["mymod.A"],
      "state": {"a": "4", "b": "5"},
      "listitems": ["7", "8"],
      "dictitems": {"ka": "10"}
    }
  }
}

Source

GitHub repository

Metadata

Release files for utbot-executor 1.10.0

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

Source distribution (sdist)

Source distribution for utbot-executor 1.10.0
File Size Uploaded Provenance Actions
utbot_executor-1.10.0.tar.gz 19.3 kB Without provenance Details for utbot_executor-1.10.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for utbot-executor 1.10.0
File Interpreter ABI Platform Actions
utbot_executor-1.10.0-py3-none-any.whl Python 3 none any Details for utbot_executor-1.10.0-py3-none-any.whl

Total release size: 43.6 kB

Release files / utbot_executor-1.10.0.tar.gz

Download URL utbot_executor-1.10.0.tar.gz
Size 19.3 kB
Tags Source
SHA-256 checksum
How to use checksums
9f3015391956d77d64cf822e8c60ef8392e8ecb5bec73dfb25e5989bc31e2e67
BLAKE2b-256 checksum
How to use checksums
dde674effd43a00a123d133057b9a158b60db211ba389bd0167626e806c3b8df
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.3 CPython/3.12.3 Windows/10

Release files / utbot_executor-1.10.0-py3-none-any.whl

Download URL utbot_executor-1.10.0-py3-none-any.whl
Size 24.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0bfd29bc0cc7682395298c93d06527b646c1ea0ea33715773d5677ff3e3d5e59
BLAKE2b-256 checksum
How to use checksums
b714563df0121edf9de98bd1c5d3ab4d4805dfabd707466edab80225455a9826
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.3 CPython/3.12.3 Windows/10

Security for utbot-executor 1.10.0

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.

Release history Release notifications | RSS feed

This release

1.10.0 This release

2 release files No provenance

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