Use of Project and Manifest has always been a mystery to me... so I've never started to use it. I understand the importance of keeping track of package version numbering -- there may be breaking changes as packages are upgraded, with a result that I may have to rewrite Julia code. Instead, I can activate a former Project and run the old code that used to work. I also understand the importance of Manifest, I think. Also, it may be important to keep track of Julia version. Some years ago (?), updating from Julia 1.6 to 1.7 or so, Turing.jl didn't work for several months. So in that case, I would have to know that I also had to use a certain version of Julia. -- The "External Packages" video is a good starting point for how to "activate" a project. But I still have questions... * What if I close down VSCode/turn off my computer. Then I restart the computer, re-open VSCode, and go back to the same directory. Is the project automatically activated when in that directory, or do I have to re-run the ". activate" command? * What if I continue working on a file in a given directory, and decide to add more packages. Are they automatically put into the project for that given directory? Or do I have to re-run the ". activate" command every time I want to do a change? * What if I copy the file to another directory, and also copy the two *.toml files. Is that all it takes to make the code work with the original sets of packages/Julia version? * Is it possible to have the two *.toml files availale for subdirectories of the directory where the *.toml files are located, or do I have to put the *.toml files in every directory where I store code? * If I have different versions of, say, Plots, in different directories, I assume that all versions of Plots referenced in the various Project.toml files will be stored somewhere on my disk? * What if I have a working code with the given *.toml files in a given directory, and I want to see if the code works with newer versions of Julia/packages. What is the best strategy for doing this, and at the same time keep original *.toml files in case my code *doesn't* work with the updated versions of Julia/packages? * What if I push my code to GitHub. What is the best practice of handling *.toml files? OK... lots of questions, and probably basic questions :-o.
@doggodotjl Жыл бұрын
Great questions! I think you can find answers to most of your questions in the Pkg.jl documentation (Julia Package Manager): pkgdocs.julialang.org/v1/ ...but I will attempt to answer some of your questions here: * When you go back into VS Code, you need to change the working directory to where the Project.toml file and Manifest.toml files are located. Then you need to enter the Package Manager and then type in "activate ." again. * You only need to type in "activate ." once per session. If you add another package during your session, it will be added to your existing .toml files. * If you copy the .jl file and the 2 .toml files to a new directory, then you need to change the working directory to that new directory. Then you need to enter the Package Manager and the type in "activate ." to activate that new directory. * I'm not sure I understand this question about the subdirectories. As a best practice, you should have a separate directory for each project. So if you have multiple project folders, they should each have their own Project.toml file and Manifest.toml file. * For the rest of your questions, I'm going to have to refer you to the Pkg.jl documentation.
@cemtutum273 Жыл бұрын
Is there any particular reason for using ";" in the plot function after f? Comma also works. Also, similarly, why do we define the color with a symbol :red? Is it registered by default as the string "red"?
@doggodotjl Жыл бұрын
By convention, function arguments are separated from keyword arguments using a semi-colon, but in Julia, you can use either a semi-colon or a comma. When using the Plots package, you can either use a Symbol or a String for the color name.