Adding examples into a Julia package

I’ve created a minimally useful package (a small library for creating plain text formatted exercise routines, GitHub Link). 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.

Been there myself. I decided to include examples with my package. For instance, FinEtoolsFlexBeams.jl.
But I also have made specialized tutorial packages that go with the packages providing the functionality. E.g. FinEtoolsFlexBeamsTutorials.jl, which goes with FinEtoolsFlexBeams.jl.

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 added rather than deved. Hence the tutorial packages, which are not registered, and need to be cloned to user’s disk space instead of the Julia depot.

1 Like