# Capsula
[![PyPI](https://img.shields.io/pypi/v/capsula)](https://pypi.org/project/capsula/)
[![conda-forge](https://img.shields.io/conda/vn/conda-forge/capsula.svg)](https://anaconda.org/conda-forge/capsula)
![PyPI - License](https://img.shields.io/pypi/l/capsula)
![PyPI - Python Version](https://img.shields.io/pypi/pyversions/capsula)
![Test Status](https://github.com/shunichironomura/capsula/workflows/Test/badge.svg?event=push&branch=main)
[![codecov](https://codecov.io/gh/shunichironomura/capsula/graph/badge.svg?token=BZXF2PPDM0)](https://codecov.io/gh/shunichironomura/capsula)
[![Poetry](https://img.shields.io/endpoint?url=https://python-poetry.org/badge/v0.json)](https://python-poetry.org/)
[![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)
![PyPI - Downloads](https://img.shields.io/pypi/dm/capsula)
*Capsula*, a Latin word meaning *box*, is a Python package designed to help researchers and developers easily capture their command/function execution context for reproducibility.
See the [documentation](https://shunichironomura.github.io/capsula/) for more information.
With Capsula, you can capture:
- CPU information with [`CpuContext`](docs/contexts/cpu.md)
- Python version with [`PlatformContext`](docs/contexts/platform.md)
- Current working directory with [`CwdContext`](docs/contexts/cwd.md)
- Git repository information (commit hash, branch, etc.) with [`GitRepositoryContext`](docs/contexts/git.md)
- Output of shell commands (e.g., `poetry check --lock`) with [`CommandContext`](docs/contexts/command.md)
- Files (e.g., output files, `pyproject.toml`, `requirements.txt`) with [`FileContext`](docs/contexts/file.md)
- Arguments of Python functions with [`FunctionContext`](docs/contexts/function.md)
- Environment variables with [`EnvVarContext`](docs/contexts/envvar.md)
- Uncaught exceptions with [`UncaughtExceptionWatcher`](docs/watchers/uncaught_exception.md)
- Execution time with [`TimeWatcher`](docs/watchers/time.md)
The captured contexts are dumped into JSON files for future reference and reproduction.
## Usage example
For project-wide settings, prepare a `capsula.toml` file in the root directory of your project. An example of the `capsula.toml` file is as follows:
```toml
[pre-run]
contexts = [
{ type = "CwdContext" },
{ type = "CpuContext" },
{ type = "PlatformContext" },
{ type = "GitRepositoryContext", name = "capsula", path = ".", path_relative_to_project_root = true },
{ type = "CommandContext", command = "poetry check --lock", cwd = ".", cwd_relative_to_project_root = true },
{ type = "FileContext", path = "pyproject.toml", copy = true, path_relative_to_project_root = true },
{ type = "FileContext", path = "poetry.lock", copy = true, path_relative_to_project_root = true },
{ type = "CommandContext", command = "pip freeze --exclude-editable > requirements.txt", cwd = ".", cwd_relative_to_project_root = true },
{ type = "FileContext", path = "requirements.txt", move = true, path_relative_to_project_root = true },
{ type = "EnvVarContext", name = "HOME" },
]
reporters = [{ type = "JsonDumpReporter" }]
[in-run]
watchers = [{ type = "UncaughtExceptionWatcher" }, { type = "TimeWatcher" }]
reporters = [{ type = "JsonDumpReporter" }]
[post-run]
reporters = [{ type = "JsonDumpReporter" }]
```
Then, all you need to do is decorate your Python function with the `@capsula.run()` decorator. You can also use the `@capsula.context()` decorator to add a context specific to the function.
The following is an example of a Python script that estimates the value of π using the Monte Carlo method:
```python
import random
import capsula
@capsula.run()
@capsula.context(capsula.FunctionContext.builder(), mode="pre")
@capsula.context(capsula.FileContext.builder("pi.txt", move=True), mode="post")
def calculate_pi(n_samples: int = 1_000, seed: int = 42) -> None:
random.seed(seed)
xs = (random.random() for _ in range(n_samples))
ys = (random.random() for _ in range(n_samples))
inside = sum(x * x + y * y <= 1.0 for x, y in zip(xs, ys))
# You can record values to the capsule using the `record` method.
capsula.record("inside", inside)
pi_estimate = (4.0 * inside) / n_samples
print(f"Pi estimate: {pi_estimate}")
capsula.record("pi_estimate", pi_estimate)
print(f"Run name: {capsula.current_run_name()}")
with open("pi.txt", "w") as output_file:
output_file.write(f"Pi estimate: {pi_estimate}.")
if __name__ == "__main__":
calculate_pi(n_samples=1_000)
```
After running the script, a directory (`calculate_pi_20240711_190108_6I2M` in this example) will be created under the `<project-root>/vault` directory, and you will find the output files in the directory:
```bash
$ tree vault/calculate_pi_20240711_190108_6I2M
vault/calculate_pi_20240711_190108_6I2M
├── in-run-report.json # Generated by the `JsonDumpReporter` in `capsula.toml` (`in-run` section)
├── pi.txt # Moved by the `FileContext` specified with the decorator in the script
├── poetry.lock # Copied by the `FileContext` specified in `capsula.toml` (`pre-run` section)
├── post-run-report.json # Generated by the `JsonDumpReporter` in `capsula.toml` (`post-run` section)
├── pre-run-report.json # Generated by the `JsonDumpReporter` in `capsula.toml` (`pre-run` section)
├── pyproject.toml # Copied by the `FileContext` specified in `capsula.toml` (`pre-run` section)
└── requirements.txt # Moved by the `FileContext` specified in `capsula.toml` (`pre-run` section)
```
The contents of the JSON files are as follows:
<details>
<summary>Example of output <code>pre-run-report.json</code>:</summary>
<pre><code>{
"cwd": "/home/nomura/ghq/github.com/shunichironomura/capsula",
"cpu": {
"python_version": "3.8.19.final.0 (64 bit)",
"cpuinfo_version": [
9,
0,
0
],
"cpuinfo_version_string": "9.0.0",
"arch": "X86_64",
"bits": 64,
"count": 12,
"arch_string_raw": "x86_64",
"vendor_id_raw": "GenuineIntel",
"brand_raw": "Intel(R) Core(TM) i5-10400 CPU @ 2.90GHz",
"hz_advertised_friendly": "2.9000 GHz",
"hz_actual_friendly": "2.9040 GHz",
"hz_advertised": [
2900000000,
0
],
"hz_actual": [
2904008000,
0
],
"stepping": 5,
"model": 165,
"family": 6,
"flags": [
"3dnowprefetch",
"abm",
"adx",
"aes",
"apic",
"arch_capabilities",
"arch_perfmon",
"avx",
"avx2",
"bmi1",
"bmi2",
"clflush",
"clflushopt",
"cmov",
"constant_tsc",
"cpuid",
"cx16",
"cx8",
"de",
"ept",
"ept_ad",
"erms",
"f16c",
"flush_l1d",
"fma",
"fpu",
"fsgsbase",
"fxsr",
"ht",
"hypervisor",
"ibpb",
"ibrs",
"ibrs_enhanced",
"invpcid",
"invpcid_single",
"lahf_lm",
"lm",
"mca",
"mce",
"md_clear",
"mmx",
"movbe",
"msr",
"mtrr",
"nopl",
"nx",
"osxsave",
"pae",
"pat",
"pcid",
"pclmulqdq",
"pdcm",
"pdpe1gb",
"pge",
"pni",
"popcnt",
"pse",
"pse36",
"rdrand",
"rdrnd",
"rdseed",
"rdtscp",
"rep_good",
"sep",
"smap",
"smep",
"ss",
"ssbd",
"sse",
"sse2",
"sse4_1",
"sse4_2",
"ssse3",
"stibp",
"syscall",
"tpr_shadow",
"tsc",
"vme",
"vmx",
"vnmi",
"vpid",
"x2apic",
"xgetbv1",
"xsave",
"xsavec",
"xsaveopt",
"xsaves",
"xtopology"
],
"l3_cache_size": 12582912,
"l2_cache_size": "1.5 MiB",
"l1_data_cache_size": 196608,
"l1_instruction_cache_size": 196608,
"l2_cache_line_size": 256,
"l2_cache_associativity": 6
},
"platform": {
"machine": "x86_64",
"node": "SHUN-DESKTOP",
"platform": "Linux-5.15.153.1-microsoft-standard-WSL2-x86_64-with-glibc2.34",
"release": "5.15.153.1-microsoft-standard-WSL2",
"version": "#1 SMP Fri Mar 29 23:14:13 UTC 2024",
"system": "Linux",
"processor": "x86_64",
"python": {
"executable_architecture": {
"bits": "64bit",
"linkage": "ELF"
},
"build_no": "default",
"build_date": "Jul 7 2024 07:23:53",
"compiler": "GCC 11.4.0",
"branch": "",
"implementation": "CPython",
"version": "3.8.19"
}
},
"git": {
"capsula": {
"working_dir": "/home/nomura/ghq/github.com/shunichironomura/capsula",
"sha": "a308c82bf9c8670de62d155e83ebf78f816f7851",
"remotes": {
"origin": "ssh://git@github.com/shunichironomura/capsula.git"
},
"branch": "main",
"is_dirty": false,
"diff_file": null
}
},
"command": {
"poetry check --lock": {
"command": "poetry check --lock",
"cwd": "/home/nomura/ghq/github.com/shunichironomura/capsula",
"returncode": 0,
"stdout": "All set!\n",
"stderr": ""
},
"pip freeze --exclude-editable > requirements.txt": {
"command": "pip freeze --exclude-editable > requirements.txt",
"cwd": "/home/nomura/ghq/github.com/shunichironomura/capsula",
"returncode": 0,
"stdout": "",
"stderr": ""
}
},
"file": {
"/home/nomura/ghq/github.com/shunichironomura/capsula/pyproject.toml": {
"copied_to": [
"/home/nomura/ghq/github.com/shunichironomura/capsula/vault/calculate_pi_20240711_190108_6I2M/pyproject.toml"
],
"moved_to": null,
"hash": {
"algorithm": "sha256",
"digest": "bfd58ba4947798d61ae3679cf3b06def700aefcdc33a2e4935164f480f16191c"
}
},
"/home/nomura/ghq/github.com/shunichironomura/capsula/poetry.lock": {
"copied_to": [
"/home/nomura/ghq/github.com/shunichironomura/capsula/vault/calculate_pi_20240711_190108_6I2M/poetry.lock"
],
"moved_to": null,
"hash": {
"algorithm": "sha256",
"digest": "210e74a7cd2db48b95dee0def67d5bbba33a86ab85859bea6c17ca74b48a2448"
}
},
"/home/nomura/ghq/github.com/shunichironomura/capsula/requirements.txt": {
"copied_to": [],
"moved_to": "/home/nomura/ghq/github.com/shunichironomura/capsula/vault/calculate_pi_20240711_190108_6I2M",
"hash": {
"algorithm": "sha256",
"digest": "7d8d12ce44cae648c0f7cc7a636e226c857510276cd3a221de1ffa4d7125c5b0"
}
}
},
"env": {
"HOME": "/home/nomura"
},
"function": {
"calculate_pi": {
"file_path": "examples/simple_decorator.py",
"first_line_no": 6,
"bound_args": {
"n_samples": 1000,
"seed": 42
}
}
}
}</code></pre>
</details>
<details>
<summary>Example of output <code>in-run-report.json</code>:</summary>
<pre><code>{
"inside": 782,
"pi_estimate": 3.128,
"time": {
"execution_time": "0:00:00.000612"
},
"exception": {
"exception": {
"exc_type": null,
"exc_value": null,
"traceback": null
}
}
}</code></pre>
</details>
<details>
<summary>Example of output <code>post-run-report.json</code>:</summary>
<pre><code>{
"file": {
"pi.txt": {
"copied_to": [],
"moved_to": "/home/nomura/ghq/github.com/shunichironomura/capsula/vault/calculate_pi_20240711_190108_6I2M",
"hash": {
"algorithm": "sha256",
"digest": "a64c761cb6b6f9ef1bc1f6afa6ba44d796c5c51d14df0bdc9d3ab9ced7982a74"
}
}
}
}</code></pre>
</details>
## Installation
You can install Capsula via pip:
```bash
pip install capsula
```
Or via conda:
```bash
conda install conda-forge::capsula
```
## Licensing
This project is licensed under the terms of the MIT.
Additionally, this project includes code derived from the Python programming language, which is licensed under the Python Software Foundation License Version 2 (PSF-2.0). For details, see the LICENSE file.
Raw data
{
"_id": null,
"home_page": "https://github.com/shunichironomura/capsula",
"name": "capsula",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": null,
"keywords": "reproducibility, cli",
"author": "Shunichiro Nomura",
"author_email": "nomura@space.t.u-tokyo.ac.jp",
"download_url": "https://files.pythonhosted.org/packages/8b/4c/c8025cc4796b5794dc0ef88838c4b019d1291168e009f3f4ef54751e0c07/capsula-0.5.1.tar.gz",
"platform": null,
"description": "# Capsula\n\n[![PyPI](https://img.shields.io/pypi/v/capsula)](https://pypi.org/project/capsula/)\n[![conda-forge](https://img.shields.io/conda/vn/conda-forge/capsula.svg)](https://anaconda.org/conda-forge/capsula)\n![PyPI - License](https://img.shields.io/pypi/l/capsula)\n![PyPI - Python Version](https://img.shields.io/pypi/pyversions/capsula)\n![Test Status](https://github.com/shunichironomura/capsula/workflows/Test/badge.svg?event=push&branch=main)\n[![codecov](https://codecov.io/gh/shunichironomura/capsula/graph/badge.svg?token=BZXF2PPDM0)](https://codecov.io/gh/shunichironomura/capsula)\n[![Poetry](https://img.shields.io/endpoint?url=https://python-poetry.org/badge/v0.json)](https://python-poetry.org/)\n[![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)\n![PyPI - Downloads](https://img.shields.io/pypi/dm/capsula)\n\n*Capsula*, a Latin word meaning *box*, is a Python package designed to help researchers and developers easily capture their command/function execution context for reproducibility.\nSee the [documentation](https://shunichironomura.github.io/capsula/) for more information.\n\nWith Capsula, you can capture:\n\n- CPU information with [`CpuContext`](docs/contexts/cpu.md)\n- Python version with [`PlatformContext`](docs/contexts/platform.md)\n- Current working directory with [`CwdContext`](docs/contexts/cwd.md)\n- Git repository information (commit hash, branch, etc.) with [`GitRepositoryContext`](docs/contexts/git.md)\n- Output of shell commands (e.g., `poetry check --lock`) with [`CommandContext`](docs/contexts/command.md)\n- Files (e.g., output files, `pyproject.toml`, `requirements.txt`) with [`FileContext`](docs/contexts/file.md)\n- Arguments of Python functions with [`FunctionContext`](docs/contexts/function.md)\n- Environment variables with [`EnvVarContext`](docs/contexts/envvar.md)\n- Uncaught exceptions with [`UncaughtExceptionWatcher`](docs/watchers/uncaught_exception.md)\n- Execution time with [`TimeWatcher`](docs/watchers/time.md)\n\nThe captured contexts are dumped into JSON files for future reference and reproduction.\n\n## Usage example\n\nFor project-wide settings, prepare a `capsula.toml` file in the root directory of your project. An example of the `capsula.toml` file is as follows:\n\n```toml\n[pre-run]\ncontexts = [\n { type = \"CwdContext\" },\n { type = \"CpuContext\" },\n { type = \"PlatformContext\" },\n { type = \"GitRepositoryContext\", name = \"capsula\", path = \".\", path_relative_to_project_root = true },\n { type = \"CommandContext\", command = \"poetry check --lock\", cwd = \".\", cwd_relative_to_project_root = true },\n { type = \"FileContext\", path = \"pyproject.toml\", copy = true, path_relative_to_project_root = true },\n { type = \"FileContext\", path = \"poetry.lock\", copy = true, path_relative_to_project_root = true },\n { type = \"CommandContext\", command = \"pip freeze --exclude-editable > requirements.txt\", cwd = \".\", cwd_relative_to_project_root = true },\n { type = \"FileContext\", path = \"requirements.txt\", move = true, path_relative_to_project_root = true },\n { type = \"EnvVarContext\", name = \"HOME\" },\n]\nreporters = [{ type = \"JsonDumpReporter\" }]\n\n[in-run]\nwatchers = [{ type = \"UncaughtExceptionWatcher\" }, { type = \"TimeWatcher\" }]\nreporters = [{ type = \"JsonDumpReporter\" }]\n\n[post-run]\nreporters = [{ type = \"JsonDumpReporter\" }]\n```\n\nThen, all you need to do is decorate your Python function with the `@capsula.run()` decorator. You can also use the `@capsula.context()` decorator to add a context specific to the function.\n\nThe following is an example of a Python script that estimates the value of \u03c0 using the Monte Carlo method:\n\n```python\nimport random\nimport capsula\n\n@capsula.run()\n@capsula.context(capsula.FunctionContext.builder(), mode=\"pre\")\n@capsula.context(capsula.FileContext.builder(\"pi.txt\", move=True), mode=\"post\")\ndef calculate_pi(n_samples: int = 1_000, seed: int = 42) -> None:\n random.seed(seed)\n xs = (random.random() for _ in range(n_samples))\n ys = (random.random() for _ in range(n_samples))\n inside = sum(x * x + y * y <= 1.0 for x, y in zip(xs, ys))\n\n # You can record values to the capsule using the `record` method.\n capsula.record(\"inside\", inside)\n\n pi_estimate = (4.0 * inside) / n_samples\n print(f\"Pi estimate: {pi_estimate}\")\n capsula.record(\"pi_estimate\", pi_estimate)\n print(f\"Run name: {capsula.current_run_name()}\")\n\n with open(\"pi.txt\", \"w\") as output_file:\n output_file.write(f\"Pi estimate: {pi_estimate}.\")\n\nif __name__ == \"__main__\":\n calculate_pi(n_samples=1_000)\n```\n\nAfter running the script, a directory (`calculate_pi_20240711_190108_6I2M` in this example) will be created under the `<project-root>/vault` directory, and you will find the output files in the directory:\n\n```bash\n$ tree vault/calculate_pi_20240711_190108_6I2M\nvault/calculate_pi_20240711_190108_6I2M\n\u251c\u2500\u2500 in-run-report.json # Generated by the `JsonDumpReporter` in `capsula.toml` (`in-run` section)\n\u251c\u2500\u2500 pi.txt # Moved by the `FileContext` specified with the decorator in the script\n\u251c\u2500\u2500 poetry.lock # Copied by the `FileContext` specified in `capsula.toml` (`pre-run` section)\n\u251c\u2500\u2500 post-run-report.json # Generated by the `JsonDumpReporter` in `capsula.toml` (`post-run` section)\n\u251c\u2500\u2500 pre-run-report.json # Generated by the `JsonDumpReporter` in `capsula.toml` (`pre-run` section)\n\u251c\u2500\u2500 pyproject.toml # Copied by the `FileContext` specified in `capsula.toml` (`pre-run` section)\n\u2514\u2500\u2500 requirements.txt # Moved by the `FileContext` specified in `capsula.toml` (`pre-run` section)\n```\n\nThe contents of the JSON files are as follows:\n\n<details>\n<summary>Example of output <code>pre-run-report.json</code>:</summary>\n<pre><code>{\n \"cwd\": \"/home/nomura/ghq/github.com/shunichironomura/capsula\",\n \"cpu\": {\n \"python_version\": \"3.8.19.final.0 (64 bit)\",\n \"cpuinfo_version\": [\n 9,\n 0,\n 0\n ],\n \"cpuinfo_version_string\": \"9.0.0\",\n \"arch\": \"X86_64\",\n \"bits\": 64,\n \"count\": 12,\n \"arch_string_raw\": \"x86_64\",\n \"vendor_id_raw\": \"GenuineIntel\",\n \"brand_raw\": \"Intel(R) Core(TM) i5-10400 CPU @ 2.90GHz\",\n \"hz_advertised_friendly\": \"2.9000 GHz\",\n \"hz_actual_friendly\": \"2.9040 GHz\",\n \"hz_advertised\": [\n 2900000000,\n 0\n ],\n \"hz_actual\": [\n 2904008000,\n 0\n ],\n \"stepping\": 5,\n \"model\": 165,\n \"family\": 6,\n \"flags\": [\n \"3dnowprefetch\",\n \"abm\",\n \"adx\",\n \"aes\",\n \"apic\",\n \"arch_capabilities\",\n \"arch_perfmon\",\n \"avx\",\n \"avx2\",\n \"bmi1\",\n \"bmi2\",\n \"clflush\",\n \"clflushopt\",\n \"cmov\",\n \"constant_tsc\",\n \"cpuid\",\n \"cx16\",\n \"cx8\",\n \"de\",\n \"ept\",\n \"ept_ad\",\n \"erms\",\n \"f16c\",\n \"flush_l1d\",\n \"fma\",\n \"fpu\",\n \"fsgsbase\",\n \"fxsr\",\n \"ht\",\n \"hypervisor\",\n \"ibpb\",\n \"ibrs\",\n \"ibrs_enhanced\",\n \"invpcid\",\n \"invpcid_single\",\n \"lahf_lm\",\n \"lm\",\n \"mca\",\n \"mce\",\n \"md_clear\",\n \"mmx\",\n \"movbe\",\n \"msr\",\n \"mtrr\",\n \"nopl\",\n \"nx\",\n \"osxsave\",\n \"pae\",\n \"pat\",\n \"pcid\",\n \"pclmulqdq\",\n \"pdcm\",\n \"pdpe1gb\",\n \"pge\",\n \"pni\",\n \"popcnt\",\n \"pse\",\n \"pse36\",\n \"rdrand\",\n \"rdrnd\",\n \"rdseed\",\n \"rdtscp\",\n \"rep_good\",\n \"sep\",\n \"smap\",\n \"smep\",\n \"ss\",\n \"ssbd\",\n \"sse\",\n \"sse2\",\n \"sse4_1\",\n \"sse4_2\",\n \"ssse3\",\n \"stibp\",\n \"syscall\",\n \"tpr_shadow\",\n \"tsc\",\n \"vme\",\n \"vmx\",\n \"vnmi\",\n \"vpid\",\n \"x2apic\",\n \"xgetbv1\",\n \"xsave\",\n \"xsavec\",\n \"xsaveopt\",\n \"xsaves\",\n \"xtopology\"\n ],\n \"l3_cache_size\": 12582912,\n \"l2_cache_size\": \"1.5 MiB\",\n \"l1_data_cache_size\": 196608,\n \"l1_instruction_cache_size\": 196608,\n \"l2_cache_line_size\": 256,\n \"l2_cache_associativity\": 6\n },\n \"platform\": {\n \"machine\": \"x86_64\",\n \"node\": \"SHUN-DESKTOP\",\n \"platform\": \"Linux-5.15.153.1-microsoft-standard-WSL2-x86_64-with-glibc2.34\",\n \"release\": \"5.15.153.1-microsoft-standard-WSL2\",\n \"version\": \"#1 SMP Fri Mar 29 23:14:13 UTC 2024\",\n \"system\": \"Linux\",\n \"processor\": \"x86_64\",\n \"python\": {\n \"executable_architecture\": {\n \"bits\": \"64bit\",\n \"linkage\": \"ELF\"\n },\n \"build_no\": \"default\",\n \"build_date\": \"Jul 7 2024 07:23:53\",\n \"compiler\": \"GCC 11.4.0\",\n \"branch\": \"\",\n \"implementation\": \"CPython\",\n \"version\": \"3.8.19\"\n }\n },\n \"git\": {\n \"capsula\": {\n \"working_dir\": \"/home/nomura/ghq/github.com/shunichironomura/capsula\",\n \"sha\": \"a308c82bf9c8670de62d155e83ebf78f816f7851\",\n \"remotes\": {\n \"origin\": \"ssh://git@github.com/shunichironomura/capsula.git\"\n },\n \"branch\": \"main\",\n \"is_dirty\": false,\n \"diff_file\": null\n }\n },\n \"command\": {\n \"poetry check --lock\": {\n \"command\": \"poetry check --lock\",\n \"cwd\": \"/home/nomura/ghq/github.com/shunichironomura/capsula\",\n \"returncode\": 0,\n \"stdout\": \"All set!\\n\",\n \"stderr\": \"\"\n },\n \"pip freeze --exclude-editable > requirements.txt\": {\n \"command\": \"pip freeze --exclude-editable > requirements.txt\",\n \"cwd\": \"/home/nomura/ghq/github.com/shunichironomura/capsula\",\n \"returncode\": 0,\n \"stdout\": \"\",\n \"stderr\": \"\"\n }\n },\n \"file\": {\n \"/home/nomura/ghq/github.com/shunichironomura/capsula/pyproject.toml\": {\n \"copied_to\": [\n \"/home/nomura/ghq/github.com/shunichironomura/capsula/vault/calculate_pi_20240711_190108_6I2M/pyproject.toml\"\n ],\n \"moved_to\": null,\n \"hash\": {\n \"algorithm\": \"sha256\",\n \"digest\": \"bfd58ba4947798d61ae3679cf3b06def700aefcdc33a2e4935164f480f16191c\"\n }\n },\n \"/home/nomura/ghq/github.com/shunichironomura/capsula/poetry.lock\": {\n \"copied_to\": [\n \"/home/nomura/ghq/github.com/shunichironomura/capsula/vault/calculate_pi_20240711_190108_6I2M/poetry.lock\"\n ],\n \"moved_to\": null,\n \"hash\": {\n \"algorithm\": \"sha256\",\n \"digest\": \"210e74a7cd2db48b95dee0def67d5bbba33a86ab85859bea6c17ca74b48a2448\"\n }\n },\n \"/home/nomura/ghq/github.com/shunichironomura/capsula/requirements.txt\": {\n \"copied_to\": [],\n \"moved_to\": \"/home/nomura/ghq/github.com/shunichironomura/capsula/vault/calculate_pi_20240711_190108_6I2M\",\n \"hash\": {\n \"algorithm\": \"sha256\",\n \"digest\": \"7d8d12ce44cae648c0f7cc7a636e226c857510276cd3a221de1ffa4d7125c5b0\"\n }\n }\n },\n \"env\": {\n \"HOME\": \"/home/nomura\"\n },\n \"function\": {\n \"calculate_pi\": {\n \"file_path\": \"examples/simple_decorator.py\",\n \"first_line_no\": 6,\n \"bound_args\": {\n \"n_samples\": 1000,\n \"seed\": 42\n }\n }\n }\n}</code></pre>\n</details>\n\n<details>\n<summary>Example of output <code>in-run-report.json</code>:</summary>\n<pre><code>{\n \"inside\": 782,\n \"pi_estimate\": 3.128,\n \"time\": {\n \"execution_time\": \"0:00:00.000612\"\n },\n \"exception\": {\n \"exception\": {\n \"exc_type\": null,\n \"exc_value\": null,\n \"traceback\": null\n }\n }\n}</code></pre>\n</details>\n\n<details>\n<summary>Example of output <code>post-run-report.json</code>:</summary>\n<pre><code>{\n \"file\": {\n \"pi.txt\": {\n \"copied_to\": [],\n \"moved_to\": \"/home/nomura/ghq/github.com/shunichironomura/capsula/vault/calculate_pi_20240711_190108_6I2M\",\n \"hash\": {\n \"algorithm\": \"sha256\",\n \"digest\": \"a64c761cb6b6f9ef1bc1f6afa6ba44d796c5c51d14df0bdc9d3ab9ced7982a74\"\n }\n }\n }\n}</code></pre>\n</details>\n\n## Installation\n\nYou can install Capsula via pip:\n\n```bash\npip install capsula\n```\n\nOr via conda:\n\n```bash\nconda install conda-forge::capsula\n```\n\n## Licensing\n\nThis project is licensed under the terms of the MIT.\n\nAdditionally, this project includes code derived from the Python programming language, which is licensed under the Python Software Foundation License Version 2 (PSF-2.0). For details, see the LICENSE file.\n",
"bugtrack_url": null,
"license": "MIT AND PSF-2.0",
"summary": "A Python package to capture command/function execution context for reproducibility.",
"version": "0.5.1",
"project_urls": {
"Documentation": "https://shunichironomura.github.io/capsula/",
"Homepage": "https://github.com/shunichironomura/capsula",
"Repository": "https://github.com/shunichironomura/capsula"
},
"split_keywords": [
"reproducibility",
" cli"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "4b23efdcd867deef87843d84a7084ff242ff819cc79be11f97fc65998c47ece7",
"md5": "247e9841b12b62cbb059bfd2e16b243a",
"sha256": "feb25c32d86c1de0885f51dac1bc48743d9c7ecaee7958fa608c66c6a9f8b99c"
},
"downloads": -1,
"filename": "capsula-0.5.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "247e9841b12b62cbb059bfd2e16b243a",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 33924,
"upload_time": "2024-07-16T06:31:07",
"upload_time_iso_8601": "2024-07-16T06:31:07.708352Z",
"url": "https://files.pythonhosted.org/packages/4b/23/efdcd867deef87843d84a7084ff242ff819cc79be11f97fc65998c47ece7/capsula-0.5.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "8b4cc8025cc4796b5794dc0ef88838c4b019d1291168e009f3f4ef54751e0c07",
"md5": "9cd8481415979c46873e6d1c97e8b24c",
"sha256": "429139406a60ae0d7d114066945b7612db623881aca621a87b7f29a1e3c63f9e"
},
"downloads": -1,
"filename": "capsula-0.5.1.tar.gz",
"has_sig": false,
"md5_digest": "9cd8481415979c46873e6d1c97e8b24c",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 27619,
"upload_time": "2024-07-16T06:31:09",
"upload_time_iso_8601": "2024-07-16T06:31:09.826632Z",
"url": "https://files.pythonhosted.org/packages/8b/4c/c8025cc4796b5794dc0ef88838c4b019d1291168e009f3f4ef54751e0c07/capsula-0.5.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-07-16 06:31:09",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "shunichironomura",
"github_project": "capsula",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "capsula"
}