{"id":18712087,"url":"https://github.com/gphat/experiment-python","last_synced_at":"2025-04-12T12:31:21.253Z","repository":{"id":21769570,"uuid":"25091801","full_name":"gphat/experiment-python","owner":"gphat","description":"Python experiments inspired by GitHub's dat-science","archived":false,"fork":false,"pushed_at":"2014-10-20T01:44:56.000Z","size":136,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-11-07T12:52:18.578Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/gphat.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-10-11T19:14:37.000Z","updated_at":"2014-10-21T21:22:51.000Z","dependencies_parsed_at":"2022-08-17T20:35:23.759Z","dependency_job_id":null,"html_url":"https://github.com/gphat/experiment-python","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gphat%2Fexperiment-python","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gphat%2Fexperiment-python/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gphat%2Fexperiment-python/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gphat%2Fexperiment-python/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gphat","download_url":"https://codeload.github.com/gphat/experiment-python/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248566489,"owners_count":21125676,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-07T12:40:49.031Z","updated_at":"2025-04-12T12:31:20.125Z","avatar_url":"https://github.com/gphat.png","language":"Python","funding_links":[],"categories":["Python"],"sub_categories":[],"readme":"Experiment is a Python module inspired by GitHub's [dat-science](https://github.com/github/dat-science).\n\nIt uses a Python's [futures](https://pypi.python.org/pypi/futures).\n\n# Overview\n\nExperiment takes two Futures and executes both using a ThreadPoolExecutor. The\n`Experiment` object itself is a future that will be completed when the control\nfinishes. The `result` of this Future is the output of the control Future! This\nway you get your results as quickly as the control finishes.\n\nYou can also call `get_future` on the `Experiment` to get a Future that covers\nthe completion of the the control *and* the experiment!\n\n# Usage\n\n```python\nfrom experiment import Experiment\n\ndef old_func():\n  # Do things the old way\n\ndef new_func():\n  # Do things the new way\n\n# Conduct an experiment where control is your old\n# code path and experiment is the new!\nexp = Experiment(\n    control = old_func,\n    experiment = new_func\n)\n\n# The returned experiment is a Future. You can get the result,\n# which will be the result of the control!\n\n# Send this back!\ncontrol = exp.result()\n\n# You can also get a future that covers *both* the control and\n# the experiment to verify that they match.\n\ntotal_result = exp.get_future().result()\nif(total_result.matches()):\n  print \"Yay!\"\nelse:\n  # Here's the control's result (it's a Future!)\n  print total_result.get_control_result().result()\n  # And the experiment, also a Future!\n  print total_result.get_experiment_result().result()\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgphat%2Fexperiment-python","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgphat%2Fexperiment-python","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgphat%2Fexperiment-python/lists"}