# Efficient way to find which package defines an unknown type

**URL:** <https://discourse.julialang.org/t/efficient-way-to-find-which-package-defines-an-unknown-type/42222>\
**Category:** New to Julia\
**Created:** [June 29, 2020, 3:06am UTC](https://discourse.julialang.org/t/efficient-way-to-find-which-package-defines-an-unknown-type/42222 "2020-06-29T03:06:03Z")\
**Posts on this page:** 16\
**Page:** 1

<div class="post-metadata">

**Author:** ![pauljurczak](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/pauljurczak/32/921_2.png) [@pauljurczak](https://discourse.julialang.org/u/pauljurczak)\
**Post date:** [June 29, 2020, 3:06am UTC](https://discourse.julialang.org/t/efficient-way-to-find-which-package-defines-an-unknown-type/42222/1 "2020-06-29T03:06:03Z")

</div>

I installed a bunch of packages from [https://juliaimages.org/](https://juliaimages.org/) and I’m going through examples, which inevitably require more packages. Say, I’m confronted with:

```julia
julia> j = rand(Gray{N0f8}, 3, 4)
ERROR: UndefVarError: N0f8 not defined

```

Is there a better way to hunt for the package defining `N0f8` than my hunch to look for `Image*` or `Color*`?

Julia package repositories are much more organized than some other languages. Is there a tool to lookup the type name across all (most) packages known to Julia package manager?

---

<div class="post-metadata">

**Author:** ![dpsanders](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dpsanders/32/3573_2.png) [@dpsanders](https://discourse.julialang.org/u/dpsanders)\
**Post date:** [June 29, 2020, 4:43am UTC](https://discourse.julialang.org/t/efficient-way-to-find-which-package-defines-an-unknown-type/42222/2 "2020-06-29T04:43:00Z")

</div>

You can do code and docs searches across all packages on [https://juliahub.com/](https://juliahub.com/)

---

<div class="post-metadata">

**Author:** ![pauljurczak](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/pauljurczak/32/921_2.png) [@pauljurczak](https://discourse.julialang.org/u/pauljurczak)\
**Post date:** [June 29, 2020, 5:10am UTC](https://discourse.julialang.org/t/efficient-way-to-find-which-package-defines-an-unknown-type/42222/3 "2020-06-29T05:10:23Z")

</div>

Nice, but Code Search for `N0f8` filtered by definition returns: `No results found`. Other searches are helpful, though. Very useful resource, thank you.

---

<div class="post-metadata">

**Author:** ![dpsanders](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dpsanders/32/3573_2.png) [@dpsanders](https://discourse.julialang.org/u/dpsanders)\
**Post date:** [June 29, 2020, 5:16am UTC](https://discourse.julialang.org/t/efficient-way-to-find-which-package-defines-an-unknown-type/42222/4 "2020-06-29T05:16:16Z")

</div>

If you do a code search with no filtering it gives you useful results: [JuliaHub](https://juliahub.com/ui/CodeSearch?q=N0f8&u=all&t=all)

---

<div class="post-metadata">

**Author:** ![WschW](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/wschw/32/6575_2.png) [@WschW](https://discourse.julialang.org/u/WschW)\
**Post date:** [June 29, 2020, 5:36am UTC](https://discourse.julialang.org/t/efficient-way-to-find-which-package-defines-an-unknown-type/42222/5 "2020-06-29T05:36:38Z")

</div>

That one is a bit tricky to find. Had to follow some comments from to figure out its origin, but seems to be defined in this location in `FixedPointNumbers` :

[https://github.com/JuliaMath/FixedPointNumbers.jl/blob/bfb4f47bce402c968b9699d9b6ef801ecc682328/src/normed.jl#L25](https://github.com/JuliaMath/FixedPointNumbers.jl/blob/bfb4f47bce402c968b9699d9b6ef801ecc682328/src/normed.jl#L25)

---

<div class="post-metadata">

**Author:** ![pauljurczak](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/pauljurczak/32/921_2.png) [@pauljurczak](https://discourse.julialang.org/u/pauljurczak)\
**Post date:** [June 29, 2020, 7:25am UTC](https://discourse.julialang.org/t/efficient-way-to-find-which-package-defines-an-unknown-type/42222/6 "2020-06-29T07:25:45Z")

</div>

I can see why a text search engine would have a problem with this. Perhaps something along the lines of Julia compiler with ALL packages known to package manager installed doing search on AST level or deeper would work better in tricky cases?

Maybe this:

```julia
]add *

```

if you have RAM and CPU cycles to burn.

---

<div class="post-metadata">

**Author:** ![tim.holy](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tim.holy/32/52_2.png) [@tim.holy](https://discourse.julialang.org/u/tim.holy)\
**Post date:** [June 29, 2020, 4:29pm UTC](https://discourse.julialang.org/t/efficient-way-to-find-which-package-defines-an-unknown-type/42222/7 "2020-06-29T16:29:15Z")

</div>

```julia
julia> using Images

julia> N0f8
Normed{UInt8,8}

julia> N0f8.name.module
FixedPointNumbers

```

If you just say `using Images` then you should get all the types you need for most work. But of course, loading the “big package” takes time, and it can indeed be useful to be able to discover the minimal set of packages you need for the focused task.

---

<div class="post-metadata">

**Author:** ![StefanKarpinski](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stefankarpinski/32/24_2.png) [@StefanKarpinski](https://discourse.julialang.org/u/StefanKarpinski)\
**Post date:** [June 29, 2020, 8:19pm UTC](https://discourse.julialang.org/t/efficient-way-to-find-which-package-defines-an-unknown-type/42222/8 "2020-06-29T20:19:24Z")

</div>

I’ve opened a JuliaHub issue to track this as a potential code search enhancement: [https://github.com/JuliaComputing/JuliaHub/issues/57](https://github.com/JuliaComputing/JuliaHub/issues/57)

---

<div class="post-metadata">

**Author:** ![pauljurczak](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/pauljurczak/32/921_2.png) [@pauljurczak](https://discourse.julialang.org/u/pauljurczak)\
**Post date:** [June 29, 2020, 9:10pm UTC](https://discourse.julialang.org/t/efficient-way-to-find-which-package-defines-an-unknown-type/42222/9 "2020-06-29T21:10:43Z")

</div>

I was following the manual at [Getting started · JuliaImages](https://juliaimages.org/latest/install/), perhaps too mindlessly. It was not clear what is the structure of packages in JuliaImages. The first example on that page starts with:

```julia
using FileIO

```

and there is no

```julia
using Images

```

on that page nor the next one, where `N0f8` is introduced. I know it should be obvious, but for some reason it wasn’t for this noob.

---

<div class="post-metadata">

**Author:** ![tim.holy](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tim.holy/32/52_2.png) [@tim.holy](https://discourse.julialang.org/u/tim.holy)\
**Post date:** [June 29, 2020, 10:11pm UTC](https://discourse.julialang.org/t/efficient-way-to-find-which-package-defines-an-unknown-type/42222/10 "2020-06-29T22:11:29Z")

</div>

That’s useful feedback, thanks for explaining what you were looking at! Nothing on that page actually requires you to say `using Images` but perhaps we should. Any suggestions about where it would be most helpful?

These comments from newbies are more useful than you could know, keep 'em coming! The most helpful thing to do would be to click on the “edit on GitHub” link in the docs and then either (1) make a change or (2) just file an issue saying “I was confused about x on this page, please help!”

---

<div class="post-metadata">

**Author:** ![pauljurczak](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/pauljurczak/32/921_2.png) [@pauljurczak](https://discourse.julialang.org/u/pauljurczak)\
**Post date:** [June 29, 2020, 10:28pm UTC](https://discourse.julialang.org/t/efficient-way-to-find-which-package-defines-an-unknown-type/42222/11 "2020-06-29T22:28:57Z")

</div>

I’m a bit reluctant to propose changes since these are my early days with actually using Julia and I’m moving in a haze of confusion and making rookie mistakes every move. I will try to expand beyond a few pull requests with minor grammar corrections.

---

<div class="post-metadata">

**Author:** ![Oscar\_Smith](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/oscar_smith/32/25343_2.png) [@Oscar\_Smith](https://discourse.julialang.org/u/Oscar_Smith)\
**Post date:** [June 29, 2020, 10:34pm UTC](https://discourse.julialang.org/t/efficient-way-to-find-which-package-defines-an-unknown-type/42222/12 "2020-06-29T22:34:19Z")

</div>

Doc changes are actually prime for novice contributions. The whole point of docs is to make it easy to understand (especially for newcomers). As such, newcomers are usually write some of the best documentation since they know what they need.

---

<div class="post-metadata">

**Author:** ![tim.holy](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tim.holy/32/52_2.png) [@tim.holy](https://discourse.julialang.org/u/tim.holy)\
**Post date:** [June 29, 2020, 11:12pm UTC](https://discourse.julialang.org/t/efficient-way-to-find-which-package-defines-an-unknown-type/42222/13 "2020-06-29T23:12:51Z")

</div>

Even if you don’t create improvements, you can do this:

- click on “edit on github”
- put your cursor in the spot where you got confused
- type “This confused me. What is N0f8?”
- submit it as a “pull request.”

We’ll treat that as an issue report rather than a fix. But the advantages for us are that we won’t forget to deal with it, whereas things posted here get lost to the sands of time if someone doesn’t fix it immediately.

---

<div class="post-metadata">

**Author:** ![c42f](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/c42f/32/52842_2.png) [@c42f](https://discourse.julialang.org/u/c42f)\
**Post date:** [June 30, 2020, 1:21am UTC](https://discourse.julialang.org/t/efficient-way-to-find-which-package-defines-an-unknown-type/42222/14 "2020-06-30T01:21:29Z")

</div>

Hi Paul, just to reiterate what others have said — points of confusion are probably bugs in the documentation. So if you’re willing, do make a big list of them and we can help file them with appropriate packages as necessary.

I think the julia community and ecosystem has entered a phase of growth where we need better tutorial and how-to style documentation. This is one of the areas where new users can help us most!

---

<div class="post-metadata">

**Author:** ![pauljurczak](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/pauljurczak/32/921_2.png) [@pauljurczak](https://discourse.julialang.org/u/pauljurczak)\
**Post date:** [June 30, 2020, 3:02am UTC](https://discourse.julialang.org/t/efficient-way-to-find-which-package-defines-an-unknown-type/42222/15 "2020-06-30T03:02:05Z")

</div>

> [@c42f](#):
>
> points of confusion are probably bugs in the documentation

Hi Chris, some of them are, but in my case a lot of them are the result of impatience to have something working quick. I will try to contribute to Julia documentation. In this case, I made a pull request, which is already merged: [Clarified use by pauljurczak · Pull Request #137 · JuliaImages/juliaimages.github.io · GitHub](https://github.com/JuliaImages/juliaimages.github.io/pull/137)

---

<div class="post-metadata">

**Author:** ![Tamas\_Papp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tamas_papp/32/25949_2.png) [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Post date:** [June 30, 2020, 8:24am UTC](https://discourse.julialang.org/t/efficient-way-to-find-which-package-defines-an-unknown-type/42222/16 "2020-06-30T08:24:41Z")

</div>

> [@tim.holy](#):
>
> ```julia
> julia> N0f8.name.module
> FixedPointNumbers
> 
> ```

I would suggest

```julia
parentmodule(N0f8)

```

instead.

> [@pauljurczak](#):
>
> I’m moving in a haze of confusion and making rookie mistakes every move

Don’t worry, PRs are reviewed before merging, and you will be given suggestions on how to improve them if necessary. Most projects appreciate PRs even if they require quite a bit of handholding, because it means that someone is looking at the code/docs and they are happy to draw people in.
