2024-12-16 (Monday)
buildozer
Buildozer is a tool for creating application packages easily.
The goal is to have one “buildozer.spec” file in your app directory, describing your application requirements and settings such as title, icon, included modules etc. Buildozer will use that spec to create a package for Android, iOS, Windows, OSX and/or Linux.
2024-12-15 (Sunday)
The description of function decorators in the language reference is quite dense, so I’m teasing it apart here with two examples from 5 Custom Python Decorators For Your Projects by NeuralNine.
Decorator without parameters def time_logger(func): def wrapper(*args, **kwargs): start = time.perf_counter() result = func(*args, **kwargs) end = time.perf_counter() print("Time taken:", end - start) return result return wrapper @time_logger def process_input(n): # whatever Decorator expressions are evaluated when the function is defined, in the scope that contains the function definition.
2024-11-23 (Saturday)
Ruff — An extremely fast Python linter and code formatter, written in Rust.
2024-11-23 (Saturday)
uv - An extremely fast Python package and project manager, written in Rust.
2023-06-11 (Sunday)
Atheris (@ github)
2023-05-02 (Tuesday)
https://developers.google.com/machine-learning/guides/text-classification
2023-01-18 (Wednesday)
Database PyPI Debian Ubuntu import Rows as named tuples PostgreSQL psycopg import psycopg import psycopg.rows
csr = db.cursor(row_factory=psycopg.rows.namedtuple_row) MySQL/MariaDB mysqlclient python3-mysqldb python3-mysqldb import MySQLdb MySQL/MariaDB mysql-connector n/a python3-mysql.connector import mysql.connector csr = db.cursor(named_tuple=True)
2022-11-01 (Tuesday)
Feature Flask FastAPI Django Variable rules in routes <type:variable> [R] Return HTTP error abort(code) [R] Statt dem Code kann man auch ein Response-Objekt angeben, z.B. abort( make_response( jsonify(message="Post not found"), 404 ) ) raise HTTPException(status_code=, detail=, headers=) [R] return HttpResponse(status_code=404) . For some status codes there are also predefined subclasses, so for 404, we can use return HttpResponseNotFound() or even raise Http404()
2022-10-08 (Saturday)
https://gitlab.wsr.at/hjp/usradm/-/blob/c75d0b4d551fe94529361703c6e00fa2e4cc4809/old/sync/sync_from_ldap.py#L771
www2023 (not yet committed)
2022-03-16 (Wednesday)
datetime.datetime.now().astimezone()
2022-03-10 (Thursday)
Direkt-Installation aus dem Working Directory:
pip install . (pip install -e . funktioniert nicht mit setup.cfg, nur mit setup.py)
Packages bauen:
python3 -m build Uploaden:
twine upload dist/*
2022-03-09 (Wednesday)
regex is a more capable replacement for re
(via LWN)
2021-02-14 (Sunday)
Bokeh Bokeh Documentation Gallery Getting started with Bokeh
2021-02-02 (Tuesday)
asyncpg
2021-01-18 (Monday)
Stop Using Print to Debug in Python. Use Icecream Instead
2021-01-11 (Monday)
Python Outlier Detection (PyOD)
2021-01-04 (Monday)
A Python Package Developer’s Cheat Sheet
2020-12-27 (Sunday)
These Modern Programming Languages Will Make You Suffer
TLDR:
* Best System Language: Go * Best Language for Fintech: F# * Best Language for Enterprise Software: F# * Best Frontend Language: ReasonML * Best Language for Building Web APIs: Elixir * Best Language for Building Concurrent and Distributed Software: Elixir ReasonML is basically OCaml in new syntax and compiled to JS, so it is the perfect match for React.. Elixir is Erlang with nicer syntax.
2020-11-14 (Saturday)
Bandit
2020-11-06 (Friday)
(Warning: Only tested with psycopg2)
Sometimes you want to execute an SQL query but don’t know whether it will return a resultset in advance. An example would be a psql-like interface where the user can type arbitrary queries (DQL, DML, or DDL) or a very generic interface class.
Calling fetchone() or fetchall() raises a ProgrammingError when there is no resultset. We could catch that, but that’s not elegant.
Parsing the query to determine whether it should return a resultset is not feasible.
2020-11-01 (Sunday)
Apache Arrow
2020-09-23 (Wednesday)
https://www.monetdb.org/
2020-09-04 (Friday)
When writing web applications, it is often necessary (or at least more aesthetic) to make the home page part of the application. Using mod_wsgi, this looks like this:
WSGIScriptAlias / /var/www/mysite/app/myapp/myapp/wsgi.py Static files can be exempted via aliases:
Alias /robots.txt /var/www/mysite/htdocs/robots.txt Alias /favicon.ico /var/www/mysite/htdocs/favicon.ico Alias /static/ /var/www/mysite/htdocs/static/ If you want to enable mod_status the normal approach doesn’t work:
<Location "/server-status"> SetHandler server-status· Require ip 192.0.2.0/24 </Location> /server-status will be passed to WSGI handler instead of the server-status handler, no matter how you arrange the directives.
2020-07-27 (Monday)
virtualenv installiert initial folgende Packages:
setuptools pkg_resources pip wheel python3 -m venv
installiert nicht alle davon. Zumindest muss man nachinstallieren:
wheel
2020-06-17 (Wednesday)
Under realistic conditions (see below) asynchronous web frameworks are slightly worse throughput (requests/second) and much worse latency variance.
Async Python is not faster
2020-05-31 (Sunday)
Python Call Graph is a Python module that creates call graph visualizations for Python applications.