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?
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 LinPredModelshould 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.
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?
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).
Since your question is about the workflow, this is how I’d extend GLM:
Fork the repo on github
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.
Make a new branch.
Open the local package folder in Juno and use file search and jump-to-definition to acquaint myself with the code.
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.