background preloader

Python

Facebook Twitter

How to Create A New Python Module (and deploy it using pip) Pythonidae/README.md at master · svaksha/pythonidae. How We Deploy Python Code. Building, packaging, and deploying Python using versioned artifacts in Debian packages.

How We Deploy Python Code

Les secrets d'un code pythonique. Avez-vous déjà vu… un code pythonique ?

Les secrets d'un code pythonique

« Pythonique », c’est un terme que l’on rencontre souvent au sein d’articles ou sur des forums, pour qualifier un code Python bien conçu, un code idiomatique (en accord avec les règles d’usage du langage, et donc compréhensible par tout développeur). Seulement, la distinction entre un bon code et un autre peut s’avérer floue, cet article a justement pour but de détailler les règles qui font qualifier un code de pythonique ou non.

Welcome to Python cheatsheet! — pysheeet. Asynchronous Python. Green Threads Green threads are a primitive level of asynchronous programming.

Asynchronous Python

A green thread looks and feels exactly like a normal thread, except that the threads are scheduled by application code rather than by hardware. Gevent is a well known python library for using green threads. Gevent is basically green threads + eventlet, a non-blocking I/O networking library. Gevent monkey patches common python libraries to have non-blocking I/O.

As you can see, the gevent API looks and feels just like threading. How to Configure NGINX for a Flask Web Application – Patrick's Software Blog. Introduction In this blog post, I’ll be explaining what NGINX is and how to configure it for serving a Flask web application.

How to Configure NGINX for a Flask Web Application – Patrick's Software Blog

This blog post is part of a larger series on deploying Flask applications. La reconnaissance musicale en Python. Python 201: An Intro to itertools. Python provides a great module for creating your own iterators.

Python 201: An Intro to itertools

The module I am referring to is **itertools**. The tools provided by itertools are fast and memory efficient. You will be able to take these building blocks to create your own specialized iterators that can be used for efficient looping. In this chapter, we will be looking at examples of each building block so that by the end you will understand how to use them for your own code bases. Apprendre l'optimisation du code avec Python. Maintenant que nous avons identifié les goulots d'étranglement, nous devons accélérer leurs codes.

Apprendre l'optimisation du code avec Python

Le premier objectif à atteindre est l'optimisation de votre algorithme : existe-t-il des moyens de calculer moins, ou plus rapidement ? Une bonne compréhension des mathématiques liées aux algorithmes permet d'avoir une bonne vue d'ensemble du problème. Cependant, il n'est pas rare de trouver des modifications simples, comme sortir d'une boucle FOR des calculs ou une allocation mémoire, ce qui permet d'obtenir des gains significatifs. III-A-1. Pymunk 5.0.0 documentation. Apprendre comment Hired fonctionne ici ! - Hired. Penser ‘Thread’ pour simplifier vos programmes. Dans les exemples du premier article de La Saga Blink, l’auteur mettait en avant l’intérêt de pouvoir se sortir de la boucle de clignotement d’une LED en proposant une ‘combine’ non bloquante de contrôle des caractères.

Penser ‘Thread’ pour simplifier vos programmes

Une solution qui peut paraître satisfaisante, mais l’est-elle réellement ? … Bien que parfaitement fonctionnels, de nombreux exemples proposés souffrent d’une même anomalie que l’on ne peut ignorer du fait qu’elle remet en cause l’usage même de ces exemples dans d’autres programmes. Voyons donc pourquoi et comment faire autrement. The Hitchhiker’s Guide to Python! Python-for-android 0.4 released, now available on PyPI. We’ve just officially released python-for-android 0.4, and pushed it to PyPI for the first time!

python-for-android 0.4 released, now available on PyPI

Python-for-android is a packaging tool for turning Python scripts and apps into Android APKs. It was originally created for use with the Kivy graphical framework, but now supports multiple kinds of Python app including Kivy, PySDL2, a webview interface with Flask or other webserver backend, plain Python scripts without a GUI, or other possibilities such as Python builds for use in other applications.

This release is the culmination of all the work over the last year to replace Kivy’s old Android toolchain with something more flexible and useful for other projects. Major features added in this time include the fully Python toolchain itself, support for SDL2 and other bootstraps, (experimental) python3 support via the CrystaX NDK, multiple architecture support, and many general improvements to the backend. Scientific python cheat sheet by IPGP. Pure Python Types.

Scientific python cheat sheet by IPGP

Kozea/wdb: An improbable web debugger through WebSockets. Turning the Raspberry Pi into a SMS Center using Python – My Blog. As I described already in another article – Running the Raspberry Pi on Solar Power it is pretty easy to run the Raspberry Pi on solar energy.

Turning the Raspberry Pi into a SMS Center using Python – My Blog

This fact combined with the small form factor of the Pi makes it extremely portable platform. In one of my projects I will leave the Raspberry Pi working in a distant rural area with no wired or wifi connection. The only possibility to connect to it is through the cell phone network. So I came up with the idea to control the Pi with short messages or SMSs. In order to connect the Pi with the cell network we would first need a 3g modem. Once you have the 3g dongle connected as a modem three new devices will appear under /dev. But what are AT commands? So let’s try to send some commands. Pi@raspberrypi ~ $ cu -l /dev/ttyUSB1Connected.ATOK Now we are ready to send a short message. Now to send a SMS we should send the following command, notice that at then end of the message we hit ctrl + z:

Python et les décorateurs — Gilles Fabio. 30 Python Language Features and Tricks You May Not Know About. 1 Introduction Since I started learning Python, I decided to maintain an often visited list of "tricks". Any time I saw a piece of code (in an example, on Stack Overflow, in open source software, etc.) that made me think "Cool! I didn't know you could do that! " I experimented with it until I understood it and then added it to the list. This post is part of that list, after some cleaning up. Each trick or language feature is demonstrated only through examples, with no explanation. The list is very roughly ordered by difficulty, with the easier and more commonly known language features and tricks appearing first. A table of contents is given at the end. Update - April 9th, 2014 As you can see the article has been growing with currently 38 items in it, mostly thanks to comments from readers.

Update - March 14th, 2014 Roy Keyes made a great suggestion of turning this article into a GitHub repository to allow readers to make improvements or additions through pull requests. 1.1 Unpacking. Flask At Scale. Noamraph/tqdm: Add a progress meter to your loops in a second. Welcome to robobrowser’s documentation! — robobrowser 0.1 documentation.

Learn

The Arcade Python Package — Arcade 0.0.6r44 documentation. Copyright (c) 2016 Paul Vincent Craven The Arcade library is licensed under the MIT License. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. Regex101 - L'outil ultime pour trouver, créer, tester et comprendre des regex. Si vous aimez vous prendre la tête avec des Regex, voici un site qui devrait vous plaire. Baptisé Regex101, il permet de tester ses expressions régulières ou de les construire à l'aide d'un mémento bien pratique.

Mais ce que je préfère sur Regex101, c'est l'encadré "Explication" qui détaille en langage clair (et en anglais), ce que fait exactement cette expression régulière. Par exemple, si j'indique cette regex qui permet de trouver une URL dans un texte HTML... Nuitka (python compiler) Overview This document is the recommended first read if you are interested in using Nuitka, understand its use cases, check what you can expect, license, requirements, credits, etc.

Nuitka is the Python compiler. It is a seamless replacement or extension to the Python interpreter and compiles every construct that CPython 2.6, 2.7, 3.2, 3.3, 3.4, and 3.5 have. It then executed uncompiled code, and compiled code together in an extremely compatible manner. How to Deploy Python WSGI Apps Using Gunicorn HTTP Server Behind Nginx. Introduction Perhaps it was the article on Python Web Server Comparison tempting you to switch, or the the fact that you have simply outgrown your current application deployment stack.

You are interested in finding out more about Gunicorn Web Server and want to learn how to deploy a Python application thoroughly from the start. In this DigitalOcean article, our aim is to help you with all the above and then some. We will begin with expanding our knowledge on the excellent Gunicorn WSGI HTTP Server and continue with deploying Python WSGI web applications built atop various popular frameworks. Mlxtend.

Machine Learning

Awesome Python. .mobo — Servir une application web python avec chaussette, circus et nginx.