# core


<!-- WARNING: THIS FILE WAS AUTOGENERATED! DO NOT EDIT! -->

``` python
from fastcore.basics import patch
```

------------------------------------------------------------------------

<a
href="https://github.com/jjmaturino/loghound/blob/main/loghound/core.py#L18"
target="_blank" style="float:right; font-size:smaller">source</a>

### Styles

``` python

def Styles(
    style:str, match_identifiers:list=<factory>
)->None:

```

------------------------------------------------------------------------

<a
href="https://github.com/jjmaturino/loghound/blob/main/loghound/core.py#L24"
target="_blank" style="float:right; font-size:smaller">source</a>

### load_yaml

``` python

def load_yaml(
    path:str
)->dict:

```

------------------------------------------------------------------------

<a
href="https://github.com/jjmaturino/loghound/blob/main/loghound/core.py#L34"
target="_blank" style="float:right; font-size:smaller">source</a>

### parse_line

``` python

def parse_line(
    pattern:str, line:str
)->dict:

```

------------------------------------------------------------------------

<a
href="https://github.com/jjmaturino/loghound/blob/main/loghound/core.py#L42"
target="_blank" style="float:right; font-size:smaller">source</a>

### Config

``` python

def Config(
    timestamp_field:str, concurrent:bool, default_style:str, match_identifier_field:str, pattern:str | None=None,
    format_str:str | None=None, source_field:str | None=None, styles:list=<factory>
)->None:

```

------------------------------------------------------------------------

<a
href="https://github.com/jjmaturino/loghound/blob/main/loghound/core.py#L63"
target="_blank" style="float:right; font-size:smaller">source</a>

### Config.from_yaml

``` python

def from_yaml(
    path:str
):

```

------------------------------------------------------------------------

<a
href="https://github.com/jjmaturino/loghound/blob/main/loghound/core.py#L90"
target="_blank" style="float:right; font-size:smaller">source</a>

### Config.\_\_repr\_\_

``` python

def __repr__(
    
):

```

*Return repr(self).*

------------------------------------------------------------------------

<a
href="https://github.com/jjmaturino/loghound/blob/main/loghound/core.py#L100"
target="_blank" style="float:right; font-size:smaller">source</a>

### build_display_string

``` python

def build_display_string(
    line_metadata:dict, format:str
)->str:

```

------------------------------------------------------------------------

<a
href="https://github.com/jjmaturino/loghound/blob/main/loghound/core.py#L104"
target="_blank" style="float:right; font-size:smaller">source</a>

### get_styles

``` python

def get_styles(
    cfg:Config, line_metadata:dict
)->str:

```

------------------------------------------------------------------------

<a
href="https://github.com/jjmaturino/loghound/blob/main/loghound/core.py#L112"
target="_blank" style="float:right; font-size:smaller">source</a>

### display_line

``` python

def display_line(
    cfg:Config, line_metadata:dict
)->None:

```

------------------------------------------------------------------------

<a
href="https://github.com/jjmaturino/loghound/blob/main/loghound/core.py#L123"
target="_blank" style="float:right; font-size:smaller">source</a>

### read_lines

``` python

def read_lines(
    file_name:str | None=None
):

```

------------------------------------------------------------------------

<a
href="https://github.com/jjmaturino/loghound/blob/main/loghound/core.py#L165"
target="_blank" style="float:right; font-size:smaller">source</a>

### ConcurrentInfo

``` python

def ConcurrentInfo(
    source:str, display_text:str, ts:int, style:list=<factory>
)->None:

```

------------------------------------------------------------------------

<a
href="https://github.com/jjmaturino/loghound/blob/main/loghound/core.py#L146"
target="_blank" style="float:right; font-size:smaller">source</a>

### generate_row

``` python

def generate_row(
    n_cols:int, source_col:int, log:ConcurrentInfo
)->list:

```

------------------------------------------------------------------------

<a
href="https://github.com/jjmaturino/loghound/blob/main/loghound/core.py#L173"
target="_blank" style="float:right; font-size:smaller">source</a>

### main

``` python

def main(
    config:str=None, # Path to config YAML file
    logfile:str=None, concurrent:bool=False
):

```

*Pretty print styled logs*

------------------------------------------------------------------------

<a
href="https://github.com/jjmaturino/loghound/blob/main/loghound/core.py#L165"
target="_blank" style="float:right; font-size:smaller">source</a>

### ConcurrentInfo

``` python

def ConcurrentInfo(
    source:str, display_text:str, ts:int, style:list=<factory>
)->None:

```

------------------------------------------------------------------------

<a
href="https://github.com/jjmaturino/loghound/blob/main/loghound/core.py#L159"
target="_blank" style="float:right; font-size:smaller">source</a>

### sync_display

``` python

def sync_display(
    cfg:Config, l:str
)->None:

```

``` python
!cat ../loghound/core.py
```

    """Fill in a module description here"""

    # AUTOGENERATED! DO NOT EDIT! File to edit: ../nbs/00_core.ipynb.

    # %% auto #0
    __all__ = ['console', 'Styles', 'load_yaml', 'parse_line', 'Config', 'build_display_string', 'get_styles', 'display_line',
               'read_lines', 'ConcurrentInfo', 'generate_row', 'sync_display', 'main']

    # %% ../nbs/00_core.ipynb #915f694b
    import yaml, re, sys


    # %% ../nbs/00_core.ipynb #9a7a29b0
    from dataclasses import dataclass, field

    # %% ../nbs/00_core.ipynb #299e5a84
    @dataclass
    class Styles:
        style: str;
        match_identifiers: list[str] = field(default_factory=set);


    # %% ../nbs/00_core.ipynb #a9c0af2a
    def load_yaml(path: str) -> dict[str, str]:
        contents = None
        with open(path) as f: contents = f.read()
        return yaml.safe_load(contents)





    # %% ../nbs/00_core.ipynb #db902471
    def parse_line(pattern: str, line: str) -> dict[str, str]:
        if pattern is None: return {"_line": line}
        m = re.match(pattern, line)
        if m == None:  return {"_line": f"unparseable line::{line}"}
        return m.groupdict()

    # %% ../nbs/00_core.ipynb #d0db9729
    @dataclass
    class Config:
        timestamp_field: str;
        concurrent: bool;
        default_style: str;
        match_identifier_field: str;

        pattern: str | None = None;
        format_str: str | None = None;
        source_field: str | None = None;
        styles: list[Styles] = field(default_factory=list);

        def __post_init__(self):
            self.match_mode = "exact" if self.pattern != None else "contains"
            self.match_identifier_field = "_line" if self.pattern == None else self.match_identifier_field
            if self.pattern and self.match_identifier_field not in re.compile(self.pattern).groupindex: raise ValueError("invalid config: match identifier not contained in pattern regex group")
            if self.pattern and not self.format_str: raise ValueError("invalid config: pattern and format_str are needed")

    # %% ../nbs/00_core.ipynb #4172d758
    from fastcore.basics import patch

    @patch(cls_method=True)
    def from_yaml(cls: Config, path: str):
        cnf_dict = load_yaml(path)

        main = cnf_dict.get("parse")
        styles = cnf_dict.get("styles")
        rules = styles.get("rules", [])

        res = Config(
            pattern = main.get("pattern", None),
            format_str= main.get("format_str", None),
            source_field=main.get("source_field", ""),
            timestamp_field= main.get("timestamp_field"),
            concurrent = main.get("concurrent", False),
            default_style=styles.get("default_style", "black"),

            match_identifier_field= styles.get("match_field"),
            styles = list(map(lambda d: Styles(match_identifiers=set(d.get("values", [])), style=d.get("style")), rules))

        )




        return res

    # %% ../nbs/00_core.ipynb #c5ca36c4
    @patch
    def __repr__(self: Config):
        return (f"Config(\n"
                f"  pattern: {self.pattern}\n"
                f"  timestamp_field: {self.timestamp_field}\n"
                f"  source_field: {self.source_field}\n"
                f"  match_field: {self.match_identifier_field}\n"
                f"  styles: {len(self.styles)} rules\n"
                f")")

    # %% ../nbs/00_core.ipynb #ec97589b
    def build_display_string(line_metadata:dict[str, str], format: str ) -> str:
        return format.format_map(line_metadata)

    # %% ../nbs/00_core.ipynb #c298e716
    def get_styles(cfg: Config, line_metadata: dict[str, str]) -> str:
        match_identifier_value = line_metadata[cfg.match_identifier_field] if "_line" not in line_metadata else "_line"
        if cfg.match_mode == "exact": matching_style: Styles = next((s for s in cfg.styles if match_identifier_value in s.match_identifiers), None)
        else:  matching_style: Styles = next((s for s in cfg.styles if any(ident in line_metadata["_line"] for ident in s.match_identifiers)), None)

        return matching_style.style if matching_style else cfg.default_style

    # %% ../nbs/00_core.ipynb #b34c192c
    def display_line(cfg: Config, line_metadata: dict[str, str])-> None:
        matching_style = get_styles(cfg, line_metadata)
        text = line_metadata.get("_line", line) if cfg.match_mode == "contains" or "_line"  in line_metadata else build_display_string(line_metadata, cfg.format_str)
        console.print(text, style=matching_style, highlight=False)

        return




    # %% ../nbs/00_core.ipynb #28c48fba
    def read_lines(file_name: str | None = None):
        if not file_name and not sys.stdin.isatty():
            for line in sys.stdin: yield line.strip()
        elif file_name:
            with open(file_name) as f:
                for line in f: yield line.strip()
        else:
            raise Error("failure: unable to read input")

    # %% ../nbs/00_core.ipynb #338fc5a5
    from rich.console import Console
    console = Console()

    # %% ../nbs/00_core.ipynb #bdc932c9
    @dataclass
    class ConcurrentInfo:
      source: str;
      display_text: str;
      ts: int;
      style: list[str] = field(default_factory=list);


    # %% ../nbs/00_core.ipynb #b512fb44
    def generate_row(n_cols: int,  source_col: int, log: ConcurrentInfo) -> list[str]:
        row = ["" for _ in range(n_cols)]
        row[source_col] = Text(log.display_text, style=log.style)

        return row

    # %% ../nbs/00_core.ipynb #99b41427
    from rich.text import Text
    from rich.table import Table

    from fastcore.script import call_parse


    def sync_display(cfg: Config, l: str) -> None:
        line_metadata = parse_line(cfg.pattern, l)
        display_line(cfg, line_metadata)


    @dataclass
    class ConcurrentInfo:
      source: str;
      display_text: str;
      ts: int;
      style: list[str] = field(default_factory=list);


    @call_parse
    def main(config:str=None,  # Path to config YAML file
             logfile:str=None,
             concurrent:bool=False,
             ): # Path to log file (or pipe via stdin)
              "Pretty print styled logs"
              cfg = Config.from_yaml(config)
              if not cfg.concurrent and not concurrent: 
                for l in read_lines(logfile): sync_display(cfg, l)
              else:
                processes = dict()
                current_idx = 0
                logs = []
                for l in read_lines(logfile):
                    line_metadata = parse_line(cfg.pattern, l)
                    source = line_metadata[cfg.source_field]
                    if source not in processes:
                        processes[source] = current_idx
                        current_idx += 1 

                    logs.append(
                      ConcurrentInfo(
                        source=line_metadata.get(cfg.source_field),
                        style=get_styles(cfg, line_metadata),
                        ts=line_metadata.get(cfg.timestamp_field),
                        display_text=build_display_string(line_metadata, cfg.format_str)))

                t = Table()
                t.add_column("time")
                for k in processes: t.add_column(k)

                for log in sorted(logs, key=lambda l: l.ts):
                    row = generate_row(len(processes), processes[log.source], log)
                    t.add_row(log.ts, *row)

                console.print(t)

How can I test this nbdev package cli?

##### 🤖Reply🤖<!-- SOLVEIT_SEPARATOR_7f3a9b2c -->

🧠🧠🧠🧠🧠🧠🧠🧠🧠🧠🧠🧠🧠🧠🧠🧠🧠🧠🧠🧠🧠🧠🧠🧠🧠🧠🧠🧠🧠🧠🧠🧠🧠🧠🧠🧠🧠🧠🧠🧠🧠🧠🧠🧠🧠🧠🧠🧠🧠🧠🧠🧠🧠🧠🧠🧠🧠🧠🧠🧠🧠🧠🧠🧠🧠🧠🧠🧠🧠🧠🧠🧠🧠🧠🧠🧠

There are a couple of approaches:

1.  **Call
    [`main`](https://jjmaturino.github.io/loghound/core.html#main)
    directly in the notebook** — `@call_parse` lets you call it with
    keyword args like a normal function:

``` python
main(config="path/to/your/config.yaml", logfile="path/to/some.log")
```

2.  **As a CLI command** — if you’ve set up `console_scripts` in your
    `settings.ini`, you can run it from the terminal after
    `pip install -e .`. Check your `settings.ini` — do you have a
    `console_scripts` line pointing to `bloodhound.core:main`?

Do you have a sample YAML config and log file you can test with? That
would be the first thing to get in place if not.

``` python
main(config="../example_configs/raft_errors.yaml", logfile="../example_logs/raft.txt", concurrent=True)
```

<pre style="white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace">┏━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃<span style="font-weight: bold"> time   </span>┃<span style="font-weight: bold"> S0                               </span>┃<span style="font-weight: bold"> S1                               </span>┃<span style="font-weight: bold"> S2                               </span>┃
┡━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┩
│ 000000 │ <span style="color: #c0c0c0; text-decoration-color: #c0c0c0">000000::S0::Starting up         </span> │                                  │                                  │
│ 000000 │                                  │ <span style="color: #c0c0c0; text-decoration-color: #c0c0c0">000000::S1::Starting up         </span> │                                  │
│ 000000 │                                  │                                  │ <span style="color: #c0c0c0; text-decoration-color: #c0c0c0">000000::S2::Starting up         </span> │
│ 000001 │ <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">000001::S0::Election timer      </span> │                                  │                                  │
│        │ <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">started                         </span> │                                  │                                  │
│ 000001 │                                  │ <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">000001::S1::Election timer      </span> │                                  │
│        │                                  │ <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">started                         </span> │                                  │
│ 000001 │                                  │                                  │ <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">000001::S2::Election timer      </span> │
│        │                                  │                                  │ <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">started                         </span> │
│ 000045 │                                  │                                  │ <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">000045::S2::Election timeout    </span> │
│        │                                  │                                  │ <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">elapsed                         </span> │
│ 000046 │                                  │                                  │ <span style="color: #008080; text-decoration-color: #008080">000046::S2::Becoming candidate  </span> │
│        │                                  │                                  │ <span style="color: #008080; text-decoration-color: #008080">for term 1                      </span> │
│ 000047 │                                  │                                  │ <span style="color: #008080; text-decoration-color: #008080">000047::S2::Requesting vote from</span> │
│        │                                  │                                  │ <span style="color: #008080; text-decoration-color: #008080">S0                              </span> │
│ 000047 │                                  │                                  │ <span style="color: #008080; text-decoration-color: #008080">000047::S2::Requesting vote from</span> │
│        │                                  │                                  │ <span style="color: #008080; text-decoration-color: #008080">S1                              </span> │
│ 000052 │ <span style="color: #008080; text-decoration-color: #008080">000052::S0::Granting vote to S2 </span> │                                  │                                  │
│        │ <span style="color: #008080; text-decoration-color: #008080">for term 1                      </span> │                                  │                                  │
│ 000053 │                                  │ <span style="color: #008080; text-decoration-color: #008080">000053::S1::Granting vote to S2 </span> │                                  │
│        │                                  │ <span style="color: #008080; text-decoration-color: #008080">for term 1                      </span> │                                  │
│ 000054 │                                  │                                  │ <span style="color: #008000; text-decoration-color: #008000; font-weight: bold">000054::S2::Became leader for   </span> │
│        │                                  │                                  │ <span style="color: #008000; text-decoration-color: #008000; font-weight: bold">term 1                          </span> │
│ 000055 │                                  │                                  │ <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">000055::S2::Leader, checking    </span> │
│        │                                  │                                  │ <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">heartbeats                      </span> │
│ 000056 │                                  │                                  │ <span style="color: #dfdfdf; text-decoration-color: #dfdfdf">000056::S2::Sending             </span> │
│        │                                  │                                  │ <span style="color: #dfdfdf; text-decoration-color: #dfdfdf">AppendEntries to S0             </span> │
│ 000056 │                                  │                                  │ <span style="color: #dfdfdf; text-decoration-color: #dfdfdf">000056::S2::Sending             </span> │
│        │                                  │                                  │ <span style="color: #dfdfdf; text-decoration-color: #dfdfdf">AppendEntries to S1             </span> │
│ 000060 │ <span style="color: #dfdfdf; text-decoration-color: #dfdfdf">000060::S0::Received            </span> │                                  │                                  │
│        │ <span style="color: #dfdfdf; text-decoration-color: #dfdfdf">AppendEntries from S2           </span> │                                  │                                  │
│ 000060 │                                  │ <span style="color: #dfdfdf; text-decoration-color: #dfdfdf">000060::S1::Received            </span> │                                  │
│        │                                  │ <span style="color: #dfdfdf; text-decoration-color: #dfdfdf">AppendEntries from S2           </span> │                                  │
│ 000100 │                                  │                                  │ <span style="color: #000080; text-decoration-color: #000080">000100::S2::Received client     </span> │
│        │                                  │                                  │ <span style="color: #000080; text-decoration-color: #000080">request: Put(x, 1)              </span> │
│ 000101 │                                  │                                  │ <span style="color: #dfdfdf; text-decoration-color: #dfdfdf">000101::S2::Appended entry at   </span> │
│        │                                  │                                  │ <span style="color: #dfdfdf; text-decoration-color: #dfdfdf">index 1                         </span> │
│ 000102 │                                  │                                  │ <span style="color: #dfdfdf; text-decoration-color: #dfdfdf">000102::S2::Replicating entry 1 </span> │
│        │                                  │                                  │ <span style="color: #dfdfdf; text-decoration-color: #dfdfdf">to S0                           </span> │
│ 000102 │                                  │                                  │ <span style="color: #dfdfdf; text-decoration-color: #dfdfdf">000102::S2::Replicating entry 1 </span> │
│        │                                  │                                  │ <span style="color: #dfdfdf; text-decoration-color: #dfdfdf">to S1                           </span> │
│ 000108 │ <span style="color: #dfdfdf; text-decoration-color: #dfdfdf">000108::S0::Accepted entry 1    </span> │                                  │                                  │
│        │ <span style="color: #dfdfdf; text-decoration-color: #dfdfdf">from S2                         </span> │                                  │                                  │
│ 000109 │                                  │ <span style="color: #dfdfdf; text-decoration-color: #dfdfdf">000109::S1::Accepted entry 1    </span> │                                  │
│        │                                  │ <span style="color: #dfdfdf; text-decoration-color: #dfdfdf">from S2                         </span> │                                  │
│ 000110 │                                  │                                  │ <span style="color: #800080; text-decoration-color: #800080; font-weight: bold">000110::S2::Entry 1 committed   </span> │
│        │                                  │                                  │ <span style="color: #800080; text-decoration-color: #800080; font-weight: bold">(majority reached)              </span> │
│ 000111 │                                  │                                  │ <span style="color: #000080; text-decoration-color: #000080">000111::S2::Applied command     </span> │
│        │                                  │                                  │ <span style="color: #000080; text-decoration-color: #000080">Put(x, 1)                       </span> │
│ 000155 │                                  │                                  │ <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">000155::S2::Leader, checking    </span> │
│        │                                  │                                  │ <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">heartbeats                      </span> │
│ 000156 │                                  │                                  │ <span style="color: #dfdfdf; text-decoration-color: #dfdfdf">000156::S2::Sending             </span> │
│        │                                  │                                  │ <span style="color: #dfdfdf; text-decoration-color: #dfdfdf">AppendEntries to S0             </span> │
│ 000156 │                                  │                                  │ <span style="color: #dfdfdf; text-decoration-color: #dfdfdf">000156::S2::Sending             </span> │
│        │                                  │                                  │ <span style="color: #dfdfdf; text-decoration-color: #dfdfdf">AppendEntries to S1             </span> │
│ 000200 │                                  │                                  │ <span style="color: #000080; text-decoration-color: #000080">000200::S2::Received client     </span> │
│        │                                  │                                  │ <span style="color: #000080; text-decoration-color: #000080">request: Put(y, 2)              </span> │
│ 000201 │                                  │                                  │ <span style="color: #dfdfdf; text-decoration-color: #dfdfdf">000201::S2::Appended entry at   </span> │
│        │                                  │                                  │ <span style="color: #dfdfdf; text-decoration-color: #dfdfdf">index 2                         </span> │
│ 000202 │                                  │                                  │ <span style="color: #dfdfdf; text-decoration-color: #dfdfdf">000202::S2::Replicating entry 2 </span> │
│        │                                  │                                  │ <span style="color: #dfdfdf; text-decoration-color: #dfdfdf">to S0                           </span> │
│ 000202 │                                  │                                  │ <span style="color: #dfdfdf; text-decoration-color: #dfdfdf">000202::S2::Replicating entry 2 </span> │
│        │                                  │                                  │ <span style="color: #dfdfdf; text-decoration-color: #dfdfdf">to S1                           </span> │
│ 000210 │ <span style="color: #dfdfdf; text-decoration-color: #dfdfdf">000210::S0::Accepted entry 2    </span> │                                  │                                  │
│        │ <span style="color: #dfdfdf; text-decoration-color: #dfdfdf">from S2                         </span> │                                  │                                  │
│ 000212 │                                  │ <span style="color: #800000; text-decoration-color: #800000">000212::S1::Dropped             </span> │                                  │
│        │                                  │ <span style="color: #800000; text-decoration-color: #800000">AppendEntries (simulated network</span> │                                  │
│        │                                  │ <span style="color: #800000; text-decoration-color: #800000">loss)                           </span> │                                  │
│ 000213 │                                  │                                  │ <span style="color: #800080; text-decoration-color: #800080; font-weight: bold">000213::S2::Entry 2 committed   </span> │
│        │                                  │                                  │ <span style="color: #800080; text-decoration-color: #800080; font-weight: bold">(majority reached)              </span> │
│ 000214 │                                  │                                  │ <span style="color: #000080; text-decoration-color: #000080">000214::S2::Applied command     </span> │
│        │                                  │                                  │ <span style="color: #000080; text-decoration-color: #000080">Put(y, 2)                       </span> │
│ 000255 │                                  │                                  │ <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">000255::S2::Leader, checking    </span> │
│        │                                  │                                  │ <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">heartbeats                      </span> │
│ 000256 │                                  │                                  │ <span style="color: #dfdfdf; text-decoration-color: #dfdfdf">000256::S2::Sending             </span> │
│        │                                  │                                  │ <span style="color: #dfdfdf; text-decoration-color: #dfdfdf">AppendEntries to S0             </span> │
│ 000256 │                                  │                                  │ <span style="color: #dfdfdf; text-decoration-color: #dfdfdf">000256::S2::Sending             </span> │
│        │                                  │                                  │ <span style="color: #dfdfdf; text-decoration-color: #dfdfdf">AppendEntries to S1             </span> │
│ 000260 │ <span style="color: #dfdfdf; text-decoration-color: #dfdfdf">000260::S0::Accepted heartbeat  </span> │                                  │                                  │
│        │ <span style="color: #dfdfdf; text-decoration-color: #dfdfdf">from S2                         </span> │                                  │                                  │
│ 000262 │                                  │ <span style="color: #dfdfdf; text-decoration-color: #dfdfdf">000262::S1::Accepted heartbeat  </span> │                                  │
│        │                                  │ <span style="color: #dfdfdf; text-decoration-color: #dfdfdf">from S2                         </span> │                                  │
│ 000300 │                                  │ <span style="color: #800000; text-decoration-color: #800000; font-weight: bold">000300::S1::Failed to persist   </span> │                                  │
│        │                                  │ <span style="color: #800000; text-decoration-color: #800000; font-weight: bold">state: disk full                </span> │                                  │
│ 000301 │                                  │ <span style="color: #808000; text-decoration-color: #808000">000301::S1::Retrying persist in </span> │                                  │
│        │                                  │ <span style="color: #808000; text-decoration-color: #808000">50ms                            </span> │                                  │
│ 000350 │                                  │ <span style="color: #008000; text-decoration-color: #008000">000350::S1::State persisted     </span> │                                  │
│        │                                  │ <span style="color: #008000; text-decoration-color: #008000">successfully                    </span> │                                  │
│ 000400 │                                  │                                  │ <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">000400::S2::Leader, checking    </span> │
│        │                                  │                                  │ <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">heartbeats                      </span> │
│ 000500 │ <span style="color: #800000; text-decoration-color: #800000">000500::S0::Dropped heartbeat   </span> │                                  │                                  │
│        │ <span style="color: #800000; text-decoration-color: #800000">(simulated network loss)        </span> │                                  │                                  │
│ 000501 │                                  │ <span style="color: #800000; text-decoration-color: #800000">000501::S1::Dropped heartbeat   </span> │                                  │
│        │                                  │ <span style="color: #800000; text-decoration-color: #800000">(simulated network loss)        </span> │                                  │
│ 000600 │ <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">000600::S0::Election timeout    </span> │                                  │                                  │
│        │ <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">elapsed                         </span> │                                  │                                  │
│ 000601 │ <span style="color: #008080; text-decoration-color: #008080">000601::S0::Becoming candidate  </span> │                                  │                                  │
│        │ <span style="color: #008080; text-decoration-color: #008080">for term 2                      </span> │                                  │                                  │
│ 000602 │ <span style="color: #008080; text-decoration-color: #008080">000602::S0::Requesting vote from</span> │                                  │                                  │
│        │ <span style="color: #008080; text-decoration-color: #008080">S1                              </span> │                                  │                                  │
│ 000602 │ <span style="color: #008080; text-decoration-color: #008080">000602::S0::Requesting vote from</span> │                                  │                                  │
│        │ <span style="color: #008080; text-decoration-color: #008080">S2                              </span> │                                  │                                  │
│ 000605 │                                  │                                  │ <span style="color: #800000; text-decoration-color: #800000; font-weight: bold">000605::S2::Stepping down,      </span> │
│        │                                  │                                  │ <span style="color: #800000; text-decoration-color: #800000; font-weight: bold">discovered higher term 2        </span> │
│ 000606 │                                  │ <span style="color: #008080; text-decoration-color: #008080">000606::S1::Granting vote to S0 </span> │                                  │
│        │                                  │ <span style="color: #008080; text-decoration-color: #008080">for term 2                      </span> │                                  │
│ 000607 │                                  │                                  │ <span style="color: #008080; text-decoration-color: #008080">000607::S2::Granting vote to S0 </span> │
│        │                                  │                                  │ <span style="color: #008080; text-decoration-color: #008080">for term 2                      </span> │
│ 000608 │ <span style="color: #008000; text-decoration-color: #008000; font-weight: bold">000608::S0::Became leader for   </span> │                                  │                                  │
│        │ <span style="color: #008000; text-decoration-color: #008000; font-weight: bold">term 2                          </span> │                                  │                                  │
│ 000609 │ <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">000609::S0::Leader, checking    </span> │                                  │                                  │
│        │ <span style="color: #7f7f7f; text-decoration-color: #7f7f7f">heartbeats                      </span> │                                  │                                  │
│ 000610 │ <span style="color: #dfdfdf; text-decoration-color: #dfdfdf">000610::S0::Sending             </span> │                                  │                                  │
│        │ <span style="color: #dfdfdf; text-decoration-color: #dfdfdf">AppendEntries to S1             </span> │                                  │                                  │
│ 000610 │ <span style="color: #dfdfdf; text-decoration-color: #dfdfdf">000610::S0::Sending             </span> │                                  │                                  │
│        │ <span style="color: #dfdfdf; text-decoration-color: #dfdfdf">AppendEntries to S2             </span> │                                  │                                  │
│ 000700 │ <span style="color: #000080; text-decoration-color: #000080">000700::S0::Received client     </span> │                                  │                                  │
│        │ <span style="color: #000080; text-decoration-color: #000080">request: Get(x)                 </span> │                                  │                                  │
│ 000701 │ <span style="color: #dfdfdf; text-decoration-color: #dfdfdf">000701::S0::Reading key x = 1   </span> │                                  │                                  │
│ 000702 │ <span style="color: #000080; text-decoration-color: #000080">000702::S0::Responded to client:</span> │                                  │                                  │
│        │ <span style="color: #000080; text-decoration-color: #000080">x = 1                           </span> │                                  │                                  │
│ 000800 │ <span style="color: #808000; text-decoration-color: #808000; font-weight: bold">000800::S0::Starting snapshot at</span> │                                  │                                  │
│        │ <span style="color: #808000; text-decoration-color: #808000; font-weight: bold">index 2                         </span> │                                  │                                  │
│ 000801 │ <span style="color: #808000; text-decoration-color: #808000; font-weight: bold">000801::S0::Snapshot complete,  </span> │                                  │                                  │
│        │ <span style="color: #808000; text-decoration-color: #808000; font-weight: bold">128 bytes                       </span> │                                  │                                  │
│ 000802 │ <span style="color: #808000; text-decoration-color: #808000; font-weight: bold">000802::S0::Sending snapshot to </span> │                                  │                                  │
│        │ <span style="color: #808000; text-decoration-color: #808000; font-weight: bold">S1                              </span> │                                  │                                  │
│ 000810 │                                  │ <span style="color: #808000; text-decoration-color: #808000; font-weight: bold">000810::S1::Installed snapshot  </span> │                                  │
│        │                                  │ <span style="color: #808000; text-decoration-color: #808000; font-weight: bold">from S0                         </span> │                                  │
└────────┴──────────────────────────────────┴──────────────────────────────────┴──────────────────────────────────┘
</pre>

In order to include the 3rd party packages for nbdev, what must I do?

##### 🤖Reply🤖<!-- SOLVEIT_SEPARATOR_7f3a9b2c -->

🧠🧠🧠🧠🧠🧠🧠🧠🧠🧠🧠🧠🧠🧠🧠🧠🧠🧠🧠🧠🧠

In your `settings.ini` file (at the root of your nbdev project), add the
third-party packages to the `requirements` field. For your project, that
would look something like:

``` ini
requirements = pyyaml rich fastcore
```

Each package name is space-separated. This ensures that when someone
installs your package (e.g. via `pip install`), those dependencies get
pulled in automatically.

Do you have a `settings.ini` already? If so, can you show it so we can
check what’s there?
