Skip to main content

bilocate 🪞

Transparent shadow testing for legacy refactors.

Refactoring critical, legacy "spaghetti" code is terrifying. Standard shadow testing requires standing up API gateways, duplicating traffic via Kafka, or importing heavy JSON-diffing engines just to run V2 alongside V1. bilocate solves this at the Python function boundary.

You write your new logic, wrap the old function, and let the runtime natively background and compare the execution.

uv add bilocate

The Difference

Concept Standard Shadow Testing bilocate
Infrastructure API Gateways, message duplication queues None. Pure Python decorators.
Diffing Engine Complex JSON serialization / DeepDiff Native __eq__ evaluation.
Latency Impact Network hop duplication Zero. Async naturally backgrounds.
Telemetry & Alerts Custom SDKs (Datadog/Sentry) Standard library warnings module.

Usage

You need exactly one primitive: @mimic.

import bilocate
import warnings

# Your shiny, untested V2 logic
def clean_v2_logic(payload):
    return new_pydantic_math(payload)

# 1. Wrap the legacy function.
# The system transparently routes the inputs to V2 in the background.
@bilocate.mimic(clean_v2_logic)
def spaghetti_v1_logic(payload):
    return legacy_dict_math(payload)


# 2. Call the function normally.
# The user gets the V1 response instantly.
result = spaghetti_v1_logic({"user_id": 123})

# CHECKPOINT:
# If clean_v2_logic returns a different value, or if V2 crashes while V1 succeeds,
# bilocate emits a native RuntimeWarning. The user's execution is completely unaffected.

Core Mechanics

  • Native Telemetry: bilocate requires absolutely zero configuration. It doesn't ask for a logger or a statsd client. When a mismatch occurs, it emits a standard RuntimeWarning. You can route this to Sentry, Datadog, or your console natively using Python's built-in logging.captureWarnings(True).
  • Flawless Error Diffing: bilocate treats exceptions as values. If V1 returns None but V2 raises a KeyError, bilocate cleanly intercepts the crash, compares the terminal states, and reports the discrepancy without blowing up the user's stack.
  • Native Async Backgrounding: If your functions are async, bilocate automatically wraps V2 in a fire-and-forget asyncio.create_task(). V1 returns instantly, and V2 processes seamlessly in the background event loop with zero added latency.
  • Zero-Dependency Comparisons: No heavy JSON serializers or deep-diffing libraries. bilocate delegates diffing purely to Python's native __eq__ contract. If you need to compare a legacy dict to a V2 object, just define __eq__ on your object.

Release files for bilocate 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for bilocate 0.1.0
File Size Uploaded
bilocate-0.1.0.tar.gz 2.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for bilocate 0.1.0
File Interpreter ABI Platform
bilocate-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 6.6 kB

Release files / bilocate-0.1.0.tar.gz

Download URL bilocate-0.1.0.tar.gz
Size 2.9 kB
Tags Source
SHA-256 checksum
How to use checksums
a798faa777f0f4d59e8cd55ca8f2741eb8b5cdf36c68ecb890c38fa2405cd6a8
BLAKE2b-256 checksum
How to use checksums
012b8de94bc952a72a09fc9f6632ca0418b815950c348c8bc9e058686270c09b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.3 {"installer":{"name":"uv","version":"0.11.3","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"CachyOS Linux","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / bilocate-0.1.0-py3-none-any.whl

Download URL bilocate-0.1.0-py3-none-any.whl
Size 3.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d384f935b4ec3aa77c54c2b41e08638efb01b1b85f38742a4638cce83387a1bb
BLAKE2b-256 checksum
How to use checksums
fdb86c7bfa1a37d6c61a9ad51691d374443234efcb04dc60bea2db52784acbad
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.3 {"installer":{"name":"uv","version":"0.11.3","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"CachyOS Linux","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page