# Adding examples into a Julia package

**URL:** <https://discourse.julialang.org/t/adding-examples-into-a-julia-package/69476>\
**Category:** New to Julia\
**Tags:** package\
**Created:** [October 9, 2021, 2:42pm UTC](https://discourse.julialang.org/t/adding-examples-into-a-julia-package/69476 "2021-10-09T14:42:16Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![venuur](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/venuur/32/6493_2.png) [@venuur](https://discourse.julialang.org/u/venuur)\
**Post date:** [October 9, 2021, 2:42pm UTC](https://discourse.julialang.org/t/adding-examples-into-a-julia-package/69476/1 "2021-10-09T14:42:16Z")

</div>

I’ve created a minimally useful package (a small library for creating plain text formatted exercise routines, [GitHub Link](https://github.com/venuur/FiveThreeOne.jl)). There’s still some work to clean it up before I register, and one thing I want to do is add an example script showing its usage. What is a good approach for including that script in the repo without causing any trouble with the package structure?

Unfortunately, I only loosely understand what part of the structure are essential to ensure the package imports and builds correctly. I used PkgTemplate, but I’m thinking I need to read deeper to understand everything.

---

<div class="post-metadata">

**Author:** ![PetrKryslUCSD](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/petrkryslucsd/32/215825_2.png) [@PetrKryslUCSD](https://discourse.julialang.org/u/PetrKryslUCSD)\
**Post date:** [October 9, 2021, 3:32pm UTC](https://discourse.julialang.org/t/adding-examples-into-a-julia-package/69476/2 "2021-10-09T15:32:15Z")

</div>

Been there myself. I decided to include examples with my package. For instance, [FinEtoolsFlexBeams.jl](https://github.com/PetrKryslUCSD/FinEtoolsFlexBeams.jl/tree/master/examples).  
But I also have made specialized tutorial packages that go with the packages providing the functionality. E.g. [FinEtoolsFlexBeamsTutorials.jl](https://github.com/PetrKryslUCSD/FinEtoolsFlexBeamsTutorials.jl), which goes with [FinEtoolsFlexBeams.jl](https://github.com/PetrKryslUCSD/FinEtoolsFlexBeams.jl/tree/master/examples).

Adding examples does not spoil the structure of the package as viewed by the user, but the examples are not easily accessible if the packaged is `add`ed rather than `dev`ed. Hence the tutorial packages, which are not registered, and need to be `clone`d to user’s disk space instead of the Julia depot.
