The `lib` library provides basic Python bindings for interacting with the Autocode standard library, enabling users to call functions from deployed Autocode services. It serves as a zero-dependency interface to execute StdLib functions and automatically generates Python SDKs for services deployed to Autocode. The current version is 4.0.0, and the project is actively maintained.
Install & Compatibility
Where this runs
No compatibility data collected yet for this library.
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to import the `lib` object and make a call to an Autocode service. Service calls are dynamically accessed via `lib.<username>.<service_name>.<function_name>` or `lib.<username>.<service_name>` for default functions. It also shows basic error handling.
from lib import lib
import os
# Replace 'yourUsername' and 'yourService' with actual Autocode service details
# and ensure the function 'myFunction' exists on that service.
# The 'key' and 'value' parameters are example arguments for the function.
# In a real scenario, you might interact with environment variables for API keys or service names.
# For example, if your service requires an API key, you might pass it as an argument:
# result = lib.yourUsername.yourService.myFunction(api_key=os.environ.get('AUTOCODE_API_KEY', ''))
try:
# Example: Call a function from a user's service
# This assumes 'yourUsername' has a service named 'yourService' with a default function
# that accepts a 'key' parameter.
result = lib.yourUsername.yourService(key='example_value')
print(f"Service call successful: {result}")
# Example: Call a specific function within a service, specifying environment
# result_dev = lib.yourUsername.yourService.myFunction['@dev'](another_key='test')
# print(f"Dev service call successful: {result_dev}")
except RuntimeError as err:
print(f"Error calling Autocode service: {err}")
except Exception as e:
print(f"An unexpected error occurred: {e}")
Upgrade
Version history
Breaking-change detection hasn't run for this library yet.
Audit
Security & dependencies
CVE tracking and dependency tree are planned for a later release.
Agent activity
0 hits · last 30 days
No traffic data recorded yet.