Development tools for Julia?

package

#1

I am a new contributor to Julia and feel like I have a very inefficient workflow. For example, I am trying to contribute to this function in GLM

I know x is a LinPredModel and has a .pp variable representing the covariates in the regression. I am trying to see if LinPredModel also contains a .weights variable representing weights used in maximum likelihood. When I use github to search for the LinPredModel class I’ve found that it is a subclass of RegressionModel

But to find the definition of RegressionModel I need to search inside StatsBase, which is a different repo and won’t show up in my original github search. Is there a better way to find where variables and functions are declared while developing?


#2

LinPredModel is an abstract type and thus, does not have any fields. If a function that takes a LinPredModel accesses a .pp field then it can be inferred that all concrete types that are subtypes of LinPredModel should have a .pp field. This is however not automatically checked and it could be argued that direct access to .pp in a function that takes an abstract type is breaking abstractions.


#3

The Julia VS code extension allows you to easily navigate to where a type or function is defined (or give you a number of options to choose from). See the demo. Unfortunately, it’s not working right now for me because of https://github.com/JuliaEditorSupport/julia-vscode/issues/255, but it’s really nice when it does work.

Edit: just wanted to mention that they are working really hard to fix the problem.
Edit 2: and it’s fixed.


#4

In Juno you can jump to the definition of a symbol with Cmd-J Cmd-G


#5

I think that requires having the full source code of StatsBase locally stored on my machine. Is there a way for Juno to search for definitions just by having the package installed?


#6

In Julia, you have the full source code of any installed packages locally on your machine. A package is essentially a git repo cloned locally to your machine (on my mac located in ~/.julia/v0.6).


#7

You also got a bunch of useful commands at the REPL: @which, @less, @edit, methods, methodswith and more.


#8

Since your question is about the workflow, this is how I’d extend GLM:

  1. Fork the repo on github
  2. Open the local package folder in the directory I mentioned in a git client (I use GitKraken) and add my own fork as a remote.
  3. Make a new branch.
  4. Open the local package folder in Juno and use file search and jump-to-definition to acquaint myself with the code.
  5. Run the GLM.jl file and use Juno’s capabilities for setting GLM as the ‘working module’ to immediately and iteratively test the effect of any changes I make to the code.
  6. PR when happy.