# Pkg App + Extensions

**URL:** <https://discourse.julialang.org/t/pkg-app-extensions/142977>\
**Category:** General Usage\
**Tags:** app, package-extensions\
**Created:** [November 16, 2026, 1:45pm UTC](https://discourse.julialang.org/t/pkg-app-extensions/142977 "2026-11-16T13:45:10Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![BSchilperoort](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bschilperoort/32/216895_2.png) [@BSchilperoort](https://discourse.julialang.org/u/BSchilperoort)\
**Post date:** [November 16, 2026, 1:45pm UTC](https://discourse.julialang.org/t/pkg-app-extensions/142977/1 "2026-11-16T13:45:10Z")

</div>

For a numerical model we use KernelAbstractions for GPU accelerated code. To support every backend we make use of [extensions](https://pkgdocs.julialang.org/v1/creating-packages/#Conditional-loading-of-code-in-packages-(Extensions)), so that a user with an AMD GPU does not need to install and precompile CUDA packages (for example).

We would also like a simple command line setup instead of scripts/eval, to ensure that Julia is launched with multiple threads by default, and that the right backend is loaded. This would allow users to call the model with:

```julia-auto
modelapp path/to/config -b CUDA

```

Which experiments more reproducible and less error prone (if CUDA or NVIDIA GPU isn’t available the CLI will return an error).

The [Pkg App](https://pkgdocs.julialang.org/v1/apps/) system allows for creating a command line interface for a package. However, this does not seem to work well with extensions, as the app is part of the main module.

Has anyone else run into this issue?

The most viable solution/workaround seems to be to create a separate package with _only_ the CLI app, which has the model as a dependency and loads the backend from the general environment before the model code is imported.
