What I've learnt about Python

What I've learnt about Python

If you have Python Installed already.

You can do very cool things with it.

ℹ️
Python can do maaany things… https://github.com/vinta/awesome-python

Python Apps Reliability

A good readme does the trick for any project.

This is a good Python Project Readme.

Python Virtual Envs

There are several ways to install Python Dependencies.

Python must have pip & venv ready 📌
sudo apt install python3-pip
sudo apt install python3.10-venv
Make the dependencies Work: Venv’s in Python 📌

As per Docs

#python -m venv solvingerror_venv #create the venv
python3 -m venv solvingerror_venv #create the venv

#solvingerror_venv\Scripts\activate #activate venv (windows)
source solvingerror_venv/bin/activate #(linux)

Install dependencies with:

#pip install beautifulsoup4 openpyxl pandas numpy==2.0.0
pip install -r requirements.txt #all at once
#pip freeze | grep langchain

#pip show beautifulsoup4
pip list
#pip freeze > requirements.txt #generate a txt with the ones you have!
source .env

#export OPENAI_API_KEY="your-api-key-here"
#set OPENAI_API_KEY=your-api-key-here
#$env:OPENAI_API_KEY="your-api-key-here"
echo $OPENAI_API_KEY

Containers for Python Apps

Making sure a Python app will always work is by building & using containers.

Local container build 📌
#docker build -t trip_planner .
DOCKER_BUILDKIT=1 docker build --no-cache --progress=plain -t trip_planner .
CI/CD container build 📌
You can use tools like: Jenkins, or Github Actions CI/CD Workflows

Python Notebooks

Executing Python code step by step is great for exploratory purposes.

We can do it with the .ipynb, Python notebooks, executed in Google Colaboratory:

Python Notebook - RoutePolar

Open in Google Colab