# Exclude packages from PackageCompiler create\_app precompilation

**URL:** https://discourse.julialang.org/t/exclude-packages-from-packagecompiler-create-app-precompilation/76134
**Category:** General Usage
**Tags:** compilation, precompilation, package-compiler
**Created:** [February 10, 2022, 12:56am UTC](https://discourse.julialang.org/t/exclude-packages-from-packagecompiler-create-app-precompilation/76134 "2022-02-10T00:56:32Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![bclyons12](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bclyons12/32/33734_2.png) [@bclyons12](https://discourse.julialang.org/u/bclyons12)
#### Post date: [February 10, 2022, 12:56am UTC](https://discourse.julialang.org/t/exclude-packages-from-packagecompiler-create-app-precompilation/76134/1 "2022-02-10T00:56:32Z")

</div>

Is there a way to avoid PackageCompiler.jl’s `create_app` compiling specific packages within a Project.toml?

I have a package I’m working on that includes Plots in the Project.toml for debugging and testing. Any calls to Plots (except the initial `import Plots`) is contained within if statements not executed by default. I’m using PackageCompiler.jl’s `create_app` to make an executable version of this package, but do not want the plotting functionality accessible through the executable. When I try to do this, `create_app` spends a large amount of time compiling the Plots package. How can I prevent this without removing Plots from the Project.toml? It looks like there’s a way to do this in `create_sysimage` but I don’t see the equivalent for an app.

---

<div class="post-metadata">

### Author: ![mike](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mike/32/39_2.png) [@mike](https://discourse.julialang.org/u/mike)
#### Post date: [February 10, 2022, 10:27am UTC](https://discourse.julialang.org/t/exclude-packages-from-packagecompiler-create-app-precompilation/76134/2 "2022-02-10T10:27:23Z")

</div>

`include_transitive_dependencies=false` might be what you’re needing there, if I’m understanding your requirement right. It should work for `create_app` as well as `create_sysimage`.

[https://github.com/JuliaLang/PackageCompiler.jl/blob/94fdba2b99b7f0d3be9906de831c1ca6a0091488/src/PackageCompiler.jl#L665-L667](https://github.com/JuliaLang/PackageCompiler.jl/blob/94fdba2b99b7f0d3be9906de831c1ca6a0091488/src/PackageCompiler.jl#L665-L667)

---

<div class="post-metadata">

### Author: ![bclyons12](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bclyons12/32/33734_2.png) [@bclyons12](https://discourse.julialang.org/u/bclyons12)
#### Post date: [February 11, 2022, 9:06pm UTC](https://discourse.julialang.org/t/exclude-packages-from-packagecompiler-create-app-precompilation/76134/3 "2022-02-11T21:06:27Z")

</div>

I don’t think that’s quite what I’m looking for. I tried using `include_transitive_dependencies=false` and removed all references to Plots in the package itself, except for the the `.toml` files. `create_app` still tries to put the Plots package and all the packages that it depends on into the sysimage.

---

<div class="post-metadata">

### Author: ![stefanjon](https://avatars.discourse-cdn.com/v4/letter/s/22d042/32.png) [@stefanjon](https://discourse.julialang.org/u/stefanjon)
#### Post date: [June 27, 2022, 1:00pm UTC](https://discourse.julialang.org/t/exclude-packages-from-packagecompiler-create-app-precompilation/76134/4 "2022-06-27T13:00:57Z")

</div>

I have a fairly similar situation where I have several packages that I only uses for testing.

The solution that I found to work the best is to have a separate project for testing that has the package as a dependency as well as all the other testing packages like plot. And when I build the app I use the package project. Of course for this to work you need to remove all mentions of Plots inside your package and only mention it in the test scripts.

---

<div class="post-metadata">

### Author: ![bclyons12](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bclyons12/32/33734_2.png) [@bclyons12](https://discourse.julialang.org/u/bclyons12)
#### Post date: [June 27, 2022, 9:15pm UTC](https://discourse.julialang.org/t/exclude-packages-from-packagecompiler-create-app-precompilation/76134/5 "2022-06-27T21:15:17Z")

</div>

Yes, I wound up doing something similar as a workaround, but definitely not ideal.
