-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Content for Development environments/Running code #3
Content for Development environments/Running code #3
Conversation
Some parts are still a skeleton of the final content, but there's enough actual content for me to mark this as an actual PR so others writing can see what's already been written. |
pages/writing.md
Outdated
### Help mode (`?`) | ||
By entering a `?`, you can query information and metadata about Julia objects and unicode symbols simply by typing their name into the command line. | ||
For functions, types, and variables, the query fetches things such as documentation, type fields and supertypes, and in which file the object is defined. | ||
<!-- How do you do syntax highlighting for the Julia REPL? --> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
with triple backtick followed by julia-repl
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cheers.
pages/writing.md
Outdated
For functions, types, and variables, the query fetches things such as documentation, type fields and supertypes, and in which file the object is defined. | ||
<!-- How do you do syntax highlighting for the Julia REPL? --> | ||
``` | ||
help?> Int |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it would be nice for this to be run by Franklin itself
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pages/writing.md
Outdated
@@ -45,23 +45,131 @@ juliaup status | |||
|
|||
## Development environments | |||
|
|||
Depending on your experience and how you use Julia, some ways of writing code may be more familiar or useful to you than others. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll add more details there
pages/writing.md
Outdated
Data scientists commonly prefer notebook environments such as those provided by [Jupyter](https://jupyter.org/) through the [IJulia.jl](https://github.com/JuliaLang/IJulia.jl) package, or Julia's own reactive notebooks from [Pluto.jl](https://plutojl.org/). | ||
On the other hand, package developers or those who write a lot of scripts will prefer the more traditional programming environment provided by a text editor or integrated development environment (IDE). | ||
|
||
For some, the Julia REPL (Read Evaluate Print Loop) itself is all that's necessary. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe the REPL deserves its own section before dev envs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1 from me
pages/writing.md
Outdated
Shell mode: Functions as a terminal inside Julia, you can also execude shell commands from Julian mode. | ||
Here's an example | ||
```julia | ||
an_example() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wtf ^^?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ran out of energy
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What are the terminal niceties we might be interested in for this part? The one that comes to mind is git
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Git is one, but what I meant to show in this example is calling bash commands from inside a non-interactive Julia session. Calling shell commands from inside Julia means anything Julia can't do but bash can, can be done without needing to worry about interop.
pages/writing.md
Outdated
|
||
[^1]: Unless you're compiling binaries with [StaticTools.jl](https://github.com/brenhinkeller/StaticTools.jl). | ||
|
||
<!-- The VSCode is important to write in tandem with or after the Development environments part is written to avoid overlap. --> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah I'm gonna reorder a bit once we merge this
pages/writing.md
Outdated
<!-- The VSCode is important to write in tandem with or after the Development environments part is written to avoid overlap. --> | ||
Most people develop Julia using a tool that allows for [interactive development](https://en.wikipedia.org/wiki/Interactive_programming). | ||
In VScode, you can [run code](https://www.julia-vscode.org/docs/stable/userguide/runningcode/) in the following useful ways: | ||
* For interactive development, the standard way to use Julia, you can use hotkeys to run selections, lines, sections, or whole files in the currently open REPL. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not clear to a beginner what a hotkey is. Mention the universal shortcut Ctrl + Shift + P
for the command pane?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think hotkey is a common enough term that I feel comfortable using it. 3rd opinion?
That said, this part's not written yet.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FWIW, the Julia VSCode docs use the term "keyboard shortcuts".
pages/writing.md
Outdated
This allows you to, among other things, load packages that improves your development experience or contain functionality that you use very often. | ||
|
||
It's tempting to put a lot of code in your `startup.jl` file for convenience's sake, but this convenience comes at a cost of increasing your startup time as it is executed. | ||
To balance convenience and time, we can use AST transformations to conditionally load functionality from packages only when necessary. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is too scary for the first page
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's a hard dilemma. Conditional loading makes using Julia way better so I want to put it in, but I also hate introducing "magic code" in tutorials. I think conditional loading itself isn't that advanced, it's just not so common because the code itself isn't something most people can write themselves. The concept of "AST transformations" is advanced, I just put it in there to "remove the magic" for those who can understand it. That said, there's probably a better wording (or it can be a footnote) or we can just remove the conditional package loading part entirely.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Honestly with 1.9 / 1.10 it's no longer that expensive to pre-load small packages like BenchmarkTools, is it?
pages/writing.md
Outdated
using Revise | ||
using OhMyREPL | ||
|
||
colorscheme!("GruvboxDark") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this from OhMyREPL?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think so? Not sure lol
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, OhMyREPL ships a couple of color schemes: https://github.com/KristofferC/OhMyREPL.jl/blob/aa1d7e258f788dfb261ad070fb39657e9c9ab98a/src/passes/colorschemes.jl
pages/writing.md
Outdated
colorscheme!("GruvboxDark") | ||
OhMyREPL.enable_pass!("RainbowBrackets", false) | ||
|
||
if Base.isinteractive() && |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this belongs on the first page, maybe as a footnote or linked file
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In an effort to give a nearby example of everything but also not repeating myself too much I just put an actual config here. I think it's probably fine if we end up not putting the conditional loading part, then it's just a short code snippet that's also a genuinely useful startup.jl file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could add a folder in _assets
with such typical files. I also wanna do one for runtests.jl
pages/writing.md
Outdated
ENV["JULIA_EDITOR"] = "code" | ||
|
||
using Revise | ||
using OhMyREPL |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Revise and OhMyREPL both recommend loading the packages in a try-catch
statement:
https://timholy.github.io/Revise.jl/stable/config/#Using-Revise-by-default-1
try
using Revise
catch e
@warn "Error initializing Revise" exception=(e, catch_backtrace())
end
https://kristofferc.github.io/OhMyREPL.jl/latest/installation/#Automatically-start-with-Julia.
atreplinit() do repl
try
@eval using OhMyREPL
catch e
@warn "error while importing OhMyREPL" e
end
end
pages/writing.md
Outdated
``` | ||
|
||
For unicode symbols, the query will return how to type the symbol in the REPL, which is useful when you copy-paste a symbol in without knowing its name, and fetch information about the object the symbol is bound to, just as above. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could also mention that using help-mode with a string will call apropos
and look for the string in all available docstrings:
help?> "determinant"
LinearAlgebra.logabsdet
LinearAlgebra.det
LinearAlgebra.logdet
LinearAlgebra.det_bareiss!
LinearAlgebra.det_bareiss
This is quite useful to find / remember function names.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did not know this...
pages/writing.md
Outdated
For unicode symbols, the query will return how to type the symbol in the REPL, which is useful when you copy-paste a symbol in without knowing its name, and fetch information about the object the symbol is bound to, just as above. | ||
|
||
### Pkg mode (`]`) | ||
Pkg mode is for managing environments and packages that is based on the Rust package manager "cargo". |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this sentence is missing a word.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(I'm also not sure the comparison to Rust's cargo is crucial enough to belong in the first sentence. This might confuse people who have no experience with Rust.)
Just a word on reviewing: it's cool to spend time at the beginning to make sure that our general orientations and styles are aligned, but I don't expect this level of detail on all PRs :) Let's not discourage each other either, we can always re-modify after the fact |
@jacobusmmsmit I took your REPL content and merged it in #23 with the brand new Franklin REPL code blocks. Feel free to merge |
Crap I just nuked my content. |
made new branch RIP |
This PR is mostly a test PR to
In particular here are some things to look at @gdalle (more detail in comments in file):
startup.jl
we provide? Should we provide one? It is my current opinion that it should be minimal. I'm always scared off by long vim configs (for example).