# Julia Packages and Github

**URL:** <https://discourse.julialang.org/t/julia-packages-and-github/26196>\
**Category:** New to Julia\
**Created:** [July 9, 2019, 6:13pm UTC](https://discourse.julialang.org/t/julia-packages-and-github/26196 "2019-07-09T18:13:25Z")\
**Posts on this page:** 18\
**Page:** 1

<div class="post-metadata">

**Author:** ![Henrique\_Becker](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/henrique_becker/32/15443_2.png) [@Henrique\_Becker](https://discourse.julialang.org/u/Henrique_Becker)\
**Post date:** [July 9, 2019, 6:13pm UTC](https://discourse.julialang.org/t/julia-packages-and-github/26196/1 "2019-07-09T18:13:25Z")

</div>

I am interested in creating a GitHub repository for part of my PhD. The repository will be mostly Julia code that can be shipped as a package, but will also contain a latex directory for writing a paper related to the code (as some other folders that are not needed for someone that just want to install the package). My question is: the Julia package structure must be at the root of the github repository (and the ‘latex’ folder will be copied when someone install the package), or the package folder (that contains `src`, `test`, etc…) can be at an arbitrary level inside the github repository and there will be no problem for shipping the package after (just give the github url path to the specific folder)?

---

<div class="post-metadata">

**Author:** ![StefanKarpinski](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stefankarpinski/32/24_2.png) [@StefanKarpinski](https://discourse.julialang.org/u/StefanKarpinski)\
**Post date:** [July 9, 2019, 11:31pm UTC](https://discourse.julialang.org/t/julia-packages-and-github/26196/2 "2019-07-09T23:31:47Z")

</div>

A package can be located at any folder in the repo.

---

<div class="post-metadata">

**Author:** ![kevbonham](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kevbonham/32/216165_2.png) [@kevbonham](https://discourse.julialang.org/u/kevbonham)\
**Post date:** [July 10, 2019, 12:58am UTC](https://discourse.julialang.org/t/julia-packages-and-github/26196/3 "2019-07-10T00:58:23Z")

</div>

Are you planning for others to install and use your package, or is it just for documenting analysis code? If the former, I would eventually separate that repo from your thesis repo and register it as a standalone. While you’re first working on it, it could make sense to keep it all together so you don’t have to worry about it, but eventually you’ll want to have a stable version of the code for everything in the thesis, and using a Project and Manifest makes documenting which version of code was used easy.

If the latter, it’s easy to just keep it all together as a single project.

---

<div class="post-metadata">

**Author:** ![Henrique\_Becker](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/henrique_becker/32/15443_2.png) [@Henrique\_Becker](https://discourse.julialang.org/u/Henrique_Becker)\
**Post date:** [July 10, 2019, 1:08am UTC](https://discourse.julialang.org/t/julia-packages-and-github/26196/4 "2019-07-10T01:08:35Z")

</div>

Ideally I want any person to be able to install the code module as a package, even if using the git URL to the specific folder instead of having a package registered in the General Registry.

> [@kevbonham](#):
>
> While you’re first working on it, it could make sense to keep it all together so you don’t have to worry about it, but eventually you’ll want to have a stable version of the code for everything in the thesis, and using a Project and Manifest makes documenting which version of code was used easy.

This comment makes no sense to me. I want to know if (1) I should have a entire github repo just for the code or (2) I can have a repo for the both the code and related materials, keep all the package structure inside a folder (instead of the repository root), and pass the folder URL for anyone interested in installing the package. I already have a Project and Manifest and I have the package structure inside a folder, one thing does not conflict with the other, at no moment I considered not having a Project or Manifest.

---

<div class="post-metadata">

**Author:** ![Raf](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/raf/32/3383_2.png) [@Raf](https://discourse.julialang.org/u/Raf)\
**Post date:** [July 10, 2019, 1:44am UTC](https://discourse.julialang.org/t/julia-packages-and-github/26196/5 "2019-07-10T01:44:25Z")

</div>

Most of my work is like this. A package for reuse and a project that depends on the package for preparing a paper.

If you want people to use your package, it has to be in its own git repo. Which shouldn’t have other random stuff in it. It shouldn’t have a manifest, just a Project.toml

Put your thesis project in another git repo, and depend on the package in its Project.toml and Manifest.toml.

---

<div class="post-metadata">

**Author:** ![Nosferican](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nosferican/32/9275_2.png) [@Nosferican](https://discourse.julialang.org/u/Nosferican)\
**Post date:** [July 10, 2019, 1:54am UTC](https://discourse.julialang.org/t/julia-packages-and-github/26196/6 "2019-07-10T01:54:54Z")

</div>

For my dissertation I used Julia for my articles. First, you should decide whether the project is a package or an application.

> 1. **Project** is an umbrella term: packages and applications are kinds of projects.
> 2. **Packages** should have UUIDs, applications can have a UUIDs but don’t need them.
> 3. **Applications** can provide global configuration, whereas packages cannot.

Two of my articles were applications. Those were studies which used Julia and the code is packaged together to allow for reproducibility / transparency. The third chapter was a package. Currently it is being reviewed for JuliaCon proceedings so the paper is in the repository (i.e., `paper/paper.tex`). For applications, I usually have the project under `code/ApplicationName/Project.toml`).

So what are the benefits/drawbacks? For an application, the code and paper should most likely be together in the same repository (e.g., figures are generated from the code and placed in the relevant directory). For a package, it depends. CRAN, R’s registry, usually have vignettes and manuals saved and downloaded when a package is installed since it is beneficial for the package users. The paper serves an additional documentation role. If the paper does not serve a documentation role or it is not complimentary to the code, it could be hosted in a separate repository with link to the code repository.

A few things on having the paper and code together:

1. it will likely change the major programming of the repository (i.e., instead of a Julia repository it might be a TeX repository; might not be the best for convincing GitHub to treat Julia better)
2. the additional files will be download with every installation by the users (there isn’t a convenience function for accessing the paper so most users will not have access to it and will be just taking space). It would change if Julia develops a convenience utility for accessing those materials like other languages, but currently users would likely have to access the remote to get access to it directly.

---

<div class="post-metadata">

**Author:** ![Henrique\_Becker](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/henrique_becker/32/15443_2.png) [@Henrique\_Becker](https://discourse.julialang.org/u/Henrique_Becker)\
**Post date:** [July 10, 2019, 2:02am UTC](https://discourse.julialang.org/t/julia-packages-and-github/26196/7 "2019-07-10T02:02:19Z")

</div>

@StefanKarpinski Everyone else seems to be saying that I need the whole repo for the package (what is the default). To have the package inside a folder of the repo I just need to have the structure inside the folder instead of the root? It will play nice with any tools made to install packages and work with packages?

---

<div class="post-metadata">

**Author:** ![StefanKarpinski](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stefankarpinski/32/24_2.png) [@StefanKarpinski](https://discourse.julialang.org/u/StefanKarpinski)\
**Post date:** [July 10, 2019, 3:25am UTC](https://discourse.julialang.org/t/julia-packages-and-github/26196/8 "2019-07-10T03:25:28Z")

</div>

A package version is just a tree hash which can be anywhere in a repo. But a lot of the tooling doesn’t handle that yet, so it will be a bit rough for now, but it’s a use case that we will support.

---

<div class="post-metadata">

**Author:** ![Henrique\_Becker](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/henrique_becker/32/15443_2.png) [@Henrique\_Becker](https://discourse.julialang.org/u/Henrique_Becker)\
**Post date:** [July 10, 2019, 3:48am UTC](https://discourse.julialang.org/t/julia-packages-and-github/26196/9 "2019-07-10T03:48:34Z")

</div>

Thank you for explaining that. This is a bit of information that is  
easier to get from an human being than by search alone.

---

<div class="post-metadata">

**Author:** ![Tamas\_Papp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tamas_papp/32/25949_2.png) [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Post date:** [July 10, 2019, 5:29am UTC](https://discourse.julialang.org/t/julia-packages-and-github/26196/10 "2019-07-10T05:29:04Z")

</div>

> [@Henrique\_Becker](#):
>
> (1) I should have a entire github repo just for the code or (2) I can have a repo for the both the code and related materials, keep all the package structure inside a folder (instead of the repository root), and pass the folder URL for anyone interested in installing the package.

You can have either. For packages that need more intricate documentation using equations, I keep a subfolder in `docs/` for \LaTeX code, and occasionally even compile it for CI.

I would just start things in the same repository, you can always split later.

---

<div class="post-metadata">

**Author:** ![johnh](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/johnh/32/3615_2.png) [@johnh](https://discourse.julialang.org/u/johnh)\
**Post date:** [July 10, 2019, 7:20am UTC](https://discourse.julialang.org/t/julia-packages-and-github/26196/11 "2019-07-10T07:20:19Z")

</div>

@Henrique_Becker if you are not aware of it already this package genwerates Latex from Julia objects:

> **[GitHub - korsbo/Latexify.jl: Convert julia objects to LaTeX equations, arrays...](https://github.com/korsbo/Latexify.jl)**
>
> Convert julia objects to LaTeX equations, arrays or other environments. - GitHub - korsbo/Latexify.jl: Convert julia objects to LaTeX equations, arrays or other environments.

---

<div class="post-metadata">

**Author:** ![DoktorMike](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/doktormike/32/2736_2.png) [@DoktorMike](https://discourse.julialang.org/u/DoktorMike)\
**Post date:** [July 10, 2019, 8:55am UTC](https://discourse.julialang.org/t/julia-packages-and-github/26196/12 "2019-07-10T08:55:25Z")

</div>

That’s super useful. 🙏

---

<div class="post-metadata">

**Author:** ![korsbo](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/korsbo/32/15942_2.png) [@korsbo](https://discourse.julialang.org/u/korsbo)\
**Post date:** [July 11, 2019, 9:54am UTC](https://discourse.julialang.org/t/julia-packages-and-github/26196/13 "2019-07-11T09:54:19Z")

</div>

I tend to use [git submodules](https://git-scm.com/docs/git-submodule) to keep a projects code/results together with the latex documents. That way, you can treat the project as one whole when that makes sense and as separate entities when it does not.

Edit: a better [git submodules link](https://git-scm.com/docs/gitsubmodules).

---

<div class="post-metadata">

**Author:** ![zot](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/zot/32/5817_2.png) [@zot](https://discourse.julialang.org/u/zot)\
**Post date:** [October 24, 2019, 1:50pm UTC](https://discourse.julialang.org/t/julia-packages-and-github/26196/14 "2019-10-24T13:50:48Z")

</div>

I have a project that should include packages for several different languages (back end code), along with some common artifacts (front end things HTML, JS, and CSS).

@StefanKarpinski, is there a way to handle this in Julia? Ideally I’d like a directory structure like this:

```nohighlight
Git-repository
    |
    |-- html/ (artifacts used by packages in various languages)
    |-- julia/ (julia code in here, along with Project.toml, Manifest.toml, and Artifacts.toml)
    +-- (directories for other languages)

```

I don’t see way to put a git-tree reference to `html/` in the _ **current package** _ (wherever it happens to be hosted) into` Artifacts.toml`. Do you have to hard-code the repository URL to do this?

It seems like this even if there was a way to refer to a git-tree in the current package, we still have to wait for [`PackageSpec` to allow subdirectories](https://github.com/JuliaLang/Pkg.jl/pull/1422) and for [`Registrator.jl` to handle subdirectories](https://github.com/JuliaRegistries/Registrator.jl/issues/230).

---

<div class="post-metadata">

**Author:** ![kevbonham](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kevbonham/32/216165_2.png) [@kevbonham](https://discourse.julialang.org/u/kevbonham)\
**Post date:** [October 25, 2019, 1:57am UTC](https://discourse.julialang.org/t/julia-packages-and-github/26196/15 "2019-10-25T01:57:07Z")

</div>

> [@zot](#):
>
> I have a project that should include packages for several different languages (back end code), along with some common artifacts

It might be worth starting a new post with this question, especially considering the last post on this topic was 4 months ago.

Separately, is there a reason you tagged Stefan? It’s usually considered bad form to tag people unless they’re really the only person that can answer your question.

---

<div class="post-metadata">

**Author:** ![zot](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/zot/32/5817_2.png) [@zot](https://discourse.julialang.org/u/zot)\
**Post date:** [November 1, 2019, 12:55pm UTC](https://discourse.julialang.org/t/julia-packages-and-github/26196/16 "2019-11-01T12:55:46Z")

</div>

Huh, I’ve never heard that it’s considered bad form. I’ve been tagged many, many times in discussion groups when I was obviously not the only person who could answer a question.

---

<div class="post-metadata">

**Author:** ![zot](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/zot/32/5817_2.png) [@zot](https://discourse.julialang.org/u/zot)\
**Post date:** [November 1, 2019, 1:08pm UTC](https://discourse.julialang.org/t/julia-packages-and-github/26196/17 "2019-11-01T13:08:57Z")

</div>

I made a new post [here](https://discourse.julialang.org/t/julia-packages-peacefully-coexisting-in-multi-language-github-projects/30582).

---

<div class="post-metadata">

**Author:** ![kevbonham](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kevbonham/32/216165_2.png) [@kevbonham](https://discourse.julialang.org/u/kevbonham)\
**Post date:** [November 1, 2019, 6:41pm UTC](https://discourse.julialang.org/t/julia-packages-and-github/26196/18 "2019-11-01T18:41:07Z")

</div>

> [@zot](#):
>
> Huh, I’ve never heard that it’s considered bad form.

Fair enough. I don’t think anyone will hold it against you 🙂. And it’s possible I’m speaking it off turn here, but I think that’s been discussed here before.

Especially for the language creators and core devs - they have a lot of demands on their time (and are pretty generous about spending their time on the community), so adding to their cognitive load isn’t great.
