# Revise, Pkg, PkgTemplates, PkgSkeleton and smooth Julia package development

**URL:** <https://discourse.julialang.org/t/revise-pkg-pkgtemplates-pkgskeleton-and-smooth-julia-package-development/95608>\
**Category:** New to Julia\
**Tags:** question, package, development, revise\
**Created:** [March 6, 2023, 12:35pm UTC](https://discourse.julialang.org/t/revise-pkg-pkgtemplates-pkgskeleton-and-smooth-julia-package-development/95608 "2023-03-06T12:35:42Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![johannesnauta](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/johannesnauta/32/47434_2.png) [@johannesnauta](https://discourse.julialang.org/u/johannesnauta)\
**Post date:** [March 6, 2023, 12:35pm UTC](https://discourse.julialang.org/t/revise-pkg-pkgtemplates-pkgskeleton-and-smooth-julia-package-development/95608/1 "2023-03-06T12:35:42Z")

</div>

Hi all. After having used Python extensively for the last 4-5 years, I am now switching to Julia both out of interest and for performance reasons. I am now actively learning to master the REPL-focused Julia development cycle. Development is made much faster and enjoyable using [`Revise.jl`](https://timholy.github.io/Revise.jl/stable/), however I find that my current workflow does not integrate well with `Revise.jl` and that I need to work on package development instead.

**The project**  
I have a project, as a Git repository, with the following `tree` structure

```bash
ProjectName/
├── README.md
├── src
│ ├── MainModule.jl
│ ├── Submodule.jl
├── docs
│ ├── make.jl
│ └── src
│ └── index.md
├── examples
│ ├── README.md
│ ├── example.jl
└── tests
    └── test.jl

```

File contents of `Submodule.jl` are, for example:

```julia
module Submodule
export AnotherFunction

function AnotherFunction()
    println("This is another function")
end
end # End module

```

File contents of MainModule.jl are, for example:

```julia
module MainModule

include("Submodule.jl")
using .Submodule

export SomeFunction

function SomeFunction()
    println("This is a function")
    Submodule.AnotherFunction()
end
end # End module

```

**The problem**  
The problem is that changes in `Submodule.jl` are not tracked when using `Revise.jl`

```julia
julia> using Revise
julia> includet("MainModule.jl"); using .MainModule

```

Reading different topics (both here and on, e.g., StackExchange) recommend that instead of using the `includet()` command I switch to making `MainModule` a package instead. While most examples using [`PkgTemplates.jl`](https://github.com/JuliaCI/PkgTemplates.jl), `PkgSkeleton`, or even the standard [`Pkg.jl`] all work fine, I cannot seem to figure out how to add `Submodule` to the package. Most examples out there also do not include the inclusion of separate Julia files (like `Submodule.jl` in this case).

I highly prefer to not make `Submodule` a separate package such that it can be imported, but I **do** need `Revise.jl` to track changes in `Submodule.jl`.

**Question**  
How do I make a bare-bones package that allows `Revise.jl` to track all included files as well?

- If possible, I prefer the “Package” to be as bare bones as possible. I do not want automated Git workflow (I do this myself), I do not (yet) want to publish the package to the Julia repository, etc. I **only** want `Revise.jl` to track all included files.
- Is there a change in mindset that I have to undergo? Should I always aim to develop packages that have to be pushed to the main Julia repository such that others can use it as well? Should I let the Julia package manager handle my Git workflow? Or is there something else I am not seeing at the moment?
- What specific commands do I need to run (in the Julia REPL) to use and develop my `MainModule`?

Thank you for all the help you can offer.

---

<div class="post-metadata">

**Author:** ![lmiq](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/lmiq/32/18314_2.png) [@lmiq](https://discourse.julialang.org/u/lmiq)\
**Post date:** [March 6, 2023, 12:45pm UTC](https://discourse.julialang.org/t/revise-pkg-pkgtemplates-pkgskeleton-and-smooth-julia-package-development/95608/3 "2023-03-06T12:45:59Z")

</div>

Sorry, deleted it because you need to create an actual id to things work correctly. The easiest way is really just to use PkgTemplates. A very quick step-by-step is here: [Create new package · JuliaNotes.jl](https://m3g.github.io/JuliaNotes.jl/stable/new_package/)

If you do not want any of the github actions, just delete the `.github` directory. But I don’t see any reason to do so, really, it can’t do any harm.

---

<div class="post-metadata">

**Author:** ![GunnarFarneback](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gunnarfarneback/32/1827_2.png) [@GunnarFarneback](https://discourse.julialang.org/u/GunnarFarneback)\
**Post date:** [March 6, 2023, 1:01pm UTC](https://discourse.julialang.org/t/revise-pkg-pkgtemplates-pkgskeleton-and-smooth-julia-package-development/95608/4 "2023-03-06T13:01:47Z")

</div>

> [@johannesnauta](#):
>
> How do I make a bare-bones package that allows `Revise.jl` to track all included files as well?
> 
> - If possible, I prefer the “Package” to be as bare bones as possible. I do not want automated Git workflow (I do this myself), I do not (yet) want to publish the package to the Julia repository, etc. I **only** want `Revise.jl` to track all included files.

This might be somewhat helpful to answer that particular question: [https://github.com/GunnarFarneback/LocalRegistry.jl/blob/tutorial/docs/tutorials/create\_minimal\_package.md](https://github.com/GunnarFarneback/LocalRegistry.jl/blob/tutorial/docs/tutorials/create_minimal_package.md)

> - Is there a change in mindset that I have to undergo? Should I always aim to develop packages that have to be pushed to the main Julia repository such that others can use it as well?

That’s not necessary at all. If you start to develop many interdependent private packages you might want to consider making your own registry, but that’s absolutely not an immediate concern.

> Should I let the Julia package manager handle my Git workflow? Or is there something else I am not seeing at the moment?

The package manager can’t help you that much with Git workflows.

> - What specific commands do I need to run (in the Julia REPL) to use and develop my `MainModule`?

In most cases I do like this:

1. `cd path/to/my/package`
2. `julia --project`
3. `julia> using Revise, MyPackage`

This critically requires that you have a `Project.toml` file and the basic file structure described in the earlier link.

---

<div class="post-metadata">

**Author:** ![johannesnauta](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/johannesnauta/32/47434_2.png) [@johannesnauta](https://discourse.julialang.org/u/johannesnauta)\
**Post date:** [March 6, 2023, 1:38pm UTC](https://discourse.julialang.org/t/revise-pkg-pkgtemplates-pkgskeleton-and-smooth-julia-package-development/95608/5 "2023-03-06T13:38:37Z")

</div>

Thanks for the minimal example, that made it work. I believe I initially forgot the dot `.` before using the submodule (i.e. `using .Submodule`), which made `Pkg` unaware of the submodules existence.

> The package manager can’t help you that much with Git workflows.

It appears I was wrong in assuming that `PkgTemplates` handled all the Git-related tasks as well, as they have quite some extensive documentation and configuration on the Git side. Can you actually run Git commands using `PkgTemplates`? Or is it just for versioning when eventually publishing the package?

> `julia --project`

What is the `--project` doing in this context?

---

<div class="post-metadata">

**Author:** ![GunnarFarneback](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gunnarfarneback/32/1827_2.png) [@GunnarFarneback](https://discourse.julialang.org/u/GunnarFarneback)\
**Post date:** [March 6, 2023, 2:00pm UTC](https://discourse.julialang.org/t/revise-pkg-pkgtemplates-pkgskeleton-and-smooth-julia-package-development/95608/6 "2023-03-06T14:00:51Z")

</div>

I don’t use `PkgTemplates`, so don’t have much insight, but my understanding is that it just gives you a package structure according to some template. That template might include files which configure how GitHub should behave in case you host it there, but that’s a GitHub thing.

> [@johannesnauta](#):
>
> What is the `--project` doing in this context?

Approximately the same as `Pkg.activate`.

---

<div class="post-metadata">

**Author:** ![airpmb](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/airpmb/32/7826_2.png) [@airpmb](https://discourse.julialang.org/u/airpmb)\
**Post date:** [March 6, 2023, 2:08pm UTC](https://discourse.julialang.org/t/revise-pkg-pkgtemplates-pkgskeleton-and-smooth-julia-package-development/95608/7 "2023-03-06T14:08:49Z")

</div>

> [@johannesnauta](#):
>
> What is the `--project` doing in this context?

Quoting the docs:

`--project[={<dir>|@.}]` Set `<dir>` as the home project/environment. The default `@.` option will search through parent directories until a `Project.toml` or `JuliaProject.toml` file is found.

[https://docs.julialang.org/en/v1/manual/command-line-options/#Command-line-switches-for-Julia](https://docs.julialang.org/en/v1/manual/command-line-options/#Command-line-switches-for-Julia)

---

<div class="post-metadata">

**Author:** ![TheCedarPrince](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/thecedarprince/32/17323_2.png) [@TheCedarPrince](https://discourse.julialang.org/u/TheCedarPrince)\
**Post date:** [March 6, 2023, 3:23pm UTC](https://discourse.julialang.org/t/revise-pkg-pkgtemplates-pkgskeleton-and-smooth-julia-package-development/95608/8 "2023-03-06T15:23:46Z")

</div>

Hey @johannesnauta !

Warm welcome to the Julia Community and happy to hear about the packages you are developing! 👋

One additional thing to keep in mind is that if you want to develop tests, I drafted some guidance on how to create a testing workflow: [Unit Testing · The Julia Language](https://docs.julialang.org/en/v1.9-dev/stdlib/Test/#Workflow-for-Testing-Packages)

Hope it helps and see you around!

~ tcp 🌳
