DearPyGui

เป็นเฟรมเวิร์ค GUI ที่ทันสมัย ​​รวดเร็ว และทรงพลังสำหรับ Python ใช้การเรนเดอร์โดย GPU มีวิดเจ็ตสำเร็จรูปและตัวควบคุมที่หลากหลาย และเอกสารประกอบมีตัวอย่างอย่างละเอียดเพื่อให้คุณเริ่มต้นใช้งานได้อย่างง่ายดาย

# ติดตั้ง
pip install dearpygui
# หรือถ้าบน linux จะใช้
pip3 install dearpygui
# ตัวอย่างคำสั่ง
import dearpygui.dearpygui as dpg

def save_callback():
    print("Save Clicked")

dpg.create_context()
dpg.create_viewport()
dpg.setup_dearpygui()

with dpg.window(label="ตัวอย่างหน้าต่าง"):
    dpg.add_text("รอบเรื่องไพธอน")
    dpg.add_button(label="บันทึก", callback=save_callback)
    dpg.add_input_text(label="ข้อความ")
    dpg.add_slider_float(label="เลขทศนิยม")

dpg.show_viewport()
dpg.start_dearpygui()
dpg.destroy_context()

สนใจสามารถเข้าไปดูรายละเอียดได้ที่:

GitHub - hoffstadt/DearPyGui: Dear PyGui: A fast and powerful Graphical User Interface Toolkit for Python with minimal dependencies

Dear PyGui demo

docker-py

ไลบรารี Python สำหรับ Docker Engine API มันช่วยให้คุณทำทุกอย่างได้ที่เป็นคำสั่ง docker ไม่ว่าจะ run containers หรือ จัดการ containers ร่วมถึงจัดการ Swarms ฯลฯ

# ติดตั้ง
pip install docker
# ตัวอย่าง
import docker
client = docker.from_env()
client.images.pull('nginx')
# <Image 'nginx'>
client.containers.run("ubuntu:latest", "echo hello world")
# 'hello world\n'
client.containers.list()
# [<Container '45e6d2de7c54'>, <Container 'db18e4f20eaa'>, ...]
How to use easily a virtual Python environment with Docker | by Jean-Marie  Aliaga | FAUN Publication

pikepdf

Logo

pikepdf เป็นไลบรารี Python สำหรับอ่านและเขียนไฟล์ PDF

# ติดตั้ง
pip install pikepdf
# ตัวอย่าง หมุนหน้าทั้งหมดในไฟล์ 180 องศา
import pikepdf

with pikepdf.Pdf.open('test.pdf') as my_pdf:
    for page in my_pdf.pages:
        page.Rotate = 180
    my_pdf.save('test-rotated.pdf')

สนใจสามารถเข้าไปดูรายละเอียดได้ที่:

GitHub - pikepdf/pikepdf: A Python library for reading and writing PDF, powered by qpdf

rembg

เป็นเครื่องมือที่ง่ายและใช้งานได้จริงในการลบพื้นหลังของรูปภาพของไป ซึ่งสามารถรันเป็น api โดยการรันเป็นเซิฟเวอร์ หรือจะใช้เป็นไลบรารี่แก้ไขด้วยภาษา Python ก็ได้เหมือนกัน

สนใจสามารถเข้าไปดูรายละเอียดได้ที่:

GitHub - danielgatis/rembg: Rembg is a tool to remove images background.

# ติดตั้งตัวที่สนับสนุน CPU
pip install rembg
ิ# ติดตั้งตัวสนับสนุน GPU
pip install rembg[gpu]
# ตัวอย่างบน python
from rembg import remove
from PIL import Image

input_path = 'input.png'
output_path = 'output.png'

input = Image.open(input_path)
output = remove(input)
output.save(output_path)
# ตัวอย่างรันเป็นเซิฟเวอร์
rembg s

http://localhost:5000/?url=https://upload.wikimedia.org/wikipedia/commons/thumb/9/9a/Gull_portrait_ca_usa.jpg/1280px-Gull_portrait_ca_usa.jpg

orjson

Python — orjson. A fast JSON library for Python | by Tony | Geek Culture |  Medium

ไลบรารี Python ที่เกี่ยวกับ JSON ที่รวดเร็วและแม่นยำ รองรับประเภทข้อมูลที่หลากหลาย เช่น วันที่ อาร์เรย์จำนวนมาก ฯลฯ

สนใจสามารถเข้าไปดูรายละเอียดได้ที่:

GitHub - ijl/orjson: Fast, correct Python JSON library supporting dataclasses, datetimes, and numpy

# ติดตั้ง
pip install --upgrade "pip>=20.3"
pip install --upgrade orjson
# ตัวอย่าง
import orjson, datetime, numpy
data = {
    "type": "job",
    "created_at": datetime.datetime(1970, 1, 1),
    "status": "🆗",
    "payload": numpy.array([[1, 2], [3, 4]]),
}
print(orjson.dumps(data, option=orjson.OPT_NAIVE_UTC | orjson.OPT_SERIALIZE_NUMPY))
print(orjson.loads(_))

orjson — A fast json parser for python | by Robby Boney | Short Bits |  Medium

PyWebIO

เครื่องมือ Python สำหรับสร้างเว็บแอปพลิเคชันอย่างรวดเร็ว คุณสามารถกรอกหน้าเว็บแอปพลิเคชันขนาดเล็กได้อย่างรวดเร็ว รวมถึงการแสดงข้อมูลและแบบฟอร์มใน Python โดยไม่ต้องเขียนโค้ด HTML, CSS และ JS

# ติดตั้ง
pip install -U pywebio
# หรือเวอร์ชั่นนักพัฒนา
pip install -U https://code.aliyun.com/wang0618/pywebio/repository/archive.zip
# ตัวอย่าง เว็บ bmi
from pywebio.input import input, FLOAT
from pywebio.output import put_text

def bmi():
    height = input("กรอกส่วนสูง(ซม):", type=FLOAT)
    weight = input("กรอกน้ำหนัก(กก):", type=FLOAT)

    BMI = weight / (height / 100) ** 2

    top_status = [(16, 'น้ำหนักน้อยมาก'), (18.5, 'น้ำหนักน้อย'),
                  (25, 'ปกติ'), (30, 'อ้วนหนักมากเกินไป'),
                  (35, 'น้ำหนักปานกลาง'), (float('inf'), 'อ้วนหนักมาก')]

    for top, status in top_status:
        if BMI <= top:
            put_text('BMI ของคุณคือ: %.1f. อยู่หมวกหมู่: %s' % (BMI, status))
            break

if __name__ == '__main__':
    bmi()

สนใจสามารถเข้าไปดูรายละเอียดได้ที่:

GitHub - pywebio/PyWebIO: Write interactive web app in script way

PyWebIO output demo

ที่มา : HelloGitHub Python 项目