Skip to main content

logicfp user-mode protection library

Project description

Logic Fingerprint (logicfp)

logicfp is an AI-era call protection layer.

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 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 public 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

logicfp now recommends user mode as the only public entry model.

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.4.10.tar.gz (40.5 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.4.10-py3-none-any.whl (59.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: logicfp-3.4.10.tar.gz
  • Upload date:
  • Size: 40.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for logicfp-3.4.10.tar.gz
Algorithm Hash digest
SHA256 faab5a9c9e852427aefd2fab3e4deb374e4be4ca681409fc5cb0b7bff3331c13
MD5 45b04e93b126a912b668ee53491f1a95
BLAKE2b-256 eae3e6480b1e407c7e490996e07b2b39135153480bac46995c2a5fcd85842989

See more details on using hashes here.

Provenance

The following attestation bundles were made for logicfp-3.4.10.tar.gz:

Publisher: publish.yml on dymzz/logic_fingerprint

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

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

File metadata

  • Download URL: logicfp-3.4.10-py3-none-any.whl
  • Upload date:
  • Size: 59.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for logicfp-3.4.10-py3-none-any.whl
Algorithm Hash digest
SHA256 de51bf8c5f48ae0b9f1389a1bd63fd7dea9ef5f34228d86374f289e76a987d61
MD5 8de570e0c4c2775af6da6d8fd8a4f808
BLAKE2b-256 438792dbed4de5d5a6b601af8e7708c1dd64da1afe1ff7b88671e787b5571642

See more details on using hashes here.

Provenance

The following attestation bundles were made for logicfp-3.4.10-py3-none-any.whl:

Publisher: publish.yml on dymzz/logic_fingerprint

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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