Making a Package, 2 questions

#1

Hi everyone,

In my spare time I’ve been working on a package in Julia for Chemometrics (https://github.com/caseykneale/ChemometricsTools ). 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
#2
  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
#3

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!

#4

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.

#5

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
#6

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 https://docs.travis-ci.com/user/tutorial/ 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 https://juliadocs.github.io/Documenter.jl/stable/man/hosting/. 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 https://juliadocs.github.io/Documenter.jl/stable/man/hosting/#Documentation-Versions-1 and by clicking on the badge in the Travis screen for your build, selecting Markdown, and copying the link.

Note that if you use https://github.com/invenia/PkgTemplates.jl 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
#7

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
#8

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 https://github.com/attobot/attobot#updatingdeleting-a-release for how to update a release before it has been merged into METADATA.

2 Likes
Troubleshooting Registration Error
#9

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.