= PYTHON {{tag>development python}} == doc * [[info:cursos:pue:python-pcpp1|]] * [[info:cursos:pue:python|]] * [[info:cursos:udemy:python-mega-course]] == install === best practices * entornos virtuales: [[development:python:entornos-virtuales]] * paquetes: [[development:python:pip]] * instalar varias versiones python: [[https://medium.com/@julgq/instalando-m%C3%BAltiples-versiones-de-python-en-linux-ubuntu-20-04-2-lts-9f163c046cc5]] * How to use Python’s **py** launcher for Windows: [[https://www.infoworld.com/article/3617292/how-to-use-pythons-py-launcher-for-windows.html]] * Use ''Poetry'' for package management: curl -sSL https://install.python-poetry.org | python3 - === bootstrap mkdir my-project && cd my-project # Make sure the standard .gitignore is set curl -o .gitignore https://raw.githubusercontent.com/github/gitignore/main/Python.gitignore # init and activate virtual environment python3 -m venv ./venv && source venv/bin/activate # init Poetry. It will rely only the previously created venv, if activated. poetry init -q === test poetry add -g test flake8 autopep8 flake8-annotation poetry install --only test # Using Flake8 for lint poetry run flake8 src # Enforce styling poetry run autopep8 --in-place --recursive src # Using pytype for type checking poetry run #TODO /via: [[https://code.europa.eu/digit-c4/dev/python-best-practices]] === vanilla * default:whereis python sudo update-alternatives --install /usr/bin/python python /usr/bin/python3 20 sudo update-alternatives --config python * entornos virtuales y paquetes: * [[https://docs.python.org/es/3.8/tutorial/venv.html]] * [[https://docs.python.org/3/tutorial/venv.html]] === anaconda (y miniconda) * distribución Python, orientada al desarrollo científico con Python, tanto analítico como gráfico. * Miniconda solo tiene Python + gestor de paquetes **[[development:python:conda]]** == doc * v2: [[http://www.greenteapress.com/thinkpython/thinkpython.pdf]] * [[development:python:thinkpython]] * [[https://es.py4e.com/book]] * [[https://automatetheboringstuff.com/#toc]] * [[https://jakevdp.github.io/PythonDataScienceHandbook/]] * gitignore: [[https://github.com/github/gitignore/blob/main/Python.gitignore]] === more ==== built-in * [[development:python:aberraciones]] * [[development:python:strings]] * [[development:python:iterables]] * [[development:python:typehint]] * [[development:python:datetime]] * [[development:python:excepciones]] * [[development:python:decorators]] * [[https://geekflare.com/es/magic-methods-in-python/|magic methods]] * [[https://medium.com/@johnidouglasmarangon/using-call-method-to-invoke-class-instance-as-a-function-f61396145567]] * [[https://medium.com/@miguel.amezola/demystifying-python-metaclasses-understanding-and-harnessing-the-power-of-custom-class-creation-d7dff7b68de8|metaclases]] * [[https://www.freecodecamp.org/espanol/news/expresiones-lambda-en-python/|lambda o funciones anónimas]] ==== librerias * [[development:python:from]] * [[development:python:pyodbc]] * [[development:python:pycurl]] * [[development:python:pandas]] * [[development:python:bokeh]] ==== otros * Tkinter (GUI): * [[https://wiki.python.org/moin/TkInter]] * sudo apt-get install python python3-tk * functools -> cache * Microsoft Access/SQL Server (PTE) * https://docs.microsoft.com/en-us/sql/connect/python/pyodbc/python-sql-driver-pyodbc?view=sql-server-ver16 * https://www.codegrepper.com/code-examples/python/how+to+open+mdb+file+in+python == más {{topic>python}}