No description
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Jonathan Arnett 78a271bae3
Update README to remove outdated warning
Removed warning about Opis not working for OTP-27.
2025-10-29 02:00:31 +00:00
.github/workflows Add CI workflow 2025-10-10 00:11:24 -04:00
lib v0.2.0 2025-10-10 00:11:24 -04:00
test Fix(?) ending tracing 2025-10-09 23:15:52 -04:00
.formatter.exs Initial commit 2023-03-16 01:05:17 -04:00
.gitignore Initial commit 2023-03-16 01:05:17 -04:00
LICENSE v0.2.0 2025-10-10 00:11:24 -04:00
mix.exs v0.2.0 2025-10-10 00:11:24 -04:00
mix.lock v0.2.0 2025-10-10 00:11:24 -04:00
README.md Update README to remove outdated warning 2025-10-29 02:00:31 +00:00

Opis

A tool for debugging through recording the parameters and return values in the call tree of a function.

Usage

Opis allows you to analyze all calls that an expression makes:

Opis.analyze(MyApp.do_thing())

To retrieve this data, use calls/0:

Opis.calls()

This will return a call tree, something like this:

[
  %Opis.Call{call: {MyApp, :do_thing, []}, return: {:ok, :success}, children: [
    %Opis.Call{call: {MyApp.Thing.do_thing, []}, return: {:ok, :success}, children: [
      # etc
    ]}
  ]}
]

to_string is implemented for the Opis.Call struct, so you can use IO.puts to view the calls in a more friendly format, e.g.

MyApp.do_thing() => {:ok, :success}
  MyApp.Thing.do_thing() => {:ok, :success}
    # etc

These two steps can be performed in one fell swoop with Opis.analyze_and_print:

Opis.analyze_and_print(MyApp.do_thing())
# MyApp.do_thing() => {:ok, :success}
#   MyApp.Thing.do_thing() => {:ok, :success}
#     etc
{:ok, :success}

Installation

The package can be installed by adding opis to your list of dependencies in mix.exs:

def deps do
  [
    {:opis, "~> 0.2.0", only: [:dev, :test]}
  ]
end

The docs can be found at https://hexdocs.pm/opis.

Name

One of my other libraries is named Saturn, and Saturn's consort is named Ops. Well, I couldn't name this "Ops" now could I? Apparently there's another spelling, "Opis," which purportedly also means "plenty" in Latin.