Registry / http-networking / lib

lib

JSON →
library4.0.0pypypi✓ verified 35d ago

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.

http-networking
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.

from lib import lib

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}")
Debug
Known footguns
breakingUpgrading from `lib` v3.x to v4.x may introduce breaking changes. While specific migration guides were not found in the immediate search results, major version bumps in semantic versioning typically indicate incompatible API changes.
gotchaAll interactions with Autocode services via `lib` are network calls and can result in `RuntimeError` due to issues like network failures, invalid service paths, or errors within the called Autocode function. It is crucial to implement robust error handling.
gotchaWhile the `lib` Python library itself has zero Python dependencies, its core utility relies on the Autocode platform. To build, deploy, or manage the services you call with `lib`, you will need to use the Autocode CLI and have an Autocode account.
gotchaThe `lib` library documentation mentions support for Python 2.x and 3.x. However, active development and the modern ecosystem typically prioritize Python 3.x. Users on older Python 2.x environments should thoroughly test compatibility, as future updates might implicitly favor Python 3.x practices or drop older support.
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.

Resources