29th November 2022
Introduction⚑
- New: Add the donation information.
Coding⚑
Languages⚑
PDM⚑
-
New: Suggest to use pydeps.
If you get lost in understanding your dependencies, you can try using
pydeps
to get your head around it.
Python Snippets⚑
-
New: Pad a string with spaces.
>>> name = 'John' >>> name.ljust(15) 'John '
-
New: Get hostname of the machine.
Any of the next three options:
import os os.uname()[1] import platform platform.node() import socket socket.gethostname()
pythonping⚑
-
New: Introduce pythonping.
pythonping is simple way to ping in Python. With it, you can send ICMP Probes to remote devices like you would do from the terminal.
Warning: Since using
pythonping
requires root permissions or grantingcap_net_raw
capability to the python interpreter, try to measure the latency to a server by other means such as usingrequests
.
Selenium⚑
-
New: Disable loading of images.
You can pass
options
to the initialization of the chromedriver to tweak how does the browser behave. To get a list of the actualprefs
you can go tochrome://prefs-internals
, there you can get the code you need to tweak.options = ChromeOptions() options.add_experimental_option( "prefs", { "profile.default_content_setting_values.images": 2, }, )
Typer⚑
-
New: Create a
--version
command.You could use a callback to implement a
--version
CLI option.It would show the version of your CLI program and then it would terminate it. Even before any other CLI parameter is processed.
from typing import Optional import typer __version__ = "0.1.0" def version_callback(value: bool) -> None: """Print the version of the program.""" if value: print(f"Awesome CLI Version: {__version__}") raise typer.Exit() def main( version: Optional[bool] = typer.Option( None, "--version", callback=version_callback, is_eager=True ), ) -> None: ... if __name__ == "__main__": typer.run(main)
-
New: Testing.
Testing is similar to
click
testing, but you import theCliRunner
directly fromtyper
:from typer.testing import CliRunner
Sponsor⚑
-
New: Introduce sponsorship analysis.
It may arrive the moment in your life where someone wants to sponsor you. There are many sponsoring platforms you can use, each has their advantages and disadvantages.
- Liberapay.
- Ko-fi.
- Buy me a coffee.
- Github Sponsor.
[Liberapay][3] [Ko-fi][4] [Buy Me a Coffee][6] [Github Sponsor][7] Non-profit [Yes][1] No No No! (Microsoft!) Monthly fee No No No No Donation Commission 0% 0% 5% Not clear Paid plan No [Yes][5] No No Payment Processors Stripe, Paypal Stripe, Paypal Stripe, Standard Payout Stripe One time donations [Possible but not user friendly][2] Yes Yes Yes Membership Yes Yes Yes Yes Shop/Sales No Yes No No Based in France ? United States United States? + Pay delay Instant Instant Instant User friendliness OK Good Good Good Liberapay is the only non-profit recurrent donations platform. It's been the most recommended platform from the people I know from the open-source, activist environment.
Ko-fi would be my next choice, as they don't do commissions on the donations and they support more features (that I don't need right now) than Liberapay.