LongCut logo

Developing Julia Packages

By The Julia Programming Language

Summary

Topics Covered

  • Treat `export` as a deliberate API contract
  • Each test set deserves its own module
  • Ship 1.0 before you feel ready
  • Fork first, push to upstream later

Full Transcript

hi everyone this is Chris raucous over here in the MIT Julie lab and what I wanted to show you today is how to create a Julia package both from scratch and how to dev another person's package like you know add a bug-fix to your

favorite blotting package so what I'm going to do first to show you how to get help when you need it you go to the Julia page right so Juliet Lang org what you'll see is that you know download

Julie which is a pretty nice thing to have now thinking that you can do is you can go over to this community tab and you'll find this discourse forum where people discuss it all about Julia

development so you can come here ask your questions answer some questions now this is a nice forum to know about the other place that you might want to get help from is the slack so to get an

invite to this lock you fill out this form and then you'll get access to this slack where you know on this channel we talked about how to develop differential equation solvers there's other channels

dedicated to you know machine learning and all sorts of all sorts of development that's going on Julia is being discussed on the slack channel if you're interested these are two sources

to get in touch with people so for what we'll be doing what I'm going to I'm going to use the Juno development environment and the way to get Juno is you first install Julia and then to get

this all installed what you want to do you go to DOX juno lab org click on the installation instructions this tells you

where you can download atom right you run this installer once atom is installed then you go to your installed atom and then you go to your settings

here you click install you search for you know reboot your note and uber juno will show up here if it's not installed you click the install button and then if Julie is in your path then you'll be

able to directly access it right there if Julia is not in your path then you need to search for Julia client go to settings and then add Julie Atia of the Julii path to Juno once you've done this

now it'll be perfectly usable from your from the repple here so that's how you get Juno installed next thing I want to make yourself is this get crackin

so get crackin is a free GUI client for get you can just install it here and it's just like a really nice way to be able to make use of get let me download

delete my example here and get a new one running right let's create a package from scratch what I'm going to do is I'm

going to init a repo to emit net to github.com I'm going to call this my example jail and I want to say that this is a an example

Julie a package and put an exclamation point on there because you are very happy we're building a package right I want to just make this be the package name and I'm going to put this to my dev

folder so that's going to be on Windows it's your user slash Julia slash dev on something like Mac or Linux you it's

just till dust by a slash Julia slash dev this is where I will see why that we put a lot of things in the dev folder okay let's run this and what it should

do is you should create this my example Jael package on github and also locally so here it is locally I can now find it

on github so I go to github calm and I go to my profile I look at my repositories and you can see my example uh al is what shows up

here created thirteen seconds ago right so okay the other way you could have done this is if you to go to make a new repository here in github right you can make this new repository and then you

can go here to own your noodle repository but I find that sometimes it's easier just to in it from here because then they're already all set up so okay it might also ask you if you want to set

your remote to origin/master just say yes and we'll get into what that means in a second okay so here's our blank repository that's quite scary

right where do we start well there is a great package made by Nvidia old ekt templates JL so let's go to PKG template jail

we go to this documentation it tells you that this is a package for creating new packages you know recursive package and it's easy repeatable and customizable so

where do we start so what we do is we go to our Julia you go to this package repple and we add PKG templates

right so now this PKG templates is has been installed and what we can do is we can use this to generate a template for

our package so using PKG templates now there's a default template that we can make use of let's just start there so here's our default you

and it did not find my github username so I'm going to have to I probably digging a little bit more so here you can see a fuller example

let me kind of pull this up and that doesn't look good let me kill that let's get this go to over to a test file so I like to work in a test file called test jail just

because if you name something jail and you know then they will give you syntax highlighting so I'm gonna put in my github user name here just my name I'm

gonna say that the author is just me for coffee and I want the license for this to be MIT license so the MIT license is

a very good license to work with because well because it's a very permissive license so it's a standard license that's used in one month most juley packages so we can look at it by go to differential equations to jail we look

at the license you see that it basically says that anyone can use this and we're not liable if they blow themselves up by using it so okay that's good we can

share things but we're not liable for them doing something so okay so here's my username I want it to be MIT license I am the author let's not turn on SSH

let's and we'll get to what these parts mean in a second but let's have there be Travis and app they are coveralls code Cove

we don't need github pages for now yeah that looks like a good template so here I did the control-enter to be able to run this in place and I can see what

the result is in this judo window and now what I want to do is I want to put this template on to my package all right

so I go to documentation here which shows I can use this to generate the package so what's the name of my package well it's my example

when I run this oh it thinks my package already exists yeah and there's no really nothing there so let me actually just delete this and it's just going to create a whole folder there

okay let's add this project folder go to my dev folder go to my example let's see what I put in there I put a lot of things in there let's start out by

looking at the readme so added a bunch of badges let's look at what's in here inside of let's here inside of our get crackin let's do a forest bush here so that way

we overwrite everything we had before just make it be what PKG templates wants and let's see what the template came up with so nice it has a source file a folder s

or test folder some badges so let's get this now set up to be a real github or Julia package so okay what we do with our code is we put into this

this source so this source folder right so everything runs from the module which is the top-level module same name as the package so you start with my example

because this is the my example package and now you can put any kind of julia coat in here usually you don't want to put everything into one file so you might start by doing you know include

extra file jail and you know we add an extra file and now let's say we create this

function if' of XY equals to X plus y right so now we can say oh this is a fantastic package we now know how to do

two times X plus y right and so what we can do is we can start saying hey how do we use this package so what we can do is we go over to this test folder or and in

the test folder we add tests for our package so let's let's see how this works right so if we've done using my example then we should get these things

from the package and now let's see what happens if we do F of two one for example so let's do using my example so now my my example package is pre compiled and pulled in

let's do using test we'll see why in a second now let's run a fan Oh No F is not defined so the reason is first of all because this was my F alright so

let's try using I F and aha there it is now this is a this is kind of what you want to kind of make sure that you're actually running the

right thing here right because I kind of just ran this in place running in Juneau you know that this control enter to evaluate it so it's not actually evaluating the one that's that's in the

package here let's uh let's close up the repple start over again and so what I did there was control J control K be able to and Julia and I did control J

control C to wipe the console and now I have a full restart let's see what happens here so we do using my example

using tests and I would do my f and oh no f is not defined right and so the reason why it's not defined is because we didn't tell it

to export it from its scope right so Julie uses modules so that way things don't just collide insider to the top native top-level namespace so where this function actually lives is it's in my

example not my f and I can call it directly from here right so it lives inside of the package where inside of the package I've added this file and now

when I do my using my example this module exists when I access this model of function inside of the module then I'm able to make use of it now if I do want to have this directly

available for anyone who does using I can do export my F and now if I do a clean rep will state what we'll see is that this will work

so precompiled new version and now you can see that it's able to export my f if people one way to do one thing that you can do though is you know you can make your exported code be suitable for

repple use if anyone wants to do something in a more you know safe or a way that has less exports if they actually just run their julia so let's restart here and now we do import my

example then when we do import then this is not going to be exported right so this importing exact this import command is essentially like using except

it doesn't auto export everything that the package said to do so you're kind of free to you know export the things that you think do well with interactive computing and then if the user doesn't

want those exports they can just do import instead so I kind of recommend that you only export your functions that are for public use you know for other people to use if you have any internal

functions you shouldn't be exporting them it's really all about interactive repla usage so okay now we have a very quick package here we want to make sure that it's actually correct right so as

we develop we want to make sure that we don't have any issues so let's say we wanted this to be you know 2x plus 3y

right so if we had 2 + 1 as our input then our output should be well what should our output be it should be four plus three is she p7 right so

that's what you wanted and we run this code well if we run this code we see that it's false all right so what we're going to do is we're going to add a test here basically this is something known

as test-driven development we're going to add our tests to see if the values are what we want them to be and then we're going to go back and make sure everything passes our tests so here I'm

going to add this test and you see oh no this test failed and if we go to our extra file here we see aha this is why it happened now we change this to a three and since

we're using the Juneau environment we can actually just evaluate it here in place it will evaluate the one that is inside of your package so it'll update the package version and now we can test

that the new version that's inside of the package is actually complete seven right so another way to do this if you don't want to use the Juno environment

is you can make use of what's known as revised jl and revised jl is this package for essentially doing this kind of updating

so okay and you know you can make it so that way updates on the fly every time that you save the file fur so let's now create a whole set of packages so this thing is must be 2x

plus 3y whole set of tests and then we do okay let's what some other inputs that we might want to do you know if it's linear then we kind of need a few of two to be able to

guarantee that we have the right linear function and so this is going to be nine plus four which is 13 and so here we create a test set with this test set

does is it runs our multiple tests and it tells you how many pass how many fail right and now in order to check that our Julia package is working as it should what we do is we do this you know go to

the package repo which is that end bracket and then we do test my example this is the canonical way to test a package and here we're going to test to

make sure that it is going to pass all this test right so it is passing the test mean here it means that means that these two things are doing what we want here we go

oh no F is not defined because I haven't saved my run test Jael file AHA turkey so now now that I've saved my test file it will be testing that my F

is this and my F is that and there you go my example is doing the things that I thought it would be so what I'm going to do here is I'm going to go to get crackin and I'm going

to stage all my changes so it means I want to make these changes to the repository I want to say add the my F

function my F is a linear function just for demonstration okay so I add a commit and I also make a commit message just so that way can remember why I did this

here I make a commit this is the local version of my package repository so now it already exists here but what I want to do is I want to push this to my github repository

and when I push it it'll be available online and so you can see that my test folder now has these tests in there it's okay

now let's make sure that our package is always going to be correct right so it's always running tests on its own this is something that's known as continuous integration so if I go to one of these badges you can see oh here is actually

already set up continuously in your integration with my example if it didn't do that what you'd have to do is you click this plus sign and then you you know you might have to sync your account

and then search for your example in here but basically it already found my example to jail I have mine set up to our automatically just your new packages so otherwise you have to click a little

thing a bar on the side to enable it and then I'll be able to start running your tests right so what this does is it

takes your package and then it runs your test script online using by default it's going to be using Linux and Mac and we can modify the settings so that it's

doing over in this travesty ml file here let's say we wanted to test on one point one and and one point two as well and this will also test on the on the

nightly the nightly is the julia version which is still in development right now that is Julie it was a one point three release client to actually know it so it's gonna be since that's in Ruby we

scallion phase is gonna be on this one point four that you know crazy compiler developers aren't the only ones using right but let's let's test on there as well we don't if there's an issue with the master we don't want that to affect

our test so we say you know allow failures this is all part of the the pkg templates they generated this file for us we're now we've just added that we want to test on more versions all right

so let's add those new versions and let's push this to get and say test on more julia versions when we push this it will update our

yamo file online you can actually see that you know this test for the previous commit ran it ran and you can see it's you know just ran our test and it passed both tests and therefore we're good

all right if we go to our build history I'll see that there it now created a newer one and our newer llamo files now into effect and so it's running on more so the other thing that we might want to

be aware of is at they are because at they are runs Windows right and there are people in this world that do math on Windows you can see that I'm included in

that category so okay and don't judge so let's see so let's go to my example and we can click on this badge to go to

app there you'll need to sign in I usually just sign in with my github account we're going to need to add a new project here we can actually directly search for our projects from github

and you have a ton of packages and it gets kind of hard to search for them but here you go they click Add what this will do is this will enable app fear for our out

and now the next time that we do a push it will be running our tests on julia 1.0 and the nightly

on x86 and XC c 4 so 32-bit windows and 64-bit windows allowing failures on the nightly right and so we can go in here we can do you know julia underscore

version 1.1 and julia underscore version 1.2 and we can make a commit that says

test on more julia versions windows style now when we check this out it should be getting set up here

if you go back over to our package it should all be linked up might just be I have a lot of things going out of my on my up here so it might you know be

taking a bit to get there but general if you've just done this on a new you want yeah it'll be much quicker to respond so okay there it goes it's now going to be

running you know 1.0 1.1 1.2 in the nightly on went on Windows 32-bit and windows 64-bit

so okay now what we might want so okay so what happens if you if it test is failing let's kind of see what goes there let's say we add a bad test here

so two three let's say it's also going to be eleven that's always gonna fail well if you run this test set it's going to tell you that there was a failure and the thing that you really want to look

at is this right here it says that the failed at line eight in run tests and so so that in the future that will tell us you know where to be able to look if we

do test my example in number to save it test my example and we'll see that it says well be the first the test that

fails is right here at line 8 which it gets computes the wrong value does that look like when we go online let's say that someone wants to give us a code change that is not so great

alright so how would you end up doing a code change that is not automatically inserted way that you do this is you create a PR so to create a PR e what you

want to do first is you want to create a branch so this is a my test alright so here's a branch where I'm going to add a new test I'm going to commit to this

branch say my new test aah-ha-ha breaks things all right and then now we're going to push this and what we can do is we can

drag and drop this and we say start a new poll request I say I bury various tests and you say what do you have to describe your polar requests

otherwise people definitely reject it so you have to say something like this does not break anything I swear right so you

you know you want to be be too obvious about it so okay let's create this pull request what this shows up as on github is if you go to your package

we go to our package you see that there's a pull request open see ah someone so on the other day very not in a very easy test okay and when we go

here see that we can you know we can take a look at what they've done by clicking on the files change and what they did is they added a new test to our run test dodge al and what do what this

will do automatically is your test suite your continuous integration will be running on this PR branch to tell you what happens on here let's actually take a look here

I like the other window you let me let me see there's all these tests running let's just cancel this build that language it's for win

and now it should be running this once we have open oh if you don't use that there or if you don't use your Travis very much Travis is a lot nicer and they'll start your jobs right away got

quite a few things we run all the time so yeah we had to wait in queues that's how it is okay we got this started now it's going to boot up a machine and

start running this test close a few apps here well written for Travis to do its thing oh just so you guys know waiting for Travis is one of the great ways to be

able to say that you're working actually I'm going to get coffee all right you you just push some commits and you just say Travis I'm waiting on my test right that's a great way to feel productive

easy and doing nothing so you know continuous integration has many other benefits as well it's okay Oh No we see that the person who told us that there there are PR

right so he can see that this is on this PR branch my new test and they said it Oh No well not only they did there their

commit say that it broke things but right here we had a test that failed and so when that happens now it shows up red

and when it shows up red here over in my example so let's go back to our my example it's now going to automatically show up as well it's still running but when all

the tests pass when all the tests will fail it look this will show up red this will show up red it will know not to merge this right so we have to respond

to them saying no it really does break some so now if we go back over to us we read this and we go oh man they caught us

let's not break something so let's go to here and change this to one and now this test passes so now we say let's save our tests

say fix tests you copy right now we push this to our branch and now here since we pushed it to my new test it will update our PR branch but

here you can see that it has two commits and the total changes are that we commit is now shown here as this right and this test is going to end up passing and so

what the what the person will do on the other end is they'll take a look at your files you know they'll comment here and say hey it's good now alright so you see that there's these little plus signs

that show up on the side here that's how you can add comments then you review changes like you know comment or request changes now usually if they see this and

they actually like your code might not knows but they like your code they'll approve it and if the tests go green right the testicle will go green this will show you that all the tests pass so

I'm going to assume you know instead of waiting for Travis here I'm just gonna say yes we're all going to pass and I'm going to then merge this pull

request and for a merge and there you go and now we can delete this branch because now it's been merged in you can see here is that our new

branch was added to master go over to the master of our package I'm going to delete these branches because we're not going to use them anymore and we see that in our master we

now have all these all this code right and so that's now the code that shows up in a repository we look at our test files we see that those new commits were found are in here and you see that this

test has been added all right so this is how other people can you know request for you to change your code I'll show you in a bit how we can do that to other packages as well so okay

um what we want to do next is we want to say I think we're ready to get more serious here right so let's let's do something like I don't know let's

a good example let's add some or diff let's let's do some differencing of I function right so we want to do

something like a derivative of I F of XY where this is going to compute the derivative of it in terms of just X

right where Y is kept fix so I want to do this by doing something like forward

diff derivative of I F so I'm going to use a closure here X goes to you don't know as a closure is you might

want to take a look at the eighteen seven fifteen seven notes on these are pretty in-depth notes on the development for performance there's a lot of lecture

notes you can go through that explain a lot of nice Julia styles to use so I assume that you know here's how you take the derivative according to forward if

documentation if jail don't look at forward if two yet that's their going to be the cool new forward if but it's not ready yet go to the differentiation API I'm just using

this for a div dot derivative function and so I'm going to take the derivative with respect to that x value right I can add this in here but it's not

going to be able to work so let me say that I also also going to export this when I use the export command

should be showing off here my derivative on and oh no Ford if it's not fine right so let me add forward if to my package

so I can do using F inside of the package so that way it exists right so I need to do it within the module so that wait now generally there's this nice style that you might see among other

packages where everything that is both using it and exported is shown here it's my example file so that way you can know where all the packages come from and what all the things leaving are alright

and then you just include a bunch of other files for your other structure here let's see you're using for death and you get this weird little warning here so package my example does not have

forgiven its tendencies reason is because you need to declare what your dependencies are for a package so let's let's let's dig in here so the

dependencies are all shown inside of this project at Tamil file we don't have any dependencies so let's let's add one what we want to do is we want to

activate our my example environment and then what we could do is we add for death you so it's going to take a sec here and then now it's going to add it in you can

see that it's actually changed my project at amo file tell us that the the depths you know the what it depends on it has four different here where this is

the EU ID right so every package has a unique ID and this is the unique ID with for DIF so that way it knows which one it is I probably want to add a compat in

here so if we go over to for death let's say you know we want to and we're gonna be using some it was features so or maybe we just kind of we be careful so

look at this and see that its latest release is 10 zero point ten point three so let's say we want to require you know forward

or a diff is 0.10 right so this will let it be from zero point ten to anything until zero point eleven it won't it will say if we get to zero point eleven it

won't allow that because that could have a breaking change and we want to be able to establish compat and see ourselves first so how if you want to get more

information on what the syntax is for compat you can go over to this pkg Jael all right this is the Julie package manager it has its docks right here and

you can it has a whole section that describes how compatibility works all right so there is this caret addendum specifier which happens by default I also use these Tilda's or inequalities so you can say anything greater than

equal to this version right there's a bunch of different ways to be able to establish what your compatibly weird but it sounds like a good one here so okay

so here we say that you know as long as you're busier it's kind of forward if you should work and so if we go back to our so if you just do activate without

telling it a package goes back to our standard environment and if we've now run our example code so let's run our example I'm going right

in a new job so I killed it again and here I do my example and when I do using here it should no longer complain that we have four different all right so it's going to have to

recompile to be able to get this new state but aha has it in here and it's able to use for if without oh I didn't save that file but you always have to remember safe but let's

okay let's go over to our run test at Yale let's recompile now with our saved version alright we're going to pre-compile to this new package and did we not save

Oh so what we did forget to do here and it says right here you want to resolve let's do resolve so we've changed their packages that needs to update the manifest so that way it knows what

packages have what dependencies because you can't just change the son right so once we run a resolve now we're going to ready dang

and let's kill Julius so that way we can show that this is going good using my example test and now let's check our derivative and that was a lot of work but we got our

derivative going right what is the derivative of a linear function it's just the slope and so that should be good right so it just goes out this two

so let's actually create another test set in here so at test set

derivative tests begin at test my derivative F that should be e2 and now we have a second test set alright so we can run this test set on this test set

and that's our total set of tests now another thing that we might want to do is you might want to throw this out to a package right or through a file so we can say you know these are my F tests all right so everything to do with my F

is going to be in this file let's move these over here now one thing that you might want to do when you do this is you might want to use a package called safe test sets

safe test sets a jail is a way so that way your test sets if you're going to be doing a lot of including it will make sure that they're basically the puts them inside with its own module so

nothing will leak out so every single at safe test set will have a completely different environment and you will know that if nothing will be shared between them this makes it nice for you know

making sure that your tests are truly correct so okay what we can do here then is well since it won't share environments we need to have a complete test script and so here a complete test

script will be this so here we use an at taste safe test set where we say that these are the my F s and is going to be running the test from

the my F asks dodge al file alright so it knows to include it directly from the top level being this test folder now what we need to do too is we need to add

this using this safe test sets package right so add safe test sets we don't want to just add the package right because the users don't need it only when you're running the test you need it

so what we can do is we can add this as a test as a test dependency by going over to our project at Tamil

so we go to this project tamil and we see that oh I forgot to do activate activate by example

add safe test sets and now we see that in this project Tamil I'm going to manually move it down to extras and I'm going to add this as a target

so what this does is this makes it so that way this is now an a package which is only installed when you're running your tests now when I do let me go back to my

global environment and I will test my example it should download safe test sets well here I have it locally for testing but

Oh always remember save okay test my example it should download save test sets and it should then run my test with the test dependencies and we can see here that my F test passed right and if

you have a failure inside of here it'll tell you which one of these tests that's failed so you can have you know test set so test us and don't know how to add it

up it's okay let's push this then to a repo ad forward diff and in C and set up

safe test sets and I think our repo is looking pretty nice so we have a license we have our things set up this manifest tamil if you want to get the exact state that you're

running things you can activate this manifest but generally generally it's not good to have this at the as part of the repo because then your CI tests will be running exactly these packages and

not necessarily the ones that the user is running and so what you kind of want to do usually in Ag templates does this for you it adds this Manifesta tamil -

they could not get ignore so even when it is generated by by PKG it doesn't add it to the repo automatically okay so we have so we don't have a

manifest we have a product tamil and I want to say you know this is a repository or a linear function and I EV

and its derivatives right and so we say very generously we say add documentation right because users can figure out the rest they can look at the source code

it's all Julia it's okay if we go over to our package now my example Jo you see that hey we got

everything set up you can see that these badges are now automatically updating I'm depending on when your master branch is passing or failing tests right it's going to be green when it's passing this is saying it's pending because it's

still waiting to run this latest this latest commit right and that should be green as well code Cove automatically set up for me if it's not going to set up for you and what you want to do is

you go to skit hub or you go to code Cove jail you add a new repository and you search for it in here and what code Cove is going to do is going to tell you your code coverage

and what that is is it's the it is the parts of your package which are actually hid while running your tests so we can see that my extra file jail

all of it is ran here in this test and where do I not have code coverage I do not have code coverage on this greet function right so it says oh you know

you aren't covering your whole package you have you know 66.67% of the lines in your package are being run in your tests so you probably want to add more

coverage so problem is actually that I kind of want to I don't want to greet people I'm not that nice I don't say hello to the world I don't say you know

get it rid of extra treat function all right and so now I'm going to have perfect code coverage so the other badge

that we have on this repo so examples are my example jail this other backyard this other one that we have here is

another coverage setup or you can go sign-in it gives basically the same statistics it's just a different GUI some people like it more some people like it less you just add your repo here the same way

you do the other one let's see our my example show up my example should be in this list you can see here now we just turn it on and next time that it's running it'll

basically say hey you're going to get you know this coverage should be a hundred percent now so okay we have fantastic documentation all of our tests pass we have brand new functionality and

we want to just share this with everyone who uses Julia alright so first you know let's say we start our own package because we really like what we built here you like other people's packages

you should probably go start them as well it's just a nice thing to do so okay let's register this package alright so the way that we're going to do this is we're going to

uh you can create an issue and you just say register well let me there is this Julie registrate er and what you have to do first is you do

have to install this app and so let's install it and configure it for four for me and I just put it on all repositories is everything's Julia so you might as well do that right now you can select

specific repositories if you want once you have that set up and what you do is you type register or you open an issue or you can do this inside of a commit as

well and you can say at Julia registrate ur registered and what this will do is it will tell the bot that you want to register this

as a package for other people use the boss should respond pretty be alright and so what is this registration process for well we need do something like add plots right how does it know

what packaged is the you know the canonical plots DL package well it's because it does this registration packet or this registration so here you know it

open it up in general and then someone who works with the package repo they can take a look at this and see whether this is worth bringing in to the Juli

registry it's not I'm gonna close this but but you know in this case you can see all the open package registrations over here so for example you know

there's a new some new packages being added there are some patch releases being done and you know yeah then people can comment on them and then someone who maintains the registry

can then merge these changes right so these are this is how the versioning is all done in the ecosystem so let's say we then we wanted to add a new now let's say we made some changes and we want to

make a new version and what we do is we would update our project tamil this project amo and now we do something like go to one point zero point one point one or zero point two point oh

right how should you be changing your version names well generally the front part is what you break a change when you have a breaking change and you add new features you do the second one and when

you do patches like you know a small bug fixes you do the last one before you're 1.0 both feature releases and breaking releases are changes to the front here so I kind of recommend that you do an

earlier 1.0 then you might expect because it just works better with the way that the automatic compatible eight so in the way that they automatically

compile that you know the next possibly breaking release is the one that's set to not installed by default and so since this is a zero in front it means that the zero point eleven is allowed to be

breaking and so therefore zero point ten to zero point eleven are the packages are allowed right if you've changed this to 1.0 than anything 1.0 1.1 etc would be allowed this is about saying we're

allowing ourselves to use julia version 1.1 point oh 1.2 1.3 etc but we will need to actually manually make a change if julia 2 comes out which probably is the case right we'd probably need to

change some things in the package anyways but you know this is a conservative approach to make sure that you know whenever there whenever someone else releases a package that says there's a breaking change you don't automatically change to that version by

default okay so you change versions here when your package is actually you know when someone merges the new versions what happens is let's go take a look at one

of our differential equation solvers what happens is it adds to this release and Julia tag bot tells you all the PRS that you merge right so all these pull requests that you merge it's going to

give you a DIF to tell you how the package changed over that that release and it's going to store all this information inside of one of these

pieces so this this is actually created for you you don't need to create this yourself this is done by the tag bot which is associated with the register it's okay I think that covers the basics

of getting a package up and running and using the Juno environment and you know the fancy things like evaluating in the package which you know and having an auto update you have any questions more

than that then you come talk to us on the slack and now the next thing I wanted to go through is how do you edit someone else's package so while going through that this and creating this

example right I was looking at PKG templates pkg templates jail and I notice that they have this commit here that said

test 1.1 and oh no they aren't testing on 1.2 yet which is the latest release of Giulia we need to fix this right so the simplest way to fix this is we click

on this right here and then we you know we make the change and then when you do propose a change like this this will be a way so that way just opens up a poll request right but let's not do it like this for now

because this really only works for small changes what we want to do is we want to make sure that this works for big changes right we want to you know I want to give you a style that will work so that way you can you know really test

what you're doing so okay let's let's leave this for now and let's find out how to develop someone else's package and give them a pull request so here let's what we're gonna do is instead of

just adding the package we're going dev this package right we can either dev directly from the URL or if it's a registered package and you can have

directly from the name so that's Deb from the name here you'll see that oxy download the git repository and it puts this kit repository in that dev folder by default so it's a nice that's kind of

why I put this folder in there so that way everything I'm working on is in this dev folder so here is now my local version of their package and I go to this travesty Hamel

I say aha I can I can help them out I say you know let's add this one point to and let's include the documentation and run the documentation on one point - all right

so I make these changes you can see it says hey this is something that's changed right yellow means that it's changed and hasn't been committed yet but what I can do here is I open up this

repo which now exists locally on my computer from this dev folder and here I can make a new cut right so what I'm going to do is because

I want to open up a pull request we open up a branch here which is do a Travis and then we say test giulio 1.2 on

Travis Julia 1.2 is the latest lease and is quite standard so therefore it would

be nice to test on it as well smiley face because we want to be nice to the other people that were interacting with it unity if you don't know open-source you get a lot of people just telling you that there's a lot of things you have to

get done we know we have to get a lot of things done so it's really nice when someone gives us a fix that also has a happy face in it right so let's commit

this change and let's push and submit here and oh no it doesn't let me push it well the reason is because this is in vinius repo right I don't have access to

their repo they probably don't want to give me access because then I'm going to go and make all their tests fail right and so I can't push through their repo what I need to do is I need to fork the

repo to make my own push my branch to my fork and then open a pull request from life so how do we do this we go to PKG

templates click on this button to fork and here i'm going to focus too well as I've already done this before to them so

okay what we do then once we have a fork is we have to add a new remote right so remote is a remote version of this github repository that we want to be pushing and pulling from so here we're

going to make check for this remote over at Chris raucous which is me and so here now this this remote is pointing to my four right now when I

right-click I do is I set upstream to be to my remote I'm going to submit and I'm going to push through and now we can see is that on my fork branch and now I can also see that yes I

have this version of their package with this change on it now what I want to do is I want to tell them to make this chain I want to tell them nicely but they should make this change right so I

want to request that they pull in this change and the way I do this is I take my branch right so this is my Travis branch I drag it over to master

so I I drag it over to an vinius master origin / master I don't know why that's not going right now you all right well that's fine okay so let's

start it start a pull request to origin slash master so to the nvidia package right fro my package on the travis branch and now it auto-populates it with our

latest commit because we just had one and so here let's say you know this is the pull request I want to open I open this pull request and we can actually

see it then on github alright and so it says oh you know this will test on 1.2 etc etc and I can't merge it because this is not my package but now what they can do is they can look at the files

that I've changed see do I want to these changes yes or no and if they believe that these are good changes then they can click merge pull request alright this is how you can this is how you can then contribute to the

Julia package development environment or you know ecosystem and you know you don't have to own all the packages in order to do this kind of development so generally there are you'll find that a

lot of these packages that you work on have kind of a community associated with them so for example there's Juliette if you um which hosts all the differential

equations repos and so you'll see that you know there could be multiple people maintaining a package you have these rights to be able to merge access and you can find out

who's involved with the package by for example looking at who the contributors have been oh I don't recommend just you know just spam messaging everyone all the time you know you know to contact them to pull

requests or if you're kind of scared about making your first pull request feel free to you know take a look at contributors yet say hey oh it's this person I see them talking on the slack

all the time and then you know you can start talking them on the slack saying hey I think that we should probably make this change to your package what do you think about it right so you can discuss your changes with them before you go

ahead and commit your time to it and then you know you open up the pull request and of this scholarly dialogue which is very nice and they'll pull in your changes and then you'll be someone who has helped out one of these packages

right now note that the package you won't actually you know that code won't be released until they actually do it release so you might want to ask them hey can you you know can you update it

can you do a registration of a new patch right after that's all registered then that'll be the new version that everyone's using throughout Julia so I hope that is a nice little overview for how Julia package development works all

right so I didn't go really into how do you program and Julie oh very much other than how do you you know program within a package environment and make it automatically update I don't hope felici that you know using Juno for this is

quite nice you can use pkg templates to make new packages use get crack in to easily create branches great pull request handle your dependencies all these kinds of things

I hope Julie package development makes sense to you know and you can make use of this in your own work so I hope to see pull requests from all of you guys thank you very much

Loading...

Loading video analysis...