Skip to main content

72 posts tagged with "python"

python tag description

View All Tags

Why and when to use the Pendulum module in Python

· 5 min read
Serhii Hrekov
software engineer, creator, artist, programmer, projects founder

Pendulum is a Python library designed to simplify working with dates and times, often serving as a more developer-friendly and robust replacement for Python's built-in datetime module. You should use Pendulum whenever your application involves timezone handling, complex arithmetic, or serialization/parsing of date strings, as it provides clear, unambiguous, and efficient methods for these tasks.

Python Pip most useful commands and use cases

· 5 min read
Serhii Hrekov
software engineer, creator, artist, programmer, projects founder

Pip is the standard package installer for Python. It allows you to manage the libraries and dependencies needed for your projects. Mastering a few core commands can significantly streamline your Python development workflow.

Switching Python Versions: Comprehensive Guide

· 6 min read
Serhii Hrekov
software engineer, creator, artist, programmer, projects founder

Managing the active Python version is critical for development, especially when working on projects with different dependencies or legacy requirements. The methods vary significantly depending on whether you are using a dedicated version manager, a package manager, or system-level tools.

All Possible Ways to Remove Timezone Information from a Python `datetime` Object

· 7 min read
Serhii Hrekov
software engineer, creator, artist, programmer, projects founder

A Python datetime object is considered timezone-aware if its tzinfo attribute is set, and timezone-naive if tzinfo is None. Removing timezone information, or "making it naive," is the process of setting this attribute to None.

The key consideration when stripping the timezone is which time value you want to keep: the time as it was originally represented, or the time converted to a standard reference (like UTC or local time) before stripping the timezone.

Poetry Fails to Install Multidict: Pyenv, Compilers, and Wheels

· 6 min read
Serhii Hrekov
software engineer, creator, artist, programmer, projects founder

If your poetry install command is failing specifically when trying to install multidict (or packages that depend on it, like aiohttp or discord.py), the root cause is almost always a failure to compile the optional C extensions for the package.

Since multidict offers pre-compiled binaries (wheels) for standard Python versions on common operating systems, a compilation error indicates one of two things: the wheel is unavailable for your specific setup, or the local build tools are missing. Your use of pyenv often exacerbates the issue by complicating the environment setup.

Generate QR code using a URL link

· 5 min read
Serhii Hrekov
software engineer, creator, artist, programmer, projects founder

Generating a QR code for a PDF file is not a matter of embedding the entire file's data into the QR code. QR codes have a strict data limit (typically up to about 4,000 characters), which is far too small for most PDF documents 1.

The correct, industry-standard approach is to host the PDF online and encode the resulting direct URL into the QR code. When a user scans the code, their device opens the URL, which automatically downloads or displays the PDF.

Here is the guide for generating the QR code using a URL link.

QR code reader in Python

· 5 min read
Serhii Hrekov
software engineer, creator, artist, programmer, projects founder

Python QR code reader from image or How to decode a QR-code image in python?

Decoding a QR code from an image in Python is primarily achieved using the pyzbar library, which reads various bar codes and QR codes 1, 2.

Create QR code generator with logo

· 6 min read
Serhii Hrekov
software engineer, creator, artist, programmer, projects founder

How to create QR code generator with logo with Python

Creating a QR code generator with logo in Python is best done using the qrcode library, specifically its advanced image capabilities, combined with Pillow (PIL) for image handling. This guide provides two methods: a simple, modern approach and a manual, detailed approach.