<jupyter_start><jupyter_text>doit> _The use of `doit` is an implementation detail, and is subject to change!_Under the hood, the [CLI](./cli.ipynb) is powered by [doit](https://github.com/pydoit/doit), a lightweight task engine in python comparable to `make`.  Using Tasks with the API<jupyter_code>import os, pathlib, tempfile, shutil, atexit, hashlib
from IPython.display import *
from IPython import get_ipython # needed for `jupyter_execute` because magics?
import IPython
if "TMP_DIR" not in globals():
    TMP_DIR = pathlib.Path(tempfile.mkdtemp(prefix="_my_lite_dir_"))
    def clean():
        shutil.rmtree(TMP_DIR)
    atexit.register(clean)
os.chdir(TMP_DIR)
print(pathlib.Path.cwd())<jupyter_output><empty_output><jupyter_text>The `LiteManager` collects all the tasks from _Addons_, and can optionally accept a `task_prefix` in case you need to integrate with existing tasks.<jupyter_code>from jupyterlite.manager import LiteManager
manager = LiteManager(
    task_prefix="lite_"
)
manager.initialize()
manager.doit_run("lite_status")<jupyter_output><empty_output><jupyter_text>Custom Tasks and `%doit``doit` offers an IPython [magic](https://ipython.readthedocs.io/en/stable/interactive/magics.html), enabled with an extension. This can be combined to create highly reactive build tools for creating very custom sites.<jupyter_code>%reload_ext doit<jupyter_output><empty_output><jupyter_text>It works against the `__main__` namespace, which won't have anything by default.<jupyter_code>%doit list<jupyter_output><empty_output><jupyter_text>All the JupyterLite tasks can be added by updating `__main__` via `globals`<jupyter_code>globals().update(manager._doit_tasks)<jupyter_output><empty_output><jupyter_text>Now when a new task is created, it can reference other tasks and targets.<jupyter_code>def task_hello():
    return dict(
        actions=[lambda: print("HELLO!")],
        task_dep=["lite_post_status"]
    )
%doit -v2 hello<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.10369246332827517, 'fraction_numerical': 0.0005058168942842691, 'mean_word_length': 6.520912547528517, 'pattern_counts': {'":': 0, '<': 25, '<?xml version=': 0, '>': 26, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '6', 'dir': 'jupyter-structured-clean-dedup', 'id': '181857', 'license': 'BSD-3-Clause', 'n_tokens_mistral': 674, 'n_tokens_neox': 662, 'n_words': 171, 'path': 'docs/doit.ipynb', 'repo_name': 'Muflhi01/jupyterlite', 'size': '1977'}