Skip to content

Commit d5c4371

Browse files
Jonah-Heyljlperlammcky
authored
issue_250_software_engineering (#262)
* did_formating_and applied_issue_250 * added_mu_to_the_format_dictionary * just_to_get_the_deployment_to_run * fixed foo function * ENH: Enable automatic download notebook sync (#264) * changed testing to julia 1.9 --------- Co-authored-by: Jesse Perla <[email protected]> Co-authored-by: mmcky <[email protected]>
1 parent 200314c commit d5c4371

File tree

3 files changed

+17
-17
lines changed

3 files changed

+17
-17
lines changed

format_myst.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,8 @@ function format_myst(input_file_path, output_file_path, extra_replacements = fal
5555
end
5656

5757
# Additional replacements are optional. This may be useful when replacing variable names to make it easier to type in ascii
58-
replacements = Dict("α" => "alpha", "β" => "beta", "γ" => "gamma", "x₀" => "x_0","λ"=>"lambda","" => "<=",
59-
"" => ">=", "Σ" => "Sigma", "σ" => "sigma")
58+
replacements = Dict("α" => "alpha", "β" => "beta", "γ" => "gamma", "" => "<=",
59+
"" => ">=", "Σ" => "Sigma", "σ" => "sigma","μ"=>"mu")
6060

6161
# Replace the code blocks in the content and handle exceptions
6262
try

lectures/software_engineering/need_for_speed.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -750,7 +750,7 @@ end
750750
Calls to this function run very quickly
751751

752752
```{code-cell} julia
753-
x_range = range(0, 1, length = 100_000)
753+
x_range = range(0, 1, length = 100_000)
754754
x = collect(x_range)
755755
typeof(x)
756756
```
@@ -824,7 +824,7 @@ Things get tougher for the interpreter when the data type within the array is im
824824
For example, the following snippet creates an array where the element type is `Any`
825825

826826
```{code-cell} julia
827-
x = Any[ 1/i for i in 1:1e6 ];
827+
x = Any[1 / i for i in 1:1e6];
828828
```
829829

830830
```{code-cell} julia

lectures/software_engineering/testing.md

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ This specifies metadata like the license we'll be using (MIT by default), the lo
137137
We will create this with a number of useful options, but see [the documentation](https://juliaci.github.io/PkgTemplates.jl/stable/user/#A-More-Complicated-Example-1) for more.
138138

139139
```{code-block} julia
140-
t = Template(;dir = ".", julia = v"1.8",
140+
t = Template(;dir = ".", julia = v"1.9",
141141
plugins = [
142142
Git(; manifest=true, branch = "main"),
143143
Codecov(),
@@ -225,7 +225,7 @@ Given this, other julia code can use `using MyProject` and, because the global e
225225
You can see the change reflected in our default package list by running `] st`
226226

227227
```{code-block} bash
228-
Status `C:\Users\jesse\.julia\environments\v1.8\Project.toml`
228+
Status `C:\Users\jesse\.julia\environments\v1.9\Project.toml`
229229
[7073ff75] IJulia v1.23.2
230230
[a361046e] MyProject v0.1.0 `..\..\..\Documents\GitHub\MyProject`
231231
[14b8a8f1] PkgTemplates v0.7.18
@@ -288,7 +288,7 @@ jobs:
288288
fail-fast: false
289289
matrix:
290290
version:
291-
- '1.8'
291+
- '1.9'
292292
- 'nightly'
293293
os:
294294
- ubuntu-latest
@@ -351,7 +351,7 @@ See the [Pkg docs](https://docs.julialang.org/en/v1/stdlib/Pkg/) for more inform
351351

352352
For now, let's just try adding a dependency. Recall the package operations described in the {doc}`tools and editors <../software_engineering/tools_editors>` lecture.
353353

354-
* Within VS Code, start a REPL (e.g. `> Julia: Start REPL`), type `]` to enter the Pkg mode. Verify that the cursor says `(My Project) pkg>` to ensure that it has activated your particular project. Otherwise, if it says `(@1.8) pkg>`, then you have launched Julia outside of VSCode or through a different mechanism, and you might need to ensure you are in the correct directory and then `] activate .` to activate the project file in it.
354+
* Within VS Code, start a REPL (e.g. `> Julia: Start REPL`), type `]` to enter the Pkg mode. Verify that the cursor says `(My Project) pkg>` to ensure that it has activated your particular project. Otherwise, if it says `(@1.9) pkg>`, then you have launched Julia outside of VSCode or through a different mechanism, and you might need to ensure you are in the correct directory and then `] activate .` to activate the project file in it.
355355
* Then, add in the `Expectations.jl` package
356356

357357
```{figure} /_static/figures/vscode_add_package.png
@@ -435,8 +435,8 @@ module MyProject
435435
436436
using Expectations, Distributions
437437
438-
function foo(μ = 1., σ = 2.)
439-
d = Normal(μ, σ)
438+
function foo(mu = 1., sigma = 2.)
439+
d = Normal(mu, sigma)
440440
E = expectation(d)
441441
return E(x -> sin(x))
442442
end
@@ -465,9 +465,9 @@ Then calling `foo()` with the default arguments in the REPL. This should lead t
465465
Next, we will change the function in the package and call it again in the REPL:
466466
* Modify the `foo` function definition to add `println("Modified foo definition")` inside the function
467467
```{code-block} julia
468-
function foo(μ = 1., σ = 2.)
468+
function foo(mu = 1., sigma = 2.)
469469
println("Modified foo definition")
470-
d = Normal(μ, σ)
470+
d = Normal(mu, sigma)
471471
E = expectation(d)
472472
return E(x -> sin(x))
473473
end
@@ -729,9 +729,9 @@ For example,
729729
For cases where you want to change the relative tolerance or add in an absolute tolerance (i.e. $\|x - y\| \leq atol$) use the appropriate keywords
730730
```{code-cell} julia
731731
x = 100.0 + 1E-6 # within the tolerance
732-
@test x100.0 rtol=1E-7 # note < the 1E-6 difference passes due to relative scaling
732+
@test x100.0 rtol=1E-7 # note < the 1E-6 difference passes due to relative scaling
733733
y = 1E-7
734-
@test 0.0y atol=1E-6 # absolute tolerance!
734+
@test 0.0y atol=1E-6 # absolute tolerance!
735735
```
736736

737737
```{note}
@@ -777,9 +777,9 @@ This is useful for organizing different batches of tests, and executing them all
777777

778778
```{code-cell} julia
779779
@testset "my tests" begin
780-
@test 1 == 1
781-
@test 2 == 2
782-
@test_broken 1 == 2
780+
@test 1 == 1
781+
@test 2 == 2
782+
@test_broken 1 == 2
783783
end;
784784
```
785785
By using `<Shift+Enter>` in VS Code or Jupyter on the testset, you will execute them all. You may want to execute only parts of them during development by commenting out the `@testset` and `end` and execute sequentially until the suite passes.

0 commit comments

Comments
 (0)