tag:blogger.com,1999:blog-25774563777235889292024-03-17T20:03:50.563-07:00python-catalinIs a blog about python programming language. You can see my work with python programming language, tutorials and news.Cătălin George Feștilăhttp://www.blogger.com/profile/10800322932529698711noreply@blogger.comBlogger671125tag:blogger.com,1999:blog-2577456377723588929.post-26713014827355991962024-03-10T12:10:00.000-07:002024-03-10T12:10:40.480-07:00Python 3.12.1 : From script to executable with pyinstaller.Using scripts in or out of the environment is useful and accessible. Another version is to create an executable, but it will no longer allow the same access to the source code resource and the executable will not be very buildable.
It is debatable, especially for those who do not trust the compiled language.
Today, I use a Python packet called aaa that allows, through other options, the creation Cătălin George Feștilăhttp://www.blogger.com/profile/10800322932529698711noreply@blogger.comtag:blogger.com,1999:blog-2577456377723588929.post-90266459337910852272024-03-09T04:00:00.000-08:002024-03-09T04:00:34.705-08:00News : All Books Bundle from Michael DriscollFor $60 you can buy a lot of all the card decks from Michael Driscoll.
Get a copy of all my self-published Python eBooks :
Python 101 - 2nd Edition
Python 201: Intermediate Python
ReportLab: PDF Processing with Python
Jupyter Notebook 101
Creating GUI Applications with Python
Pillow: Image Processing with Python
Automating Excel with Python
The Python Quiz Book
Cătălin George Feștilăhttp://www.blogger.com/profile/10800322932529698711noreply@blogger.comtag:blogger.com,1999:blog-2577456377723588929.post-1973497508801070362024-03-09T03:52:00.000-08:002024-03-09T03:52:51.229-08:00News : Website for Python users.Here is a site called clcoding.com for those who use the python language with many simple examples and even a test fairy: python coding challenge day.Cătălin George Feștilăhttp://www.blogger.com/profile/10800322932529698711noreply@blogger.comtag:blogger.com,1999:blog-2577456377723588929.post-9633287924059434742024-03-07T15:17:00.000-08:002024-03-07T15:17:48.927-08:00Python 3.12.1 : flaskcode - an web based code editor.This is an web based code editor on python flask framework.
Let's install with pip tool:
pip install flaskcode
Collecting flaskcode
Downloading flaskcode-0.0.8.tar.gz (14.5 MB)
...
Installing collected packages: flaskcode
Successfully installed flaskcode-0.0.8
The flaskcode can be integrated in to your own Flask app by configuring and registering flaskcode.blueprint with your app:
from flask Cătălin George Feștilăhttp://www.blogger.com/profile/10800322932529698711noreply@blogger.comtag:blogger.com,1999:blog-2577456377723588929.post-25993863832787329402024-03-06T14:50:00.000-08:002024-03-06T14:50:12.713-08:00Python Qt6 : Test application with unittest and QtTest.In this simple example, I add a test class with unittest to sleep the application and QtTest to wait for the window to open after pressing the button.
To run the unittest you need to uncomment this row of source code:
#unittest.main()
Let's see the source code:
import sys
from PyQt6.QtWidgets import QApplication, QDialog, QMainWindow, QPushButton
from PyQt6 import QtCore, QtGui, QtWidgets
from Cătălin George Feștilăhttp://www.blogger.com/profile/10800322932529698711noreply@blogger.comtag:blogger.com,1999:blog-2577456377723588929.post-9170291810970366952024-03-05T11:58:00.000-08:002024-03-05T11:58:13.230-08:00Python 3.12.1 : Bandit tool for security issues in Python code.Bandit is a tool designed to find common security issues in Python code. To do this Bandit processes each file, builds an AST from it, and runs appropriate plugins against the AST nodes. Once Bandit has finished scanning all the files it generates a report.
Bandit was originally developed within the OpenStack Security Project and later rehomed to PyCQA
Installation is simple with the pip tool:.
Cătălin George Feștilăhttp://www.blogger.com/profile/10800322932529698711noreply@blogger.comtag:blogger.com,1999:blog-2577456377723588929.post-27697423729136615132024-03-04T14:29:00.000-08:002024-03-05T11:52:39.952-08:00Python 3.12.1 : Testing pypdf - version 4.1.0 . I tried to find a solution for processing PDF files.
The newer Python package called "unstructured" I tested was a disaster and a waste of time and resources.
Today I will show you tests with the Python package called pypdf with version: 4.1.0.
You can find it on the official page.
Installation is simple with the pip tool and you can also add options offered by crypto.
pip install pypdf[crypto]
Cătălin George Feștilăhttp://www.blogger.com/profile/10800322932529698711noreply@blogger.comtag:blogger.com,1999:blog-2577456377723588929.post-91025346083088562672024-02-24T06:29:00.000-08:002024-02-24T06:29:05.298-08:00Python 3.12.1 : pipx tool .The pip is a general-purpose package installer for both libraries and apps with no environment isolation. pipx is made specifically for application installation, as it adds isolation yet still makes the apps available in your shell: pipx creates an isolated environment for each application and its associated packages.
Install the pipx tool :
python -m pip install --user pipx
Collecting pipx
Cătălin George Feștilăhttp://www.blogger.com/profile/10800322932529698711noreply@blogger.comtag:blogger.com,1999:blog-2577456377723588929.post-37120409880260782262024-02-24T01:31:00.000-08:002024-02-24T01:31:12.774-08:00Python 3.12.1 : The kaitai python module and IDE online tool.Kaitai Struct is a declarative language used to describe various binary data structures, laid out in files or in memory: i.e. binary file formats, network stream packet formats, etc.
The main idea is that a particular format is described in Kaitai Struct language (.ksy file) and then can be compiled with ksc into source files in one of the supported programming languages. These modules will Cătălin George Feștilăhttp://www.blogger.com/profile/10800322932529698711noreply@blogger.comtag:blogger.com,1999:blog-2577456377723588929.post-45713249317433039532024-02-23T11:10:00.000-08:002024-02-23T11:23:21.858-08:00Python 3.10.12 : YOLOv9 with GELAN-C model on colab notebook - part 045.Today I tested YOLOv9 with GELAN-C model. Find the notebook on my GitHub repo.
Cătălin George Feștilăhttp://www.blogger.com/profile/10800322932529698711noreply@blogger.comtag:blogger.com,1999:blog-2577456377723588929.post-7585766096738250852024-02-17T06:12:00.000-08:002024-02-17T06:12:23.118-08:00Python 3.10.12 : Few example for CUDA and NVCC - part 044.NVCC use CUDA C/C++ source code and allows developers to write high-performance GPU-accelerated applications by leveraging the power of NVIDIA GPUs for parallel processing tasks.
Today I test some simple examples with this tool on Google Colab using the nvcc4jupyter python package.
You need to install it with the pip and know how to use the CUDA C/C++ source code, or use the basic example from Cătălin George Feștilăhttp://www.blogger.com/profile/10800322932529698711noreply@blogger.comtag:blogger.com,1999:blog-2577456377723588929.post-72585101547415213822024-02-07T15:26:00.000-08:002024-02-07T15:26:43.520-08:00Python 3.12.1 : Simple view for sqlite table with PyQt6.This is the source code that show you how to use QSqlDatabase, QSqlQuery, QSqlTableModel:
import sys
from PyQt6.QtWidgets import QApplication, QMainWindow, QTableView
from PyQt6.QtSql import QSqlDatabase, QSqlQuery, QSqlTableModel
class MainWindow(QMainWindow):
def __init__(self):
super().__init__()
# Initialize the database
self.init_db()
# Set up the GUI
Cătălin George Feștilăhttp://www.blogger.com/profile/10800322932529698711noreply@blogger.comtag:blogger.com,1999:blog-2577456377723588929.post-18891841445695348342024-02-05T10:51:00.000-08:002024-02-05T10:51:30.943-08:00Python 3.12.1 : Simple browser with PyQt6-WebEngine.This is a source code for a minimal browser with PyQt6 and PyQt6-WebEngine.
You need to install it with the pip tool:
pip install PyQt6 PyQt6-WebEngine
You can update the pip tool with
python.exe -m pip install --upgrade pip
Create a python script use the source code and run it.
Let's see the source code:
import sys
from PyQt6.QtCore import QUrl
from PyQt6.QtGui import QKeySequence, QAction
from Cătălin George Feștilăhttp://www.blogger.com/profile/10800322932529698711noreply@blogger.comtag:blogger.com,1999:blog-2577456377723588929.post-5764154390803458652024-01-16T20:11:00.000-08:002024-01-16T20:11:17.870-08:00News : How to use ShellExecuteA with Python programming language.I just discovery this option to use ShellExecuteA in Python.
Let's see some example:
import ctypes
import sys
def is_admin():
try:
return ctypes.windll.shell32.IsUserAnAdmin()
except:
return False
if not is_admin():
ctypes.windll.shell32.ShellExecuteW(None, "runas", sys.executable, __file__, None, 1)
... and another example:
import sys
import ctypes
#fix unicode Cătălin George Feștilăhttp://www.blogger.com/profile/10800322932529698711noreply@blogger.comtag:blogger.com,1999:blog-2577456377723588929.post-12230354010790847832024-01-11T13:39:00.000-08:002024-01-11T13:39:08.027-08:00News : NVIDIA Kaolin library provides a PyTorch API.NVIDIA Kaolin library provides a PyTorch API for working with a variety of 3D representations and includes a growing collection of GPU-optimized operations such as modular differentiable rendering, fast conversions between representations, data loading, 3D checkpoints, differentiable camera API, differentiable lighting with spherical harmonics and spherical gaussians, powerful quadtree Cătălin George Feștilăhttp://www.blogger.com/profile/10800322932529698711noreply@blogger.comtag:blogger.com,1999:blog-2577456377723588929.post-21548381894001805872024-01-08T13:14:00.000-08:002024-01-08T13:14:17.626-08:00Python 3.12.1 : Create a simple color palette.Today I tested a simple source code for a color palette created with PIL python package.
This is the result:
Let's see the source code:
from PIL import Image, ImageDraw
# 640x640 pixeli with 10x10 squares 64x64
img = Image.new('RGB', (640, 640))
draw = ImageDraw.Draw(img)
# color list
colors = []
# for 100 colors you need to set steps with 62,62,64
# or you can change 64,62,62 some little Cătălin George Feștilăhttp://www.blogger.com/profile/10800322932529698711noreply@blogger.comtag:blogger.com,1999:blog-2577456377723588929.post-81398328470772118912024-01-06T03:00:00.000-08:002024-02-17T05:52:09.415-08:00Python 3.10.12 : LaTeX on colab notebook - part 043.Today I tested with a simple LaTeX examples in the Colab notebook.
If you open my notebook colab then you will see some issues and how can be fixed.
You can find this on my notebook - catafest_056.ipynb on colab repo.Cătălin George Feștilăhttp://www.blogger.com/profile/10800322932529698711noreply@blogger.comtag:blogger.com,1999:blog-2577456377723588929.post-348790593967947032024-01-05T05:21:00.000-08:002024-01-05T05:21:35.709-08:00Python 3.12.1 : How to read all CLSID with winreg.The winreg python module can be found default into python instalation.
This is the source code I used to list all of CLSID:
import winreg
# Open the CLSID key under HKEY_CLASSES_ROOT
clsid_key = winreg.OpenKey(winreg.HKEY_CLASSES_ROOT, "CLSID")
# Iterate through all the subkeys
for i in range(winreg.QueryInfoKey(clsid_key)[0]):
# Get the name of the subkey
subkey_name = winreg.EnumKey(Cătălin George Feștilăhttp://www.blogger.com/profile/10800322932529698711noreply@blogger.comtag:blogger.com,1999:blog-2577456377723588929.post-50539225583344592362023-12-22T08:17:00.000-08:002023-12-22T08:17:23.320-08:00Python : MLOps with neptune.ai .I just started testing with neptune.ai.
Neptune is the MLOps stack component for experiment tracking. It offers a single place to log, compare, store, and collaborate on experiments and models.
MLOps or ML Ops is a paradigm that aims to deploy and maintain machine learning models in production reliably and efficiently.
MLOps is practiced between Data Scientists, DevOps, and Machine Learning Cătălin George Feștilăhttp://www.blogger.com/profile/10800322932529698711noreply@blogger.comtag:blogger.com,1999:blog-2577456377723588929.post-77326373034282000762023-12-10T01:11:00.000-08:002024-02-17T05:51:55.334-08:00Python 3.10.12 : Simple examples with some Python modules - part 042.I added some simple examples in my repo on GitHub where I have notebooks from Google Colab.
Python usage is limited to this type of interface with Python version stability rules.
You can see the Python version that Colab is using with this command in the code area:
!python
Python 3.10.12 (main, Nov 20 2023, 15:14:05) [GCC 11.4.0] on linux
Type "help", "copyright", "credits" or "license" for more Cătălin George Feștilăhttp://www.blogger.com/profile/10800322932529698711noreply@blogger.comtag:blogger.com,1999:blog-2577456377723588929.post-62581082610431000392023-12-07T13:08:00.000-08:002023-12-07T13:08:42.470-08:00Python 3.13.0a1 : Testing with scapy - part 001.Scapy is a powerful interactive packet manipulation library written in Python. Scapy is able to forge or decode packets of a wide number of protocols, send them on the wire, capture them, match requests and replies, and much more. see the official website.
You need to install NPCap.
Beacon frames are transmitted periodically, they serve to announce the presence of a wireless LAN and to Cătălin George Feștilăhttp://www.blogger.com/profile/10800322932529698711noreply@blogger.comtag:blogger.com,1999:blog-2577456377723588929.post-59334673482181859792023-12-06T15:50:00.000-08:002024-02-17T05:51:20.619-08:00Python 3.10.12 : Simple example with SymPy - part 041.SymPy is a Python library for symbolic mathematics. If you are new to SymPy, start with the introductory tutorial.
You can find a simple example with a partial differentiation on my GitHub colab repo.Cătălin George Feștilăhttp://www.blogger.com/profile/10800322932529698711noreply@blogger.comtag:blogger.com,1999:blog-2577456377723588929.post-80997068213618979332023-11-27T13:41:00.000-08:002023-11-27T13:41:15.892-08:00Python 3.10.12 : My colab get images from imdb.com by the name - part 040.Transformers provides thousands of pretrained models to perform tasks on different modalities such as text, vision, and audio.
You find more on my Colab Github repo.Cătălin George Feștilăhttp://www.blogger.com/profile/10800322932529698711noreply@blogger.comtag:blogger.com,1999:blog-2577456377723588929.post-11216495100041728642023-11-27T12:26:00.000-08:002023-11-27T12:26:22.029-08:00Python 3.13.0a1 : How to use PyOTP for Microsoft Authenticator.PyOTP is a Python library for generating and verifying one-time passwords. It can be used to implement two-factor (2FA) or multi-factor (MFA) authentication methods in web applications and in other systems that require users to log in.
Read more on this official webpage.
I teste with Microsoft Authenticator from Google play.
Install with pip tool and use this source code:
import pyotp
# GenerareCătălin George Feștilăhttp://www.blogger.com/profile/10800322932529698711noreply@blogger.comtag:blogger.com,1999:blog-2577456377723588929.post-2614526474854311282023-11-27T12:11:00.000-08:002023-11-27T12:11:38.115-08:00Python 3.10.12 : My colab get images from imdb.com by the name - part 039.You can use gspread and google-auth to get data from a spreadsheet from google drive and use it.
The colab notebook can be found on my colab repo on Github.
from google.colab import auth
auth.authenticate_user()
import gspread
from google.auth import default
creds, _ = default()
gc = gspread.authorize(creds)
# Open the spreadsheet by name
spreadsheet = gc.open('fiecare_saptamana')
# Choose a Cătălin George Feștilăhttp://www.blogger.com/profile/10800322932529698711noreply@blogger.com