virtualenv venv
. venv/bin/activate
pip install --editable .
 -
                
                https://links.infomee.fr/?ruUKGA
  
 -
                
                https://links.infomee.fr/?ruUKGA -
                
                https://dev.to/moniquelive/auto-activate-and-deactivate-python-venv-using-zsh-4dlm
  
 -
                
                https://dev.to/moniquelive/auto-activate-and-deactivate-python-venv-using-zsh-4dlmYou want to really understand decorators? Watch this video!
boilerplate:
import functools
def decorator(func):
    @functools.wraps(func)
    def wrapper_decorator(*args, **kwargs):
        # Do something before
        value = func(*args, **kwargs)
        # Do something after
        return value
    return wrapper_decorator -
                
                https://youtu.be/MjHpMCIvwsY
  
 -
                
                https://youtu.be/MjHpMCIvwsYWhen you want to publish a beta version, you can use a special tag that won't be proposed to client using pip install package --upgrade
example :
current version = 3.0.1
next version = 3.1.0
I can tag with 3.1.0-alpha.1
pip install --upgrade won't upgrade to this version but pip install package==3.1.0-alpha.1 will
 -
                
                https://the-hitchhikers-guide-to-packaging.readthedocs.io/en/latest/specification.html
  
 -
                
                https://the-hitchhikers-guide-to-packaging.readthedocs.io/en/latest/specification.htmldjango template does not like defaultdict, 2 solutions:
1) set default_factory to None
or
2) cast defaultdict to a simpledict
"The template variable resolution algorithm in Django will attempt to resolve new_data.items as new_data['items'] first, which resolves to an empty list when using defaultdict(list)."
 -
                
                https://stackoverflow.com/questions/4764110/django-template-cant-loop-defaultdict
  
 -
                
                https://stackoverflow.com/questions/4764110/django-template-cant-loop-defaultdict# filter out all elements not with x > 5
a = [el for el in data if el['x'] > 5]
# get all the 'c' attributes as a list
b = [el['c'] for el in data]
# get all the 'c' attributes for the elements with x > 5
c = [el['c'] for el in data if el['x'] > 5]
In Jinja2:
a: {{ data | selectattr('x', 'gt', 5) | list }}
b: {{ data | map(attribute='c') | list }} 
c: {{ data | selectattr('x', 'gt', 5) | map(attribute='c') | list }}  -
                
                https://github.com/pallets/jinja/issues/1068
  
 -
                
                https://github.com/pallets/jinja/issues/1068Ce truc obscur qui t'arrive et où la solution se trouve au fond d'une PR
export OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YES
 -
                
                https://github.com/ansible/ansible/issues/32499
  
 -
                
                https://github.com/ansible/ansible/issues/32499 -
                
                https://stackoverflow.com/questions/17140886/how-to-search-and-replace-text-in-a-file
  
 -
                
                https://stackoverflow.com/questions/17140886/how-to-search-and-replace-text-in-a-filepython dependency management with lock file
 -
                
                https://github.com/jazzband/pip-tools
  
 -
                
                https://github.com/jazzband/pip-tools++++++++++++++++++++++
Version avec interface cmd
++++++++++++++++++++++
Prérequis :
pip install pudb
Pour docker, dans le docker compose ajouter
stdin_open: true
tty: true
Faire docker attach container_name
Comment break/debug :
Là où on veut break, il suffit de coller cette ligne : import pudb; pu.db
Dans le terminal où on a fait docker attach on doit voir l'interface de pudb
++++++++++++++++++++++
Version + simple
++++++++++++++++++++++
Prérequis : python 3.7
Pour docker, dans le docker compose ajouter
stdin_open: true
tty: true
Faire docker attach container_name
Comment break/debug :
breakpoint()
Dans le terminal où on a fait docker attach on doit voir un prompt
On peut print les variables
"continue" pour continuer 
 -
                
                https://links.infomee.fr/?lTcZoA
  
 -
                
                https://links.infomee.fr/?lTcZoA