Skip to main content

logicfp protection runtime and HTTP service

Project description

Logic Fingerprint (logicfp)

logicfp is a Python protection library for wrapping function boundaries with lightweight circuit-breaker style control.

Developer documentation lives in README.developer.md.

Install

pip install logicfp

Quick Start

from logicfp import protect


@protect()
def call_model(request):
    return {"answer": request.payload["text"].upper()}


result = call_model(payload={"text": "hello"})

Use @protect() when you want the default user-mode entrypoint.
Use create_protector() when you need more than one protector instance.
Use logicfp.user_mode when you want explicit user-mode types like ErrorCode, NormalizationError, LogicExecutionError, and ProtectRuntimeError.

User Mode Contract

The current user-mode contract centers on:

  • protect
  • create_protector
  • logicfp.user_mode.ErrorCode
  • logicfp.user_mode.NormalizationError
  • logicfp.user_mode.LogicExecutionError
  • logicfp.user_mode.ProtectRuntimeError
  • logicfp.config.describe_effective_config

If you do not have a clear service-hosting need, stay in user mode.

Minimal Config

Put your project config at:

your_project/config/config.yaml
logicfp:
  instance_id: decorator-node
  default_source: user_function
  backend_type: memory

Use logicfp: as the main YAML section name. Older logic_fingerprint: configs are still accepted for compatibility.
For user mode, backend_type: memory is still the recommended default.

Failure Styles

logicfp supports two user-mode failure styles:

  • simple=True success returns your result directly, failure raises ProtectRuntimeError
  • simple=False success returns ok/result/context, failure returns ok/error/context

Example:

from logicfp import protect


@protect(simple=False)
def review_text(request):
    return {"summary": request.payload["text"][:20]}

Learn More

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

logicfp-3.0.0.tar.gz (23.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

logicfp-3.0.0-py3-none-any.whl (34.7 kB view details)

Uploaded Python 3

File details

Details for the file logicfp-3.0.0.tar.gz.

File metadata

  • Download URL: logicfp-3.0.0.tar.gz
  • Upload date:
  • Size: 23.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for logicfp-3.0.0.tar.gz
Algorithm Hash digest
SHA256 0c426871796a801ae8f917599784968d7058cf0841644c84195277af36789602
MD5 db8b96a7d0810c7c855ce992a5f22146
BLAKE2b-256 2b40e91e60f5aec0ff3dd7551d758975902dad126c10aab01cfbd44d25c3a38a

See more details on using hashes here.

File details

Details for the file logicfp-3.0.0-py3-none-any.whl.

File metadata

  • Download URL: logicfp-3.0.0-py3-none-any.whl
  • Upload date:
  • Size: 34.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for logicfp-3.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 fd8c1712ffbe3b68ef9d78e64667121ea8d5b703dca0ee4ed4616c6f8d7f1931
MD5 68b3c2bd78bc8be5bf061fd588e1b4dd
BLAKE2b-256 f608f14ebe9b73bb3a5b8330e604dc6c7a3a7094a4a0e28560aec0c13901a446

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page