دسترسی نامحدود
برای کاربرانی که ثبت نام کرده اند
برای ارتباط با ما می توانید از طریق شماره موبایل زیر از طریق تماس و پیامک با ما در ارتباط باشید
در صورت عدم پاسخ گویی از طریق پیامک با پشتیبان در ارتباط باشید
برای کاربرانی که ثبت نام کرده اند
درصورت عدم همخوانی توضیحات با کتاب
از ساعت 7 صبح تا 10 شب
ویرایش:
نویسندگان: Maxwell Flitton
سری:
ISBN (شابک) : 180181144X, 9781801811446
ناشر: Packt Publishing
سال نشر: 2022
تعداد صفحات: 541
زبان: English
فرمت فایل : PDF (درصورت درخواست کاربر به PDF، EPUB یا AZW3 تبدیل می شود)
حجم فایل: 7 مگابایت
در صورت تبدیل فایل کتاب Speed Up Your Python with Rust: Optimize Python performance by creating Python pip modules in Rust with PyO3 به فرمت های PDF، EPUB، AZW3، MOBI و یا DJVU می توانید به پشتیبان اطلاع دهید تا فایل مورد نظر را تبدیل نمایند.
توجه داشته باشید کتاب سرعت پایتون خود را با Rust افزایش دهید: عملکرد پایتون را با ایجاد ماژول های پایتون در Rust با PyO3 بهینه کنید. نسخه زبان اصلی می باشد و کتاب ترجمه شده به فارسی نمی باشد. وبسایت اینترنشنال لایبرری ارائه دهنده کتاب های زبان اصلی می باشد و هیچ گونه کتاب ترجمه شده یا نوشته شده به فارسی را ارائه نمی دهد.
دریابید که چگونه میتوانید کد خود را با ویژگیهای Rust با کارایی بالا برای توسعه برنامههای کاربردی سریع و ایمن برای حافظه تزریق کنید
Python توسعه نرمافزار را آسانتر کرده است، اما در چندین زمینه از جمله مدیریت حافظه که منجر به ضعف میشود، کوتاهی میکند. عملکرد و امنیت از طرف دیگر، Rust ایمنی حافظه را بدون استفاده از زباله جمعآوری فراهم میکند، به این معنی که با حافظه کم آن، میتوانید برنامههایی با کارایی بالا و ایمن نسبتاً آسان بسازید. با این حال، بازنویسی همه چیز در Rust می تواند پرهزینه و مخاطره آمیز باشد زیرا ممکن است پشتیبانی بسته در Rust برای حل مشکل وجود نداشته باشد. اینجاست که پیوندهای پایتون و پیپ وارد میشوند.
این کتاب به شما بهعنوان یک توسعهدهنده پایتون کمک میکند تا بدون نیاز به مدیریت سرور یا برنامه Rust جداگانه، از Rust در پروژههای پایتون خود استفاده کنید. با توجه به درک مفاهیمی مانند توابع و حلقهها، این کتاب ویژگیهای Rust مانند مدیریت حافظه برای کدگذاری Rust را به شیوهای سازنده و ساختاریافته پوشش میدهد. شما جعبه PyO3 را برای ترکیب کد Rust با پایتون کاوش خواهید کرد، یاد خواهید گرفت که چگونه کد Rust ذوب شده خود را در یک بسته پیپ بسته بندی کنید، و سپس یک برنامه Python Flask را در Docker استقرار دهید که از یک ماژول Rust pip خصوصی استفاده می کند. در نهایت، با موضوعات پیشرفته Rust binding مانند بازرسی اشیاء و ماژولهای Python در Rust آشنا خواهید شد.
در پایان این کتاب Rust، میتوانید ایمن و با کارایی بالا توسعه دهید. برنامه های کاربردی با پشتیبانی همزمان بهتر.
این کتاب برای توسعه دهندگان پایتون است که می خواهند کد پایتون خود را با Rust سرعت بخشند و Rust را در سیستم پایتون بدون تغییر کل سیستم پیاده سازی کنند. شما می توانید در مورد تمام موضوعات مربوط به برنامه نویسی Rust بیاموزید. برای استفاده حداکثری از این کتاب به دانش اولیه پایتون نیاز است.
Discover how to inject your code with highly performant Rust features to develop fast and memory-safe applications
Python has made software development easier, but it falls short in several areas including memory management that lead to poor performance and security. Rust, on the other hand, provides memory safety without using a garbage collector, which means that with its low memory footprint, you can build high-performant and secure apps relatively easily. However, rewriting everything in Rust can be expensive and risky as there might not be package support in Rust for the problem being solved. This is where Python bindings and pip come in.
This book will help you, as a Python developer, to start using Rust in your Python projects without having to manage a separate Rust server or application. Seeing as you'll already understand concepts like functions and loops, this book covers the quirks of Rust such as memory management to code Rust in a productive and structured manner. You'll explore the PyO3 crate to fuse Rust code with Python, learn how to package your fused Rust code in a pip package, and then deploy a Python Flask application in Docker that uses a private Rust pip module. Finally, you'll get to grips with advanced Rust binding topics such as inspecting Python objects and modules in Rust.
By the end of this Rust book, you'll be able to develop safe and high-performant applications with better concurrency support.
This book is for Python developers who want to speed up their Python code with Rust and implement Rust in a Python system without altering the entire system. You'll be able to learn about all topics relating to Rust programming. Basic knowledge of Python is required to get the most out of this book.
Speed Up Your Python with Rust Contributors About the author About the reviewers Preface Who this book is for What this book covers To get the most out of this book Download the example code files Download the color images Conventions used Get in touch Share Your Thoughts Section 1: Getting to Understand Rust Chapter 1: An Introduction to Rust from a Python Perspective Technical requirements Understanding the differences between Python and Rust Why fuse Python with Rust? Passing strings in Rust Sizing up floats and integers in Rust Managing data in Rust's vectors and arrays Replacing dictionaries with hashmaps Error handling in Rust Understanding variable ownership Copy Move Immutable borrow Mutable borrow Keeping track of scopes and lifetimes Building structs instead of objects Metaprogramming with macros instead of decorators Summary Questions Answers Further reading Chapter 2: Structuring Code in Rust Technical requirements Managing our code with crates and Cargo instead of pip Structuring code over multiple files and modules Building module interfaces Benefits of documentation when coding Interacting with the environment Summary Questions Answers Further reading Chapter 3: Understanding Concurrency Technical requirements Introducing concurrency Threads Processes Basic asynchronous programming with threads Running multiple processes Customizing threads and processes safely Amdahl's law Deadlocks Race conditions Summary Questions Answers Further reading Section 2: Fusing Rust with Python Chapter 4: Building pip Modules in Python Technical requirements Configuring setup tools for a Python pip module Creating a GitHub repository Defining the basic parameters Defining a README file Defining a basic module Packaging Python code in a pip module Building our Fibonacci calculation code Creating a command-line interface Building unit tests Configuring continuous integration Manually deploying onto PyPI Managing dependencies Setting up type checking for Python Setting up and running tests and type-checking with GitHub Actions Create automatic versioning for our pip package Deploying onto PyPI using GitHub Actions Summary Questions Answers Further reading Chapter 5: Creating a Rust Interface for Our pip Module Technical requirements Packaging Rust with pip Define gitignore and Cargo for our package Configuring the Python setup process for our package Installing our Rust library for our package Building a Rust interface with the pyO3 crate Building our Fibonacci Rust code Creating command-line tools for our package Creating adapters for our package Building tests for our Rust package Comparing speed with Python, Rust, and Numba Summary Questions Answers Further reading Chapter 6: Working with Python Objects in Rust Technical requirements Passing complex Python objects into Rust Updating our setup.py file to support .yml loading Defining our .yml loading command Processing data from our Python dictionary Extracting data from our config file Returning our Rust dictionary to our Python system Inspecting and working with custom Python objects Creating an object for our Rust interface Acquiring the Python GIL in Rust Adding data to our newly created PyDict struct Setting the attributes of our custom object Constructing our own custom Python objects in Rust Defining a Python class with the required attributes Defining class static methods to process input numbers Defining a class constructor Wrapping up and testing our module Summary Questions Answers Further reading Chapter 7: Using Python Modules with Rust Technical requirements Exploring NumPy Adding vectors in NumPy Adding vectors in pure Python Adding vectors using NumPy in Rust Building a model in NumPy Defining our model Building a Python object that executes our model Using NumPy and other Python modules in Rust Recreating our NumPy model in Rust Building get_weight_matrix and inverse_weight_matrix functions Building get_parameters, get_times, and get_input_vector functions Building calculate_parameters and calculate_times functions Adding calculate functions to the Python bindings and adding a NumPy dependency to our setup.py file Building our Python interface Summary Questions Answers Further reading Chapter 8: Structuring an End-to-End Python Package in Rust Technical requirements Breaking down a catastrophe modeling problem for our package Building an end-to-end solution as a package Building a footprint merging process Building the vulnerability merge process Building a Python interface in Rust Building our interface in Python Building package installation instructions Utilizing and testing our package Building a Python construct model using pandas Building a random event ID generator function Timing our Python and Rust implementations with a series of different data sizes Summary Further reading Section 3: Infusing Rust into a Web Application Chapter 9: Structuring a Python Flask App for Rust Technical requirements Building a basic Flask application Building an entry point for our application Building our Fibonacci number calculator module Building a Docker image for our application Building our NGINX service Connecting and running our Nginx service Defining our data access layer Defining a PostgreSQL database in docker-compose Building a config loading system Building our data access layer Setting up the application database migration system Building database models Applying the database access layer to the fib calculation view Building a message bus Building a Celery broker for Flask Building a Fibonacci calculation task for Celery Updating our calculation view Defining our Celery service in Docker Summary Questions Answers Further reading Chapter 10: Injecting Rust into a Python Flask App Technical requirements Fusing Rust into Flask and Celery Defining our dependency on the Rust Fibonacci number calculation package Building our calculation model with Rust Creating a calculation view using Rust Inserting Rust into our Celery task Deploying Flask and Celery with Rust Deploying with a private GitHub repository Building a Bash script that orchestrates the whole process Reconfiguring the Rust Fib package installment in our Dockerfile Fusing Rust with data access Setting up our database cloning package Setting up the diesel environment Autogenerating and configuring our database models and schema Defining our database connection in Rust Creating a Rust function that gets all the Fibonacci records and returns them Deploying Rust nightly in Flask Summary Questions Answers Further reading Chapter 11: Best Practices for Integrating Rust Technical requirements Keeping our Rust implementation simple by piping data to and from Rust Building a Python script that formulates the numbers for calculation Building a Rust file that accepts the numbers, calculates the Fibonacci numbers, and returns the calculated numbers Building another Python script that accepts the calculated numbers and prints them out Giving the interface a native feel with objects Defining traits Defining struct behavior with traits Passing traits through functions Storing structs with common traits Running our traits in the main file Keeping data-parallelism simple with Rayon Further reading Why subscribe? Other Books You May Enjoy Packt is searching for authors like you Share Your Thoughts