Planet Python RSS
217 subscribers
16.7K links
Unofficial Planet Python RSS feed from planetpython.org. Maintained by @cfinnberg
Download Telegram
Real Python: Working With JSON Data in Python

Link: https://realpython.com/python-json/

Python’s json module provides you with the tools you need to effectively handle JSON data. You can convert Python data types to a JSON-formatted string with json.dumps() or write them to files using j
Real Python: Strings and Character Data in Python

Link: https://realpython.com/python-strings/

Python strings are a sequence of characters used for handling textual data. You can create strings in Python using quotation marks or the str() function, which converts objects into strings. Strings i
Zato Blog: Using OAuth in API Integrations

Link: https://zato.io/en/blog/oauth-api-integrations.html


Using OAuth in API Integrations


2024-12-23, by Dariusz Suchojad


OAuth is often employed in processes requiring permissions to be granted to frontend applications and end users.
Yet, what we typ
Mike Driscoll: An Intro to pre-commit

Link: https://www.blog.pythonlibrary.org/2024/12/23/an-intro-to-pre-commit/

You can use many great tools to help you in your software development journey. One such tool is pre-commit, a framework for managing and maintaining multi-language pre-commit hooks. You use pre-commit
Real Python: How to Remove Items From Lists in Python

Link: https://realpython.com/remove-item-from-list-python/

Removing items from a Python list is a common task that you can accomplish with various techniques. Whether you need to remove an item by its position or value, Python has you covered. In this tutoria
Juri Pakaste: New Swift Package: provision-info

Link: https://juripakaste.fi/provision-info/

I released a new Swift library! provision-info is a Swift package for macOS. Its purpose is to parse and show information about provisioning profile files. There's a command line tool and Swift librar
Juri Pakaste: New Swift Package: tui-fuzzy-finder

Link: https://juripakaste.fi/fuzzy-tui/

Speaking of new Swift libraries, I released another one: tui-fuzzy-finder is a terminal UI library for Swift that provides an incremental search and selection UI that imitates the core functionality o
Daniel Roy Greenfeld: TIL: run vs source

Link: https://daniel.feldroy.com/posts/til-2024-12-difference-between-run-and-source

Run
A run launches a child process in a new bash within bash, so variables last only the lifetime of the command. This is why launching Python environments doesn't use run.
./list-things.sh

Source
A
Daniel Roy Greenfeld: TIL: Autoreload for Jupyter notebooks

Link: https://daniel.feldroy.com/posts/til-2024-11-autoreload-for-jupyter-notebooks

Add these commands to the top of a notebook within a Python cell. Thanks to Jeremy Howard for the tip.
%load_ext autoreload
%autoreload 2
Daniel Roy Greenfeld: Using locust for load testing

Link: https://daniel.feldroy.com/posts/2024-11-using-locust-for-load-testing

Locust is a Python library that makes it relatively straightforward to write Python tests. This heavily commented code example explains each section of code. To use locust:

Install locust: pip instal
Daniel Roy Greenfeld: TIL: Using Python to removing prefixes and suffixes

Link: https://daniel.feldroy.com/posts/til-2024-10-removing-prefixes-and-suffixes

Starting in Python 3.9, s.removeprefix() and s.removesuffix() were added as str built-ins. Which easily covers all the versions of Python I currently support.
Usage for removeprefix():
>>> 'Spam, Spam
Daniel Roy Greenfeld: TIL: Using hx-swap-oob with FastHTML

Link: https://daniel.feldroy.com/posts/til-2024-12-using-hx-swap-oob-with-fasthtml

Until now I didn't use this HTMX technique, but today Audrey Roy Greenfeld and I dove in together to figure it out. Note that we use language that may not match HTMX's description, sometimes it's bett
Daniel Roy Greenfeld: TIL: Arity

Link: https://daniel.feldroy.com/posts/til-2024-12-arity

I'm excited to have learned there's a word for the count of arguments to a function/method/class: arity. Throughout my career I would have called this any of the following:

number_of_args
param_count
Daniel Roy Greenfeld: TIL: Python's defaultdict takes a factory function

Link: https://daniel.feldroy.com/posts/til-2024-12-defaultdict-takes-a-factory-function

I've never really paid attention to this object but maybe I should have. It takes a single argument of a callable function. If you put in Python types it sets the default value to those types. For exa
Daniel Roy Greenfeld: TIL: Python Dictonary Merge Operator

Link: https://daniel.feldroy.com/posts/til-2024-11-python-dictonary-merge-operator

The function way
Until today I did this:
# Make first dict
num_map = {
'one': '1', 'two': '2', 'three': '3', 'four': '4',
'five': '5', 'six': '6', 'seven': '7', 'eight': '8',
'nine': '9'
}
Daniel Roy Greenfeld: TIL: Fractional Indexing

Link: https://daniel.feldroy.com/posts/til-2024-11-fractional-indexing

In the past when I've done this for web pages and various other interfaces it has been a mess. I've built ungainly sort order in numeric or alphanumeric batches. Inevitably there is a conflict, often
Daniel Roy Greenfeld: TIL: SequentialTaskSet for Locust

Link: https://daniel.feldroy.com/posts/til-2024-11-sequentialtaskset-for-locust

SequentialTaskSet makes it so Locust tasks happen in a particular order, which ensures your simulated users are clicking around in a more human manner at a more human pace. Attribution goes to Audrey
Python Bytes: #415 Just put the fries in the bag bro

Link: https://pythonbytes.fm/episodes/show/415/just-put-the-fries-in-the-bag-bro

<strong>Topics covered in this episode:</strong><br>

<ul>
<li><a href="https://github.com/dbos-inc/dbos-transact-py?featured_on=pythonbytes"><strong>dbos-transact-py</strong></a></li>
<li><strong><a