# Running examples from a cloned package

**URL:** https://discourse.julialang.org/t/running-examples-from-a-cloned-package/4539
**Category:** General Usage
**Created:** [June 29, 2017, 11:30am UTC](https://discourse.julialang.org/t/running-examples-from-a-cloned-package/4539 "2017-06-29T11:30:22Z")
**Posts on this page:** 1
**Showing post:** 6

<div class="post-metadata">

### Author: ![ChrisRackauckas](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/chrisrackauckas/32/77_2.png) [@ChrisRackauckas](https://discourse.julialang.org/u/ChrisRackauckas)
#### Post date: [June 29, 2017, 2:46pm UTC](https://discourse.julialang.org/t/running-examples-from-a-cloned-package/4539/6 "2017-06-29T14:46:21Z")

</div>

> [@PetrKryslUCSD](#):
>
> The question is how does the user access these examples from the REPL?

> [@PetrKryslUCSD](#):
>
> For a predecessor of the current package I used to have the examples in a separate repo. It seems that @ChrisRackauckas is saying that that is how he would do things. Any opinions from anyone else?

I was just giving examples of how people generally do things because there is no general framework. If you’re looking for some “project” as opposed to “package” workflow which runs examples that are not tests, it doesn’t exist (yet). Here are some previous discussions:

> [@Distinguishing projects from packages](https://discourse.julialang.org/t/distinguishing-projects-from-packages/153):
>
> old title: "Extending PkgDev.jl to Project Generation" edit: the title was changed to reflect what gets discussed. however this starting post (below) remains unedited to highlight the question that provoked it From [PkgDev](https://github.com/JuliaLang/PkgDev.jl)’s description, PkgDev.jl provides a set of tools for a developer to create, maintain and register packages in Julia package How could this tool be extended to generating projects? This necessitates a distinction between projects and packages. Projects being the cod…

> <https://github.com/JuliaLang/Juleps/issues/20>
>
> \[Over\](https://discourse.julialang.org/t/distinguishing-projects-from-packages/1…53) in discourse it was discussed to distinguish between "runnable packages" (called projects in that thread) and "library packages" (called packages). The \[suggestion\](https://discourse.julialang.org/t/distinguishing-projects-from-packages/153/35?u=mauro3) which gathered the most likes was not to distinguish between projects and packages, but instead to "standardize where to put runnable scripts into packages as we know them now. Say a folder \`run/\` or \`scripts/\` and the main program would be \`run/main.jl\`. Pure "Projects" would have an empty \`src/\` folder and full \`run/\` folder and vice versa (most would have a bit of both). Similar to \`Pkg.test("SomePkg")\` we could have a \`Pkg.run("SomePkg")\` to \`run run/main.jl\`." Also a command-line option could be good, say \`julia --run SomePkg\`. 
> 
> (I haven't followed this Julep too closely, please close this issue if this is in it already. Or let me know if this should be posted over in Julia itself.)

It would be easy to writeup a package which uses the `examples` folder in the Git repository to make something like:

```julia
# Run v0.x/MyProject/examples/Example1.jl with variable plot_solutions = true
Project.run("MyProject","Example1",plot_solutions = true) 
# Run it in test mode: throws errors with `@test` fails
# Not part of CI, could take a long time or need extra resources
Project.test("MyProject","Example1") time!

```

I was against this before, but I can see it being useful enough to call for inclusion into Base/Pkg3 sooner or later. That would give you what you want.

---

_[View the full topic](https://discourse.julialang.org/t/running-examples-from-a-cloned-package/4539)._
