Artwork

المحتوى المقدم من pythonhunter. يتم تحميل جميع محتويات البودكاست بما في ذلك الحلقات والرسومات وأوصاف البودكاست وتقديمها مباشرة بواسطة pythonhunter أو شريك منصة البودكاست الخاص بهم. إذا كنت تعتقد أن شخصًا ما يستخدم عملك المحمي بحقوق الطبع والنشر دون إذنك، فيمكنك اتباع العملية الموضحة هنا https://ar.player.fm/legal.
Player FM - تطبيق بودكاست
انتقل إلى وضع عدم الاتصال باستخدام تطبيق Player FM !

Ep 40. Rust 和 PyO3:让 Python 再次伟大 🦀 ❤️ 🐍

1:17:27
 
مشاركة
 

Manage episode 363209078 series 2513527
المحتوى المقدم من pythonhunter. يتم تحميل جميع محتويات البودكاست بما في ذلك الحلقات والرسومات وأوصاف البودكاست وتقديمها مباشرة بواسطة pythonhunter أو شريك منصة البودكاست الخاص بهم. إذا كنت تعتقد أن شخصًا ما يستخدم عملك المحمي بحقوق الطبع والنشر دون إذنك، فيمكنك اتباع العملية الموضحة هنا https://ar.player.fm/legal.

嘉宾

Messense

主播

链接

  • PyO3

  • PyO3 有哪些应用?

    • polars: Fast multi-threaded DataFrame library in Rust | Python | Node.js.
    • pydantic-core: Core validation logic for pydantic written in Rust.
    • cryptography: Python cryptography library with some functionality in Rust.
    • orjson: Fast, correct Python JSON library supporting dataclasses, datetimes, and numpy
  • PyO3 前身:rust-cpython

  • Maturin: Build and publish crates with pyo3, rust-cpython and cffi bindings as well as rust binaries as python packages

  • What Are Python Wheels and Why Should You Care?

  • PEP 517 – A build-system independent format for source trees

  • Ruff: An extremely fast Python linter, written in Rust.

  • typos: Source code spell checker

  • ChatGPT 写的 Rust 调用 Python C-API 的例子

    use std::os::raw::{c_char, c_int};
    use std::ffi::CString;
    use libc::{c_double, c_void};
    #[link(name = "python3.8")]
    extern "C" {
    fn Py_Initialize();
    fn Py_Finalize();
    fn Py_BuildValue(format: *const c_char, ...) -> *mut c_void;
    }
    fn main() {
    unsafe {
    // 初始化 Python 解释器
    Py_Initialize();
    // 构建一个 Python 元组对象,并打印它
    let x = 1.23 as c_double;
    let y = 4.56 as c_double;
    let format = CString::new("dd").unwrap().as_ptr();
    let result = Py_BuildValue(format, x, y);
    let s = CString::from_raw(result as *mut c_char).into_string().unwrap();
    println!("{}", s);
    // 关闭 Python 解释器
    Py_Finalize();
    }
    }
  • pyo3-ffi: Python-API bindings for the PyO3 ecosystem

  • 在 PyO3 里通过 allow_threads 关掉 Python GIL

  • pybind11 — Seamless operability between C++11 and Python

  • Cython

  • CFFI: C Foreign Function Interface for Python. Interact with almost any C code from Python, based on C-like declarations that you can often copy-paste from header files or documentation.

  • zig cc: a Powerful Drop-In Replacement for GCC/Clang

  • wechatpy: 微信公众平台第三方 Python SDK

  • OrbStack: Fast, light, simple Docker & Linux on macOS

  • FancyWM - a dynamic tiling window manager for Windows 10/11

  • CSAPP: Computer Systems: A Programmer's Perspective

  • APUE: Advanced Programming in the UNIX® Environment

  • 提到的读书撕书的灵感来自于:李敖先生

  • 吴恩达 prompt engineering 课程:
    ChatGPT Prompt Engineering for Developers

  • Kiwi 浏览器


爱发电上赞助

  continue reading

92 حلقات

Artwork
iconمشاركة
 
Manage episode 363209078 series 2513527
المحتوى المقدم من pythonhunter. يتم تحميل جميع محتويات البودكاست بما في ذلك الحلقات والرسومات وأوصاف البودكاست وتقديمها مباشرة بواسطة pythonhunter أو شريك منصة البودكاست الخاص بهم. إذا كنت تعتقد أن شخصًا ما يستخدم عملك المحمي بحقوق الطبع والنشر دون إذنك، فيمكنك اتباع العملية الموضحة هنا https://ar.player.fm/legal.

嘉宾

Messense

主播

链接

  • PyO3

  • PyO3 有哪些应用?

    • polars: Fast multi-threaded DataFrame library in Rust | Python | Node.js.
    • pydantic-core: Core validation logic for pydantic written in Rust.
    • cryptography: Python cryptography library with some functionality in Rust.
    • orjson: Fast, correct Python JSON library supporting dataclasses, datetimes, and numpy
  • PyO3 前身:rust-cpython

  • Maturin: Build and publish crates with pyo3, rust-cpython and cffi bindings as well as rust binaries as python packages

  • What Are Python Wheels and Why Should You Care?

  • PEP 517 – A build-system independent format for source trees

  • Ruff: An extremely fast Python linter, written in Rust.

  • typos: Source code spell checker

  • ChatGPT 写的 Rust 调用 Python C-API 的例子

    use std::os::raw::{c_char, c_int};
    use std::ffi::CString;
    use libc::{c_double, c_void};
    #[link(name = "python3.8")]
    extern "C" {
    fn Py_Initialize();
    fn Py_Finalize();
    fn Py_BuildValue(format: *const c_char, ...) -> *mut c_void;
    }
    fn main() {
    unsafe {
    // 初始化 Python 解释器
    Py_Initialize();
    // 构建一个 Python 元组对象,并打印它
    let x = 1.23 as c_double;
    let y = 4.56 as c_double;
    let format = CString::new("dd").unwrap().as_ptr();
    let result = Py_BuildValue(format, x, y);
    let s = CString::from_raw(result as *mut c_char).into_string().unwrap();
    println!("{}", s);
    // 关闭 Python 解释器
    Py_Finalize();
    }
    }
  • pyo3-ffi: Python-API bindings for the PyO3 ecosystem

  • 在 PyO3 里通过 allow_threads 关掉 Python GIL

  • pybind11 — Seamless operability between C++11 and Python

  • Cython

  • CFFI: C Foreign Function Interface for Python. Interact with almost any C code from Python, based on C-like declarations that you can often copy-paste from header files or documentation.

  • zig cc: a Powerful Drop-In Replacement for GCC/Clang

  • wechatpy: 微信公众平台第三方 Python SDK

  • OrbStack: Fast, light, simple Docker & Linux on macOS

  • FancyWM - a dynamic tiling window manager for Windows 10/11

  • CSAPP: Computer Systems: A Programmer's Perspective

  • APUE: Advanced Programming in the UNIX® Environment

  • 提到的读书撕书的灵感来自于:李敖先生

  • 吴恩达 prompt engineering 课程:
    ChatGPT Prompt Engineering for Developers

  • Kiwi 浏览器


爱发电上赞助

  continue reading

92 حلقات

كل الحلقات

×
 
Loading …

مرحبًا بك في مشغل أف ام!

يقوم برنامج مشغل أف أم بمسح الويب للحصول على بودكاست عالية الجودة لتستمتع بها الآن. إنه أفضل تطبيق بودكاست ويعمل على أجهزة اندرويد والأيفون والويب. قم بالتسجيل لمزامنة الاشتراكات عبر الأجهزة.

 

دليل مرجعي سريع

استمع إلى هذا العرض أثناء الاستكشاف
تشغيل