Registry / http-networking / lib
library4.0.0pypypi✓ verified 85d 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.

pip install lib
INSTALL
IMPORT
SIG · LIB
L
lib
http-networkingpythonv4.0.0
Install
1.5s avg
Import
Disk
16MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v4.0.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.920 runs
installs and imports cleanly · install 0.0s · import 0.000s · 17.8MB
glibc
py 3.103.920 runs
installs and imports cleanly · install 1.5s · import 0.000s · 18MB
16MB installed
● package 16MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

lib
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 issues
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.
fix
Review the official release notes and changelog for detailed breaking changes and migration steps when upgrading to version 4.0.0 or higher. Thoroughly test your application after upgrading.
affects: <4.0.0
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.
fix
Always wrap your `lib` calls in `try...except RuntimeError as err:` blocks to gracefully handle potential issues. Consult the Autocode documentation for specific error codes and messages from services.
affects: All
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.
fix
Familiarize yourself with the Autocode ecosystem, including the Autocode CLI for service development and deployment, which can be found on the Autocode GitHub page.
affects: All
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.
fix
It is highly recommended to use `lib` with a supported Python 3.x version (3.6+). If Python 2.x compatibility is critical, pin to an older `lib` version known to work or rigorously test your application against the specific `lib` version.
affects: Python < 3.6
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'lib'
The 'lib' library is not installed or not available in the current Python environment.
fix
Install the library using pip: `pip install lib`
Authentication failed
The provided Autocode API key, access token, or credentials are invalid, expired, or lack the necessary permissions to access the requested service.
fix
Verify your Autocode API key or token, ensure it has the correct scopes/permissions, and that it is correctly passed to the 'lib' client or service call. Regenerate the key if necessary.
AttributeError: '<service_object>' object has no attribute '<method_name>'
You are trying to call a method or access an attribute on an Autocode service object that does not exist, is misspelled, or is not available for the specific deployed service.
fix
Check the Autocode service's documentation or your deployed service's endpoint definitions to ensure the method name is correct and accessible. If using a generated SDK, regenerate it to reflect any changes.
KeyError: '<key_name>'
When processing a response from an Autocode service (often a dictionary or JSON object), you are attempting to access a key that does not exist in the response.
fix
Inspect the structure of the service response to confirm the exact key names. Use `.get()` with a default value or `try-except` blocks to handle potentially missing keys gracefully.
TypeError: '<method_name>'() takes <X> positional arguments but <Y> were given
An incorrect number or type of arguments was passed when calling an Autocode service function through the 'lib' library.
fix
Refer to the Autocode service's API documentation or the generated SDK to ensure you are passing the correct number and types of arguments for the specific method being invoked.
Upgrade
Version history
4.0.0latest on PyPI · released Dec 14, 2021
Audit
Dependencies

No dependency data recorded yet.

Agent activity
11 hits · last 30 days
node
8
Resources
lib — pip install lib · libregistry