Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 24 additions & 26 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -87,29 +87,27 @@ jobs:
name: build-publish
path: _build
# Sync Download Notebooks
# - name: Prepare lecture-julia.notebooks sync
# shell: bash
# run: |
# mkdir -p _build/lecture-julia.notebooks
# cp -a _notebook_repo/. _build/lecture-julia.notebooks
# cp -a _build/jupyter/. _build/lecture-julia.notebooks
# rm -r _build/lecture-julia.notebooks/_static
# rm -r _build/lecture-julia.notebooks/_panels_static
# cp lectures/Project.toml _build/lecture-julia.notebooks
# cp lectures/Manifest.toml _build/lecture-julia.notebooks
# ls -a _build/lecture-julia.notebooks
# - name: Commit notebooks to lecture-julia.notebooks
# shell: bash -l {0}
# env:
# QE_SERVICES_PAT: ${{ secrets.QUANTECON_SERVICES_PAT }}
# run: |
# git clone https://quantecon-services:$QE_SERVICES_PAT@github.com/quantecon/lecture-julia.notebooks

# cp _build/lecture-julia.notebooks/*.ipynb lecture-julia.notebooks

# cd lecture-julia.notebooks
# git config user.name "QuantEcon Services"
# git config user.email "admin@quantecon.org"
# git add *.ipynb
# git commit -m "auto publishing updates to notebooks"
# git push origin main
- name: Prepare lecture-julia.notebooks sync
shell: bash
run: |
mkdir -p _build/lecture-julia.notebooks
cp -a _notebook_repo/. _build/lecture-julia.notebooks
cp -a _build/jupyter/. _build/lecture-julia.notebooks
rm -r _build/lecture-julia.notebooks/_static
rm -r _build/lecture-julia.notebooks/_panels_static
cp lectures/Project.toml _build/lecture-julia.notebooks
cp lectures/Manifest.toml _build/lecture-julia.notebooks
ls -a _build/lecture-julia.notebooks
- name: Commit notebooks to lecture-julia.notebooks
shell: bash -l {0}
env:
QE_SERVICES_PAT: ${{ secrets.QUANTECON_SERVICES_PAT }}
run: |
git clone https://quantecon-services:$QE_SERVICES_PAT@github.com/quantecon/lecture-julia.notebooks
cp _build/lecture-julia.notebooks/*.ipynb lecture-julia.notebooks
cd lecture-julia.notebooks
git config user.name "QuantEcon Services"
git config user.email "admin@quantecon.org"
git add *.ipynb
git commit -m "auto publishing updates to notebooks"
git push origin main
4 changes: 2 additions & 2 deletions format_myst.jl
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ function format_myst(input_file_path, output_file_path, extra_replacements = fal
end

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

# Replace the code blocks in the content and handle exceptions
try
Expand Down
4 changes: 2 additions & 2 deletions lectures/software_engineering/need_for_speed.md
Original file line number Diff line number Diff line change
Expand Up @@ -750,7 +750,7 @@ end
Calls to this function run very quickly

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

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

```{code-cell} julia
Expand Down
26 changes: 13 additions & 13 deletions lectures/software_engineering/testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ This specifies metadata like the license we'll be using (MIT by default), the lo
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.

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

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

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.

* 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.
* 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.
* Then, add in the `Expectations.jl` package

```{figure} /_static/figures/vscode_add_package.png
Expand Down Expand Up @@ -435,8 +435,8 @@ module MyProject

using Expectations, Distributions

function foo(μ = 1., σ = 2.)
d = Normal(μ, σ)
function foo(mu = 1., sigma = 2.)
d = Normal(mu, sigma)
E = expectation(d)
return E(x -> sin(x))
end
Expand Down Expand Up @@ -465,9 +465,9 @@ Then calling `foo()` with the default arguments in the REPL. This should lead t
Next, we will change the function in the package and call it again in the REPL:
* Modify the `foo` function definition to add `println("Modified foo definition")` inside the function
```{code-block} julia
function foo(μ = 1., σ = 2.)
function foo(mu = 1., sigma = 2.)
println("Modified foo definition")
d = Normal(μ, σ)
d = Normal(mu, sigma)
E = expectation(d)
return E(x -> sin(x))
end
Expand Down Expand Up @@ -729,9 +729,9 @@ For example,
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
```{code-cell} julia
x = 100.0 + 1E-6 # within the tolerance
@test x100.0 rtol=1E-7 # note < the 1E-6 difference passes due to relative scaling
@test x100.0 rtol=1E-7 # note < the 1E-6 difference passes due to relative scaling
y = 1E-7
@test 0.0y atol=1E-6 # absolute tolerance!
@test 0.0y atol=1E-6 # absolute tolerance!
```

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

```{code-cell} julia
@testset "my tests" begin
@test 1 == 1
@test 2 == 2
@test_broken 1 == 2
@test 1 == 1
@test 2 == 2
@test_broken 1 == 2
end;
```
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.
Expand Down