/misc-python-oop

Primary LanguagePythonMIT LicenseMIT

python sanbox / object-oriented programming

setup

system wide python install:

  • fedora
    sudo dnf -y install python3 python3-devel python3-devtools
  • debian/ubuntu
    sudo apt-get install python3-dev python3-setuptools

virtual env:

python3 -m venv .venv
source .venv/bin/activate
python -m pip install -r requirements.txt

run

python main.py

update requirements.txt (optional)

python -m pip install -U pip-chill
python -m pip install -U pip-review
pip-review -a
pip-chill > requirements.txt

teardown

deactivate

beautifier

  • uniformize code style
  • improved code quality
  • reduced merge diffs and conflicts

black

python -m pip install -U black
python -m black --fast --check  .
python -m black --fast  .

linters

  • uniformize code style
  • improved code quality
  • reduced bugs and code smells

pylint

python -m pip install -U pylint
python -m pylint delegation app tests

flake8 (???)

python -m pip install -U flake8
python -m flake8 .

test

python -m pip install -U pytest
python -m pytest

coverage

python -m pip install -U coverage
python -m coverage run -m pytest
python -m coverage report --show-missing --omit="*test*"
python -m coverage html --omit="*test*"
firefox htmlcov/index.html

doc

python -m pip install -U sphinx

PyCharm IDE (optional)

PyCharm Community Edition

https://www.jetbrains.com/fr-fr/pycharm/download/other.html

pylint integration

flake8 integration (?not well integrated?)

https://gitlab.com/ramast/flake8-for-pycharm/ :

python -m pip install -U flake8-for-pycharm

test

coveragev (only in PyCharm Professional)

resources

reference

project structure

object-oriented design

plugins

test

Stubs vs Mocks vs Fakes vs Spy

gui

tkinter

custom tkinter

system wide dependencies install:

python -m pip install -U customtkinter
python -m customtkinter