{"categories":[{"label":"Utilities","url":"https://skillfed.io/packages/category/utilities/8"},{"label":"Testing","url":"https://skillfed.io/packages/category/software-development-testing/5"}],"enrichment":{"capability":"Laboratory lets you safely refactor critical code paths by running new and old implementations side-by-side in production, comparing their results, and collecting timing and error data without affecting the live control flow.","skillfed_tags":["refactoring","production-testing","experiment-framework"],"use_cases":["Refactoring authorization or permission-checking logic in production while verifying the new code matches the old behavior.","Gradually migrating from one database query strategy to another by running both and comparing results before switching fully.","Testing a rewritten algorithm on real production data and load to catch edge cases that unit tests miss.","Validating a new authentication method against the existing one without risking user lockouts.","Ramping up a candidate implementation for only a subset of users or requests to limit blast radius if issues arise."],"what_it_does":"Laboratory is a Python framework for running controlled experiments on refactored code in production. You define a control block (your existing, known-good code) and a candidate block (your new implementation), and Laboratory executes both in randomized order, compares their return values, records timing, catches exceptions in the candidate, and publishes results\u2014while always returning the control value to the caller. This lets you gain confidence that a refactor is correct before fully committing to it, even in complex production environments with legacy data and high load.\n\nThe package is designed for critical code paths where correctness matters more than speed. You can ramp experiments up gradually by overriding the `enabled` method, customize comparison logic, add context for debugging, and implement your own `publish` method to send metrics and mismatches to monitoring systems. The main caveat is that code with side effects (database writes, state changes) is unsuitable because both branches will execute, potentially causing duplicate writes.","worth_installing":"Yes, if you own critical code paths and want a structured way to validate refactors in production. The zero-dependency design and MIT license make it low-risk to add. However, the aging maintenance status (last release 2019) means you should verify it works with your target Python version and be prepared to maintain a fork if needed. Not suitable for code with side effects."},"id":"laboratory","links":{"html":"https://skillfed.io/packages/laboratory","md":"https://skillfed.io/packages/laboratory.md","pypi":"https://pypi.org/project/laboratory/"},"maintenance":{"status":"aging"},"meta":{"latest_release":"2019-05-05","license_spdx":null,"license_treatment":"permissive","name":"laboratory","python_support":"unspecified","summary":"Sure-footed refactoring achieved through experimenting"},"popularity":{"monthly_downloads":174049,"position":10293,"tier":"top_15000"},"security":{"n_vulnerabilities":0},"version":"1.0.2"}
