Making a Package, 2 questions

Hi everyone,

In my spare time I’ve been working on a package in Julia for Chemometrics (GitHub - caseykneale/ChemometricsTools.jl: A collection of tools for chemometrics and machine learning written in Julia. ). It’s basically a machine learning library (K-NN, naive bayes, LDA, CART trees, random forests, PLS, PCA/PCR, logistic regression, ridge, kernel ridge, lssvms, elms, echo state networks, nmf, nnls, etc… ) with specialized tools for chemical data. The package isn’t ready for prime-time yet, but it’s getting closer every day. Looking ahead I have some questions,

  1. How do I go about getting the package registered so users can simply Pkg.add it? I want to draw some chemometricians to Julia because … it’s the way of the future and datascience code in Julia has the highest throughput I’ve ever worked with …

  2. How do people create fancy documentation (see Flux.jl), any good tutorials? I’m a one man team so the simpler the better.

Thanks for your time,
Casey

1 Like
  1. By far the easiest and preferred way is to use attobot: https://github.com/attobot/attobot. Note that your package will (unfortunately, still) need a REQUIRE file to be registered (see Current best practices for depencency management for registered packages). Also make sure your package’s UUID is the one you get from Pkg.METADATA_compatible_uuid("ChemometricsTools"). It’s also a good idea to at least add some basic tests, and not having any continuous integration set up would be pretty unique among registered packages, so do consider setting that up as well.
  2. Use https://github.com/JuliaDocs/Documenter.jl.
7 Likes

Thanks so much tkoolen, once I wrangle up some unit tests and things I’ll definitely press forward with registering. Thanks for the JuliaDocs tip I didn’t know that project existed!

So I’ve added unit tests and started making Docs with Documenter.jl . Really impressed it was painless. This may be more of a github question but how do people get those fancy buttons that say whether the code is passing tests, or where the docs are? I see projects like Travis-cl but nothing for Julia.

You can just edit a packages README.md, the buttons are normally the top few lines in markdown format. Swap out the package name and git url for your own package.

It looks something like:

[![Build status](https://...
1 Like

Great to hear. Most packages use Travis for continuous integration, i.e. automatically running tests and optionally building documentation in a virtual machine ‘in the cloud’ when a new commit is pushed to your repository. This is free for open-source packages. In order to set this up, you need to:

  1. make an account with Travis (I use the option to link Travis with my GitHub account)
  2. perhaps read Travis CI Tutorial - Travis CI and more documentation if you’re interested
  3. enable Travis for your repo (under settings, in the top right)
  4. write a .travis.yml Travis settings file and commit it to your repo. You can pattern-match e.g. https://github.com/fredrikekre/Literate.jl/blob/master/.travis.yml.
  5. in order to have Travis also generate documentation automatically instead of you having to do it yourself (which I’m guessing is how you’re currently doing it?), follow the steps at Hosting Documentation · Documenter.jl. Note that by pattern matching the .travis.yml from Literate, a lot of the Travis setup is already done.

After that’s done, you can add the badges to the readme either by pattern matching other packages as mentioned before, or from Hosting Documentation · Documenter.jl and by clicking on the badge in the Travis screen for your build, selecting Markdown, and copying the link.

Note that if you use GitHub - invenia/PkgTemplates.jl: Create new Julia packages, the easy way to generate a new package, a lot of this will be set up for you the next time you create a new package.

3 Likes

Thanks for the highly detailed response. I was wondering if you could copy and paste your responses here to something like an easy to find tutorial? I’m sure a lot of new comers with little dev ops experience would love to have access to this kind of information in such a concise format. This helped me tremendously and all of the suggestions seem to be the current best practices.

This Travis CI thing is fantastic. I really appreciate the YML file, I did have to tweak it a little for it to work for me. My docs isn’t a separate project. It should be, and I’ll fix that soon enough.

Looks like my PR is up on AttoBot and in 3 days or so I’ll know if it’s in acceptable enough shape. Thanks again!

2 Likes

Yeah, would be good to have this info in a better place. Any ideas as to what that place would be?

Registering a package may take a couple of days, as it involves human intervention. Subsequent releases for an already-registered package will be a lot quicker. See The current METADATA release process.

I noticed in your docs/make.jl that you don’t have a deploydocs call. This means Travis won’t actually push your documentation to your repo. You should probably fix that before getting the package registered.

See GitHub - attobot/attobot: Julia package release bot for how to update a release before it has been merged into METADATA.

2 Likes

Thanks for that check. I’ll delete my tag and remake the release. I really appreciate the help here.

Edit - I have no idea where a good place to put all that information would be. I’ll try to poke around, I just know other’s would appreciate it and it’d save people like yourself from rewriting the same thing.