Python Icon

Python

Python is a dynamically typed programming language.
248 Stories
All Topics

Will McGugan github.com

Free code reviews for open source Python projects

Will McGugan is a full-stack developer and Python expert who is offering up free reviews for any/all qualifying open source projects.What a great idea/service to the community!

The reviews will focus on API design and general architection of your project with a view to making them a) more maintainable b) future proof and c) user friendly, but will avoid anything that a linter could do for you. Reviews are intended to be constructive and hopefully give advice you can act on, but are in no way a “grade”.

I won’t need to run your code to do a review and reviews aren’t intended to fix bugs.

All reviews will be public and will be published in the repo in a markdown file. An exception would be for any security issues, where I would notify you first.

Not everyone all at once, now. There’s already quite a few requests in the queue.

Docker gitlab.com

Harbormaster – easily deploy many Docker-Compose apps on a single host

Here’s their pitch:

Do you have a home server you want to run a few apps on, but don’t want everything to
break every time you upgrade the OS? Do you want automatic updates but don’t want to buy
an extra 4 servers so you can run Kubernetes?

Do you have a work server that you want to run a few small services on, but don’t want
to have to manually manage it? Do you find that having every deployment action be in
a git repo more tidy?

Harbormaster is for you.

You create a YAML config file with all the git repos you want it to include and it’ll watch them for changes (on a timer) and do the necessary cloning/pulling, service restarting, etc. that needs doing to make it all run. Simple. Neat!

AI (Artificial Intelligence) github.com

Jina – build search-as-a-service powered by deep learning in just minutes

Jina calls itself a “cloud-native neural search framework”. What is neural search, exactly?

The core idea of neural search is to leverage state-of-the-art deep neural networks to build every component of a search system. In short, neural search is deep neural network-powered information retrieval. In academia, it’s often called neural IR.

And what can it do for you?

Thanks to recent advances in deep neural networks, a neural search system can go way beyond simple text search. It enables advanced intelligence on all kinds of unstructured data, such as images, audio, video, PDF, 3D mesh, you name it.

For example, retrieving animation according to some beats; finding the best-fit memes according to some jokes; scanning a table with your iPhone’s LiDAR camera and finding similar furniture at IKEA. Neural search systems enable what traditional search can’t: multi/cross-modal data retrieval.

This project looks quite established and collaborative. 172 contributors and counting…

Privacy github.com

A self-hosted, ad-free, privacy-respecting metasearch engine

Get Google search results, but without any ads, javascript, AMP links, cookies, or IP address tracking. Easily deployable in one click as a Docker app, and customizable with a single config file. Quick and simple to implement as a primary search engine replacement on both desktop and mobile.

Includes quick deployment to Heroku, Replit, and Fly. Or you can run it locally, of course via standard Python tooling or Docker.

Security github.com

A digital image forensic toolset

Sherloq is a personal research project about implementing a fully integrated environment for digital image forensics. It is not meant as an automatic tool that decide if an image is forged or not (that tool probably will never exist…), but as a companion in experimenting with various algorithms found in the latest research papers and workshops.

The original version was written in C++ in 2015, but a port to Python is in the works. It looks super useful, but buyer beware:

I’m happy to share my code and get in contact with anyone interested to improve or test it, but please keep in mind that this repository is not intended for distributing a final product, my aim is just to publicly track development of an unpretentious educational tool, so expect bugs, unpolished code and missing features! ;)

A digital image forensic toolset

Brett Cannon snarky.ca

Introducing the Python launcher for Unix

Brett Cannon:

… over 3 years ago I set out to re-implement the Python Launcher for Unix in Rust. On July 24, 2021, I launched 1.0.0 of the Python Launcher for Unix… This gives you a py command on Unix which will always use the newest version of Python.

He goes on to describe some workflow niceties that a built in and also what this project is not about:

The Launcher is purely a convenience and not meant to be The Launcher For All Things; this should never end up in a Docker container.

Ned Batchelder nedbatchelder.com

On reading code with your eyebrows

Ned Batchelder, after reading some code to termine whether or not it was “Pythonic”:

My first response was that I don’t like this code, because I had to read it with my eyebrows. That is, I furrow my brow, and read slowly, and scowl at the code as I puzzle through it. This code is dense and tricky.

Is it Pythonic? I guess in the sense that it uses a number of Python-specific constructs and tools, yes. But not in the sense of Python code being clear and straightforward. It uses Python thoroughly, but misses the spirit.

(He then rewrites it in a way that he likes. Which solution do you prefer?)

I’m no Pythonista, so I don’t know what is or isn’t “Pythonic”. However, I do know that I love the phrase, “read it with my eyebrows”, because I’ve quite literally done this my entire career. I used to invoke my eyebrows and conclude that I was just bad at reading code. Now when I invoke them I conclude that the code I’m reading is bad.

Martin Heinz martinheinz.dev

The unknown features of Python's `operator` module

At the first glance Python’s operator module might not seem very interesting. It includes many operator functions for arithmetic and binary operations and a couple of convenience and helper functions. They might not seem so useful, but with help of just a few of these functions you can make your code faster, more concise, more readable and more functional. So, in this article we will explore this great Python module and make the most out of the every function included in it.

Nikita Sobolev sobolevn.me

Typeclasses in Python

In this post, I explain what typeclasses are (an alternative to subtyping polymorphism) and how to use them. I give examples in 4 very different languages to show that this concept is universal. I also show that this idea is very pythonic by comparing our classes implementation with functools.singledispatch.

Check how easy it is to define a typeclass with classes:

from classes import AssociatedType, Supports, typeclass

class Greet(AssociatedType):
    """Special type to represent that some instance can `greet`."""

@typeclass(Greet)
def greet(instance) -> str:
    """No implementation needed."""

@greet.instance(str)
def _greet_str(instance: str) -> str:
    return 'Hello, {0}!'.format(instance)

def greet_and_print(instance: Supports[Greet]) -> None:
    print(greet(instance))

greet_and_print('world')
# Hello, world!

Check it out!

Bitcoin karpathy.github.io

A from-scratch tour of bitcoin in Python

Andrej Karpathy, Sr. Director of AI at Tesla:

We are going to create, digitally sign, and broadcast a Bitcoin transaction in pure Python, from scratch, and with zero dependencies. In the process we’re going to learn quite a bit about how Bitcoin represents value. Let’s get it.

This post is a technical deep-dive. At the end he posted a reader exercise which was to steal some bitcoins his wallet. The challenge, of course, was completed within 45 minutes of publishing. 😁

Facebook Engineering Icon Facebook Engineering

A data augmentations library for audio, image, text, and video

AugLy is a great library to utilize for augmenting your data in model training, or to evaluate the robustness gaps of your model! We designed AugLy to include many specific data augmentations that users perform in real life on internet platforms like Facebook’s – for example making an image into a meme, overlaying text/emojis on images/videos, reposting a screenshot from social media. While AugLy contains more generic data augmentations as well, it will be particularly useful to you if you’re working on a problem like copy detection, hate speech detection, or copyright infringement where these “internet user” types of data augmentations are prelevant.

A data augmentations library for audio, image, text, and video

Practical AI Practical AI #138

Multi-GPU training is hard (without PyTorch Lightning)

William Falcon wants AI practitioners to spend more time on model development, and less time on engineering. PyTorch Lightning is a lightweight PyTorch wrapper for high-performance AI research that lets you train on multiple-GPUs, TPUs, CPUs and even in 16-bit precision without changing your code! In this episode, we dig deep into Lightning, how it works, and what it is enabling. William also discusses the Grid AI platform (built on top of PyTorch Lightning). This platform lets you seamlessly train 100s of Machine Learning models on the cloud from your laptop.

Opensource.com Icon Opensource.com

How I teach Python on the Raspberry Pi 400 at the public library

Don Watkins:

Mark Van Doren said, “the art of teaching is the art of assisting discovery.” I saw that play out in this classroom using open source tools. More students need opportunities like this to help them gain a quality education. The Raspberry Pi 400 is a great form factor for teaching and learning.

Such a cool program that’d be easy to reproduce in your local library.

The Changelog The Changelog #444

Every commit is a gift

Maintainer Week is finally here and we’re excited to make this an annual thing! If Maintainer Week is new to you, check out episode #442 with Josh Simmons and Kara Sowles.

Today we’re talking Brett Cannon. Brett is Dev Manager of the Python Extension for VS Code, Python Steering Council Member, and core team member for Python. He recently shared a blog post The social contract of open source, so we invited Brett to join us for Maintainer Week to discuss this topic in detail.

Thank a maintainer on us! We’re printing a limited run t-shirt that’s free for maintainers, and all you gotta do is thank them, today!

MongoDB github.com

Mongita is to MongoDB as SQLite is to SQL

Mongita is a lightweight embedded document database that implements a commonly-used subset of the MongoDB/PyMongo interface. Mongita differs from MongoDB in that instead of being a server, Mongita is a self-contained Python library. Mongita can be configured to store its documents either on disk or in memory.

I can’t speak to the implementation, but I love the idea behind this project. Already know and love Mongo? Here’s a way to use it in an embedded fashion with all of the advantages that come with such an architecture…

Coronavirus github.com

A bot to notify you when vaccine appointments are available

Supports checking Hy-Vee, Cosentino’s stores (KC), Ball’s stores (KC), Rapid Test KC, and locations checked by VaccineSpotter (including Walmart, Walgreens, CVS, Costco).

Supports sending notifications to Slack, Discord, Microsoft Teams, Twilio, and Twitter.

Notifications are sent when a location has appointments. No more notifications are sent for that location until it becomes unavailable again.

Bitcoin cryptomaton.org

How to create a trading bot that buys Bitcoin when Elon Musk tweets about it

Why do something like this? For the fun of it, mostly. Definitely not for this reason:

By creating a crypto trading bot that buys bitcoin every time the Tesla boss tweets about it you can rest assured that you are going to catch a VIP seat on the rocket that will slingshot right past the moon and make its way directly to Mars, where Elon spends most of the summer months due to its cold weather and dry climate.

Lulz aside, I love posts like this because they demonstrate how someone tied together a bunch of disparate things (Twitter API, trading API, regular expressions, etc.) to accomplish a real thing, no matter how silly/foolish that real thing is.

Also check out part 2 where he adds sentiment analysis. (Although, it’s hard for me –a human– to decipher Elon Musk’s tweets, so the results of said analysis are probably no better than flipping a coin.)

0:00 / 0:00