| 29 | * for **easy data+code sharing** consider using an independent Git |
| 30 | repository, e.g. https://gitlab.fi.muni.cz/. In that case, you shall |
| 31 | store all your source codes and data files in [https://gitlab.fi.muni.cz/ Gitlab] |
| 32 | and just `git clone` the repository to the server. Use `git add`, `git |
| 33 | commit -a` and `git push` to promote changes that you make on the server |
| 34 | back to [https://gitlab.fi.muni.cz/ Gitlab]. Use `git pull` to update the |
| 35 | previously cloned repository in the server directory with changes made |
| 36 | elsewhere. See e.g. the |
| 37 | [https://missing.csail.mit.edu/2020/version-control/#repositories MIT Git info] |
| 38 | for other details about working with Git. |
| 39 | * how to **discover and fix errors** - we suggest two standard options: |
| 40 | `logging` and `pdb` debugging: |
| 41 | - **logging** is based on standard Python |
| 42 | [https://docs.python.org/3/library/logging.html logging library]. It |
| 43 | allows to supplement your program with messages of various levels of |
| 44 | verbosity which can be turned on and off. A simple program may look |
| 45 | like {{{#!python |
| 46 | import logging |
| 47 | |
| 48 | logging.basicConfig( level=logging.DEBUG, format="%(message)s") |
| 49 | |
| 50 | logging.info("Program starting") |
| 51 | a = 2 |
| 52 | b = 2 |
| 53 | logging.debug(f"About to sum {a} and {b}") |
| 54 | logging.info(f"The result is {a+b}") |
| 55 | }}} |
| 56 | - **pdb debugging** is run from the command line with include specific |
| 57 | `pdb` module. Start the debugging via `python -mpdb source.py`, then |
| 58 | use line-based commands as described in the |
| 59 | [https://missing.csail.mit.edu/2020/debugging-profiling/#debuggers MIT code page]. |
| 60 | Command `q` quits the debugger. |