Wiki

Home

Python

- <https://learnxinyminutes.com/docs/python/>
- <https://github.com/amontalenti/elements-of-python-style>
- <https://github.com/realpython/discover-flask>
- <https://pythonprogramming.net/basic-gui-pyqt-tutorial/>
- Project Layout:
    <http://docs.python-guide.org/en/latest/writing/structure/>
- <https://mitelman.engineering/blog/python-best-practice/automating-python-best-practices-for-a-new-project/>
	-

Debugger/PDB

- <https://pymotw.com/2/pdb/>
- [Documentation](https://docs.python.org/3.10/library/pdb.html#module-pdb)
- [Debugger Commands](https://docs.python.org/3.10/library/pdb.html#debugger-commands)
- [Blog Post](https://djangostars.com/blog/debugging-python-applications-with-pdb/)
- [Interactive PDB](https://pypi.org/project/ipdb/)
- ```bash
  python -m pdb myscript.py
  ```
  
  ```python
  import pdb; pdb.set_trace()
  ```
- [Debugger Commands](https://docs.python.org/3/library/pdb.html#debugger-commands)
	- **h(elp)**
	- **step**
	- **next**
	- **continue**
	- **list**; **ll**
	- **args**
	- **p** or **pp**
	- **interact** (Quit with `Ctrl + d`)
	- **up**/**down**
- Setting a Breakpoint:
	- ```
	  b myscript.py:10
	  b function
	  b requests/sessions.py:555
	  ```
- Use debugger in IPython:
	- [%debug](https://ipython.readthedocs.io/en/stable/interactive/magics.html#magic-debug)
	- [%pdb](https://ipython.readthedocs.io/en/stable/interactive/magics.html#magic-pdb)
	- ```python
	  %debug function()
	  %pdb on
	  %pdb off
	  ```

Argparse

- [Documentation](https://docs.python.org/3.10/howto/argparse.html)
- Example:
  
    ```python
  def parse_args(args=sys.kwargs[1:]):
  	parser = argparse.ArgumentParser()
  	parsed_args = parser.parse_args(args)
  	return args
  ```

Logging

- [Howto](https://docs.python.org/3/howto/logging.html#)
- [Advanced](https://docs.python.org/3/howto/logging.html#advanced-logging-tutorial)
  
  Base Template:
- ```python
  import logging
  
  logger = logging.getLogger(__name__)
  # in main():
  logging.basicConfig(level=logging.DEBUG)
  ```