Categories
Internet & Culture

usermanagement with django allauth.

usermanagement with django allauth: It is common for bots to register with a website. Often enough there are users instances in the user base that have registered at some point but did not verify their email-address.

Fortunately enough, for users of django and the excellent django-allauth, there are easy ways to manage these users.

First, the django ORM comes with an easy way to identify these users that did not verify their primary email:

>>> from django.contrib.auth.models import User
>>> unverified_users = User.objects.filter(emailaddress__verified=False, emailaddress__primary=True)
Bot User Management with django allauth
Mobile Phone User – Munich

The ORM allows simple filtering for unverified email addresses through a “relationship lookup”, that is emailaddress__verified=False in the above snippet. Of course, you may want to limit users for which the primary email address is unverified. That is the 2nd keyword argument to .filter() here: emailaddress__primary=True. The filter operator ANDs together these two conditions.

To identify users that not only have unverified, primary email addresses, but also appear to be idle, you may limit users that didn’t login through .exclude():

>> import datetime
>> old_unverified_users = unverified_users.exclude(last_login__gt=datetime.date(2020, 1, 1))

Will only give you users that have logged in after Jan 1st, 2020. Of course, the argument to last_login can be modified to match your requirements.

Finally, you may chose to either email these users and re-ask to verify their email. That would be a separate task, though. In our case, we simply delete these, since they are obviously not interessted in using our site:

old_unverified_users.delete() 

Categories
Product, Projekt & Agile

The Mind at Work: Guido van Rossum on how Python makes thinking in code easier

Python, the programming language, gained lot’s of popularity only in the past decade. In particular for big data applications, machine learning and data science the language is almost without alternative. But also for tool development or web applications backends, Python has huge adoption. Reasons are it’s huge ecosystem and a friendly, constructive community. Despite it’s newer competitors it has been around for 30 years. One of the most appreciated benefits is the steep learning curve, that allows virtually everyone to understand Python code.

Dropbox has an interview with Guido van Rossum, who published the first version of the language in 1989. The conversation revolves around the purpose of code and how python helps improve cooperation and productivity.

Guido van Rossum
Guido van Rossum

“You primarily write your code to communicate with other coders, and, to a lesser extent, to impose your will on the computer.”

Guido van Rossum

A conversation with the creator of the world’s most popular programming language on removing brain friction for better work. Source: The Mind at Work: Guido van Rossum on how Python makes thinking in code easier

Categories
Product, Projekt & Agile

The Road to Python3

When Python3 came out in 2009, it was already heavily debated. Python3 would be incompatible with previous versions of the popular language, but fix many drawbacks. While the vision was clear and the community initially planned to move forward much quicker. The demand for having a 2.x branch was so huge, however, that the community decided to extend support for 2.7 until the end of 2019. Stack Overflow took a look on why the path took so long.

The Road to Python3: Stack Overflow took a look.
Categories
Uncategorized

Python 3.8.0 is now available

Here is what’s new.

Source: Python Insider: Python 3.8.0 is now available

Categories
Uncategorized

Async / Await with Python

Asynchronous programming with Python, explained.

On Realpython, to read.

Once again, here on LivePython. Sometimes it’s better to listen.

Categories
Internet & Culture

Python Module of the day

Who hasn’t been waiting to use Perl from Python? With this python module you can. As easy as import perl:

>>> import perl
>>> value = "Hello there"
>>> if value =~ /^hello (.+?)$/i:
...     print("Found greeting:", $1)
...
Found greeting: there
>>> value =~ s/there/world/
>>> print(value)
Hello world

https://pypi.org/project/perl/

Categories
Product, Projekt & Agile

The Dropbox journey to static type checking with Python

Type Annotation is a feature that allows Python to maintain it’s dynamic typing and enable option static typing in the same code base. With the arrival of Python 3.5, the language implemented PEP 484, that describes a syntax to annotate code with type hints. Dropbox took a journey to leverage this option on 4 million lines of code for better quality. Here are their experiences.

Combined count of type annotated lines of code.
Type annotation

Dropbox is a big user of Python. It’s our most widely used language both for backend services and the desktop client app (we are also heavy users of Go, TypeScript, and Rust).

Source: Our journey to type checking 4 million lines of Python | Dropbox Tech Blog

Categories
Product, Projekt & Agile

Python 3.8.0b4 is now available for testing

It’s time for the last beta release of Python 3.8. Go find it at: https://www.python.org/downloads/release/python-380b4/ This release is the last of four planned beta release previews. Beta release previews are intended to give the wider community the opportunity to test new features and bug fixes and to prepare their projects to support the new feature release.

Source: Python 3.8.0b4 is now available for testing

Categories
Internet & Culture

Get started with Kubernetes (using Python)

Jason Haley wrote a brief tutorial to get the Pythonista started with Kubernetes. Worth reading if you are new to the topic.

Enable Kubernetes in Docker Desktop

So, you know you want to run your application in Kubernetes but don’t know where to start. Or maybe you’re getting started but still don’t know what you don’t know. In this blog you’ll walk through how to containerize an application and get it running in Kubernetes.This walk-through assumes you are a developer or at least comfortable with the command line (preferably bash shell).

Source: Get started with Kubernetes (using Python) – Kubernetes

Categories
Internet & Culture

Serving Fiori Applications with Python Flask

Serving Fiori Applications with Python Flask, part 1 | SAP Blogs
— Weiterlesen blogs.sap.com/2019/03/06/serving-fiori-applications-with-python-flask-part-1/comment-page-1/