Differences

This shows you the differences between two versions of the page.

Link to this comparison view

ii:labs:03:tasks:01 [2024/11/06 23:16]
florin.stancu created
ii:labs:03:tasks:01 [2024/11/15 03:31] (current)
alexandru.bala [01. [30p] Python environment]
Line 62: Line 62:
     * install the VScode [[https://​marketplace.visualstudio.com/​items?​itemName=ms-vscode-remote.remote-wsl|wsl extension]]     * install the VScode [[https://​marketplace.visualstudio.com/​items?​itemName=ms-vscode-remote.remote-wsl|wsl extension]]
     * Ctrl + Shift + P -> WSL: open folder in WSL     * Ctrl + Shift + P -> WSL: open folder in WSL
 +
 +You might also want to read the official VSCode documentation about [[https://​code.visualstudio.com/​docs/​python/​environments|virtual environments]].
 </​note>​ </​note>​
  
 <note tip> <note tip>
-This list of dependencies can be exported (together with the exact version) in a way that allows another user to install the __exact__ same modules in their own virtual environments. The file holding this information ​in named by convention //​requirements.txt//:​+This list of dependencies can be exported (together with the exact version) in a way that allows another user to install the __exact__ same modules in their own virtual environments. The file holding this information ​is named by convention //​requirements.txt//:​
  
 <code bash> <code bash>
Line 73: Line 75:
 </​note>​ </​note>​
  
-=== [10p] Task - Testing that it works, with python CLI (REPL) ===+=== [10p] Task 1.4 - Testing that it works, with python CLI (REPL) ===
  
 We can use the **python3** interpreter in interactive mode to quickly test whether our modules installed correctly: ​ We can use the **python3** interpreter in interactive mode to quickly test whether our modules installed correctly: ​
Line 89: Line 91:
 </​note>​ </​note>​
  
 +=== [0p] Task 1.5 - Debugging scripts ===
 +
 +If you ever need to debug your python program, the best approach is to open up a shell and run your program a bit tedious (copy pasting each line of the program). However, there'​s a better method:
 +
 +<code python>
 +import IPython
 +
 +IPython.embed(colors='​neutral'​)
 +</​code>​
 +
 +<note tip>
 +<code bash>
 +$ sudo apt install ipython3
 +</​code>​
 +</​note>​
 +
 +This will stop the execution of your script and open an ipython shell that has access to a copy of all your local & global data. Use this to inspect the state of your variables, their types, etc. Exit the shell (Ctrl + D) to continue the execution.
  
ii/labs/03/tasks/01.1730927777.txt.gz ยท Last modified: 2024/11/06 23:16 by florin.stancu
CC Attribution-Share Alike 3.0 Unported
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0