# How to start writing a new Julia package?

**URL:** <https://discourse.julialang.org/t/how-to-start-writing-a-new-julia-package/2864>\
**Category:** General Usage\
**Tags:** package, github\
**Created:** [March 23, 2017, 5:13pm UTC](https://discourse.julialang.org/t/how-to-start-writing-a-new-julia-package/2864 "2017-03-23T17:13:22Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![sbohor3](https://avatars.discourse-cdn.com/v4/letter/s/b9bd4f/32.png) [@sbohor3](https://discourse.julialang.org/u/sbohor3)\
**Post date:** [March 23, 2017, 5:13pm UTC](https://discourse.julialang.org/t/how-to-start-writing-a-new-julia-package/2864/1 "2017-03-23T17:13:22Z")

</div>

@andreasnoack: OK. Thanks. I have a quick question. I am writing a Julia package for a stat method that we developed. Is there a good documentation/package to teach writing the package and share it? Thanks.

---

<div class="post-metadata">

**Author:** ![sbohor3](https://avatars.discourse-cdn.com/v4/letter/s/b9bd4f/32.png) [@sbohor3](https://discourse.julialang.org/u/sbohor3)\
**Post date:** [March 24, 2017, 3:55pm UTC](https://discourse.julialang.org/t/how-to-start-writing-a-new-julia-package/2864/2 "2017-03-24T15:55:24Z")

</div>

@andreasnoack: I wonder if there is a Julia package to help developers to write new Julia package of their own to share. Thanks.

---

<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:** [March 24, 2017, 4:00pm UTC](https://discourse.julialang.org/t/how-to-start-writing-a-new-julia-package/2864/3 "2017-03-24T16:00:54Z")

</div>

```julia
Pkg.add("PkgDev")
using PkgDev
PkgDev.generate("PackageName","MIT")

```

Turning that into a full package:

> **[Finalizing Your Julia Package: Documentation, Testing, Coverage, and...](http://www.stochasticlifestyle.com/finalizing-julia-package-documentation-testing-coverage-publishing/)**
>
> In this tutorial we will go through the steps to finalizing a Julia package. At this point you have some functionality you wish to share with the world... what do you do? You want to have documentation, code testing each time you commit (on all the...

(slightly old, but mostly minor syntax changes like Pkg → PkgDev)

---

<div class="post-metadata">

**Author:** ![sbohor3](https://avatars.discourse-cdn.com/v4/letter/s/b9bd4f/32.png) [@sbohor3](https://discourse.julialang.org/u/sbohor3)\
**Post date:** [March 24, 2017, 4:20pm UTC](https://discourse.julialang.org/t/how-to-start-writing-a-new-julia-package/2864/4 "2017-03-24T16:20:31Z")

</div>

Thanks. Is this the most common way that people currently follow to develop .jl package? Thanks.

---

<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:** [March 24, 2017, 4:25pm UTC](https://discourse.julialang.org/t/how-to-start-writing-a-new-julia-package/2864/5 "2017-03-24T16:25:39Z")

</div>

> [@Get columns of DataFrames.jl ModelMatrix object](https://discourse.julialang.org/t/get-columns-of-dataframes-jl-modelmatrix-object/2780/17):
>
> Thanks. Is this the most common way that people currently follow to develop .jl package? Thanks.

Yup. If you look around, you’ll see that they all have the same high-level file structure, CI (Travis and AppVeyor), documentation (Documenter.jl), and code coverage reporting. This post shows you the most standard way to enable all of those.

---

<div class="post-metadata">

**Author:** ![sbohor3](https://avatars.discourse-cdn.com/v4/letter/s/b9bd4f/32.png) [@sbohor3](https://discourse.julialang.org/u/sbohor3)\
**Post date:** [March 24, 2017, 4:26pm UTC](https://discourse.julialang.org/t/how-to-start-writing-a-new-julia-package/2864/6 "2017-03-24T16:26:58Z")

</div>

@ChrisRackauckas: Great. Thanks a lot.

---

<div class="post-metadata">

**Author:** ![sbohor3](https://avatars.discourse-cdn.com/v4/letter/s/b9bd4f/32.png) [@sbohor3](https://discourse.julialang.org/u/sbohor3)\
**Post date:** [March 24, 2017, 4:38pm UTC](https://discourse.julialang.org/t/how-to-start-writing-a-new-julia-package/2864/7 "2017-03-24T16:38:53Z")

</div>

@ChrisRackauckas: I already have a Github account. Do I need to do the following step in `git shell` to set up for package?

git config --global user.name "FULL NAME" git config --global user.email “EMAIL”  
$ git config --global github.user “USERNAME”

---

<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:** [March 24, 2017, 4:45pm UTC](https://discourse.julialang.org/t/how-to-start-writing-a-new-julia-package/2864/8 "2017-03-24T16:45:59Z")

</div>

Julia will pull environmental variables these in order to generate your package to be setup with a remote to your Github account.

Though my recommendation these days is to try GitKraken. It’s a GUI for Git. If you open it up, you can just sign in with your Github account and it’ll actually set this up. (After that, it’s a really good GUI for managing Git workflows).

---

<div class="post-metadata">

**Author:** ![sbohor3](https://avatars.discourse-cdn.com/v4/letter/s/b9bd4f/32.png) [@sbohor3](https://discourse.julialang.org/u/sbohor3)\
**Post date:** [March 24, 2017, 4:49pm UTC](https://discourse.julialang.org/t/how-to-start-writing-a-new-julia-package/2864/9 "2017-03-24T16:49:22Z")

</div>

@ChrisRackauckas: I use Windows application for GitHub to communicate to my Github account. Can I instead manually create a repo in GitHub, clone it to my computer, and do `Pkg.generate()` within that folder?

---

<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:** [March 24, 2017, 4:55pm UTC](https://discourse.julialang.org/t/how-to-start-writing-a-new-julia-package/2864/10 "2017-03-24T16:55:12Z")

</div>

No, I believe it needs the folder to not exist yet. A good way to do this instead is:

1. Create a blank repo with the right name on Github (needs the .jl)
2. `PkgDev.generate` the folder
3. `push` it to `origin` (it’ll be setup with your remote)

That should initialize the repo and give you a blank Julia package.

---

<div class="post-metadata">

**Author:** ![sbohor3](https://avatars.discourse-cdn.com/v4/letter/s/b9bd4f/32.png) [@sbohor3](https://discourse.julialang.org/u/sbohor3)\
**Post date:** [March 24, 2017, 5:06pm UTC](https://discourse.julialang.org/t/how-to-start-writing-a-new-julia-package/2864/11 "2017-03-24T17:06:09Z")

</div>

@ChrisRackauckas: Does `PkgDev.generate()` generates files in `.\pkgs-0.5.1.1\v0.5\pkgName`? Is that where we want to save the generated files?  
Thanks.

---

<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:** [March 24, 2017, 5:08pm UTC](https://discourse.julialang.org/t/how-to-start-writing-a-new-julia-package/2864/12 "2017-03-24T17:08:11Z")

</div>

Yes. Well, it’ll be in `.julia\v0.5\PkgName`. This is the load path Julia uses, so after that `using PkgName` will work.

(You’ll notice that all of the folders in there are actually git repos)

---

<div class="post-metadata">

**Author:** ![sbohor3](https://avatars.discourse-cdn.com/v4/letter/s/b9bd4f/32.png) [@sbohor3](https://discourse.julialang.org/u/sbohor3)\
**Post date:** [March 24, 2017, 5:13pm UTC](https://discourse.julialang.org/t/how-to-start-writing-a-new-julia-package/2864/13 "2017-03-24T17:13:46Z")

</div>

@ChrisRackauckas: Yes, they are all Git repos. Now, how do I easily push this folder to the Github repo that I created with the same PkgName.jl?

Another quick question. So, my package name is sAUC.jl. Is this name accepted in Julia community as package name? I  
Thanks.

---

<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:** [March 24, 2017, 5:21pm UTC](https://discourse.julialang.org/t/how-to-start-writing-a-new-julia-package/2864/14 "2017-03-24T17:21:48Z")

</div>

> [@sbohor3](#):
>
> Now, how do I easily push this folder to the Github repo that I created with the same PkgName.jl?

If you setup the environment variables before, it should already have origin set to your username/package name, in which case you just push origin. If not, you may need to set a remote for it. (Again, GitKraken is easiest for this if you aren’t comfortable with CLI Git)

> [@sbohor3](#):
>
> Another quick question. So, my package name is sAUC.jl. Is this name accepted in Julia community as package name?

[http://docs.julialang.org/en/release-0.5/manual/packages/#guidelines-for-naming-a-package](http://docs.julialang.org/en/release-0.5/manual/packages/#guidelines-for-naming-a-package)

I have no idea what that standards for, so that’s probably a sign that the answer is no.

---

<div class="post-metadata">

**Author:** ![sbohor3](https://avatars.discourse-cdn.com/v4/letter/s/b9bd4f/32.png) [@sbohor3](https://discourse.julialang.org/u/sbohor3)\
**Post date:** [March 24, 2017, 7:19pm UTC](https://discourse.julialang.org/t/how-to-start-writing-a-new-julia-package/2864/15 "2017-03-24T19:19:34Z")

</div>

@ChrisRackauckas : Thanks. sAUC stands for semi-parametric Area Under the Curve (sAUC). Thanks.

---

<div class="post-metadata">

**Author:** ![sbohor3](https://avatars.discourse-cdn.com/v4/letter/s/b9bd4f/32.png) [@sbohor3](https://discourse.julialang.org/u/sbohor3)\
**Post date:** [March 24, 2017, 7:41pm UTC](https://discourse.julialang.org/t/how-to-start-writing-a-new-julia-package/2864/16 "2017-03-24T19:41:17Z")

</div>

@ChrisRackauckas: Maybe, I may want to call it `SemiparametricAUC`. How do we handle uppercase abbreviations in package name?  
thanks.

---

<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:** [March 24, 2017, 7:44pm UTC](https://discourse.julialang.org/t/how-to-start-writing-a-new-julia-package/2864/17 "2017-03-24T19:44:14Z")

</div>

You might want to open up an issue here to talk about naming before you get set on one.

[https://github.com/JuliaLang/METADATA.jl/issues](https://github.com/JuliaLang/METADATA.jl/issues)

Usually this stuff comes up when someone is registering the package for the first time, but opening an issue and getting it squared away for is probably a better idea.

---

<div class="post-metadata">

**Author:** ![sbohor3](https://avatars.discourse-cdn.com/v4/letter/s/b9bd4f/32.png) [@sbohor3](https://discourse.julialang.org/u/sbohor3)\
**Post date:** [March 24, 2017, 10:12pm UTC](https://discourse.julialang.org/t/how-to-start-writing-a-new-julia-package/2864/18 "2017-03-24T22:12:12Z")

</div>

@ChrisRackauckas: Can you explain this **install mkdocs** step a bit more? [Finalizing Your Julia Package: Documentation, Testing, Coverage, and Publishing - Stochastic Lifestyle](http://www.stochasticlifestyle.com/finalizing-julia-package-documentation-testing-coverage-publishing/)

---

<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:** [March 24, 2017, 10:18pm UTC](https://discourse.julialang.org/t/how-to-start-writing-a-new-julia-package/2864/19 "2017-03-24T22:18:54Z")

</div>

Oh, that’s a little old now. Instead I’d recommend doing the mkdocs-free version. It’s described here. Everything is the same except the make.jl file and the way you setup the hosting (but it’s very similar)

[https://juliadocs.github.io/Documenter.jl/latest/man/hosting.html](https://juliadocs.github.io/Documenter.jl/latest/man/hosting.html)

---

<div class="post-metadata">

**Author:** ![sbohor3](https://avatars.discourse-cdn.com/v4/letter/s/b9bd4f/32.png) [@sbohor3](https://discourse.julialang.org/u/sbohor3)\
**Post date:** [March 24, 2017, 10:30pm UTC](https://discourse.julialang.org/t/how-to-start-writing-a-new-julia-package/2864/20 "2017-03-24T22:30:16Z")

</div>

> [@ChrisRackauckas](#):
>
> Instead I’d recommend doing the mkdocs-free version

Sorry, what do you mean by “mkdocs-free version” here?

[Next page](https://discourse.julialang.org/t/how-to-start-writing-a-new-julia-package/2864.md?page=2)
