Nested environments in package

Hi,
I have a package with the usual structure, but I also have examples here, because I believe runnable code is more useful than snippets in md.
So the structure is something like

- examples/
- src/
- test/
  - Project.toml
- Project.toml

the Project.toml is there accoring to the Pkg docs: 5. Creating Packages · Pkg.jl
and I really like the notion of nested directories where test has some additional dependencies next to the project itself.

And my question is: how to achieve the same thing with examples?
So I would have a Project.toml in examples with some additional dependencies needed to run them, but not needed in the package itself.
Is there a way to do it?
So far I didn’t figure anything out, and having a separate repo for examples which is just few (2-3 scripts) seems like an overkil, but I’m open to any solution that would let me specify the deps for examples without flodding the library itself with garbage.

1 Like

What I do is ( pwd is the project folder )

pkg> activate examples
pkg> dev <Name of the Module>
pkg> add <Additional dependencies>

This will create the Project and Manifest-files in the examples directory.

3 Likes

Thanks, I tried that, but this package I’m working on is not in registry yet, so the dev <package> crashed.
I would like to use the source code I have in the project, not download it again.

It shouldn’t need to be registered. Try giving a path, maybe even pkg> dev . could work.

4 Likes

Also look at this related thread:

Some of the (sometimes prospective) solutions mentioned there might be of some interest to you:

3 Likes

Thanks, with dev . it worked exactly as I wanted.