程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
您现在的位置: 程式師世界 >> 編程語言 >  >> 更多編程語言 >> Python

Top 10 Python libraries in my mind

編輯:Python

Hello everyone , This article recommends 10 A practical python library , Each one is the best of its kind , After trial, make sure you will fall in love with , If you want to learn, just learn such a library .

There are FastAPI Upgraded version Typer、 take CLI Turn it into color Rich、 be based on GUI Framework of the Dear PyGui、 There are also ways to simplify error reporting PrettyErrors……

Let's have a look ~

# 1、Typer

Typer Follow FastAPI The principle is the same , All are Python It's used to build API A high performance framework for services .

It is FastAPI Upgraded version , Not only can you accurately record the code , It's also easy to CLI verification .

Typer Easy to learn and use , You don't need to read complex tutorial documents to get started . Support editor ( Such as VSCode) Code auto completion , Improve the development efficiency of developers , Reduce bug The number of .

secondly ,Typer It also works with command-line artifact Click Use , You can use it Click The advantages and plug-ins of , Implement more complex functions .

Open source address :https://github.com/tiangolo/typer

# 2、Rich

Who stipulated CLI The interface has to be black and white ? It can also be colored .

Rich API It can not only provide rich color text and exquisite format in the terminal output , There are also beautiful forms 、 Progress bar 、 Editor 、 Tracker 、 Grammar highlighting, etc . As shown in the figure below .

It can also be installed in Python REPL On , All data structures can be beautifully output or annotated .

To make a long story short , It's colored 、 Beautiful 、 Powerful .

Rich Compatibility is also good , Apply to Linux,Mac and Windows And other systems . True color / Emoticons can be associated with new Windows Terminals are used together .

But notice ,Rich It has to be Python 3.6.1 Or above .

Open source address :https://github.com/willmcgugan/rich

# 3、Dear PyGui

As shown above , Although terminal applications can be made to look beautiful . however , You may also need a real GUI.

Dear PyGui It's an easy to use 、 Powerful Python GUI frame . But it's different from other Python GUI But it's fundamentally different .

It uses the immediate mode paradigm and the computer's GPU To achieve a dynamic interface . The instant mode paradigm is very popular in video games , That means it's dynamic GUI No need to keep any data , It's frame by frame . meanwhile , It also uses GPU To build a dynamic interface .

Dear PyGui You can also draw 、 Create a theme 、 establish 2D game , And have some gadgets , For example, built-in documents 、 logging 、 Source code viewer and so on , These gadgets can help App Development of .

The systems that support it are :Windows 10(DirectX 11),Linux(OpenGL 3) and macOS(Metal) etc. .

Open source address :https://github.com/hoffstadt/DearPyGui

# 4、PrettyErrors

PrettyErrors It's a simplification Python Tools for error messages , The feature is that the interface is very simple and friendly .

Its most significant function is to support color output at the terminal , Mark the file stack trace , Error message found , Filter out redundant information , Extract the key parts , And color labeling , So as to improve the efficiency of developers .

And it doesn't have to be installed , Directly imported into the project for use , But you need to configure some parameters first , The import and configuration parameters are as follows :

Open source address :https://github.com/onelivesleft/PrettyErrors

# 5、Diagrams

When programmers are programming , Sometimes I need to explain to my colleagues the complicated structural relationship between the code he designed , However, this is not clear in one or two sentences , You need to draw a chart or a venation .

In general , Programmers use GUI Tools for processing charts , And visualize the document . But there's a better way , For example, using Diagrams library .

Diagrams Let's not need any design tools , Directly in Python Draw the cloud system structure in the code . Their icons come from a number of cloud service providers , Include AWS, Azure, GCP etc. .

Just a few lines of code , You can simply create arrow symbols and structure diagrams .

Because it uses Graphviz To render the image , So it needs to be installed first Graphviz.

Open source address :https://github.com/mingrammer/diagrams

# 6、Hydra and OmegaConf

When doing machine learning projects , A lot of environment configuration work needs to be done . therefore , In some complex applications , Configuration management has also become complicated .

Hydra You can make configuration easy . It can be overridden from the command line or configuration file , No need to maintain similar profiles , Configure in a combined way , So it can speed up the experiment .

Hydra Strong compatibility , Have a structure with plug-ins , It can be well integrated with the operation files of developers . Its plug-in can also be implemented directly through the command line , Release the code to AWS Or other cloud systems .

Hydra Also cannot do without OmegaConf, The two are inseparable ,OmegaConf by Hydra The hierarchical configuration system provides collaborative API, The cooperation of the two can support YAML、 The configuration file 、 object 、CLI Parameters, etc. .

Open source address :https://github.com/facebookresearch/hydra,https://github.com/omry/omegaconf

# 7、PyTorch Lightning

PyTorch Lightning It's also Facebook A research result of . It's a lightweight PyTorch Wrappers , For high performance AI Research , The most important feature is that it can analyze PyTorch Code , Let's separate the research component from the engineering component .

Its extended model can be implemented on any hardware (CPU、GPU、TPU) Up operation , And it's easy to replicate , Deleted a large number of file samples , Keep your own flexibility , Fast running speed .

Lightning Can make DL / ML Studied 40 Multiple parts are automated , for example GPU Training 、 Distributed GPU( colony ) Training 、TPU Training and so on ……

because Lightning Will be able to automatically export files to ONNX or TorchScript, So it's suitable for fast reasoning AI researcher 、BERT Or self supervised learning research team .

Open source address :https://github.com/PyTorchLightning/PyTorch-lightning

# 8、Hummingbird

Hummingbird It's a Microsoft study , It's able to take what's been trained ML The model is compiled into tensor calculation , So there's no need to design new models .

It also allows users to use the neural network framework ( for example PyTorch) To speed up the traditional ML Model .

Its reasoning API Follow sklearn Examples are very similar , Can reuse existing code , But it uses Hummingbird Generated code to achieve .

Hummingbird still Sklearn API After that, a convenient unified reasoning is provided API. In this way, we can Sklearn Model and Hummingbird Generated model interchange , Without changing the reasoning code .

The reason it's focused on , And because it can support a variety of models and formats .

up to now ,Hummingbird Support PyTorch、TorchScript、ONNX and TVM And so on ML Model .

Open source address :https://github.com/microsoft/hummingbird

# 9、HiPlot

because ML Models are becoming more and more complex , There are also many super parameters , So we need to use HiPlot.HiPlot This year 3 month Facebook A library of releases , It is mainly used for processing high-dimensional data .

Facebook AI Through dozens of super parameters and 10 More than 10000 experiments , utilize HiPlot, To analyze deep neural networks .

It's using parallels and other graphics , help AI Researchers have found correlations and models in high-dimensional data , It's a lightweight interactive visualization tool .

HiPlot Compared with other visualization tools , It has its own advantages :

First , It's very interactive , Because parallel graphs are interactive , So it can satisfy the image visualization in many situations .

secondly , It's easy to use , Can pass IPython Notebook Or by carrying “ hiplot” The service of command is used directly .

It also has scalability . By default ,HiPlot Of Web Services can parse CSV or JSON file , It can also be customized Python Parser , Turn the experiment into HiPlot experiment .

Open source address :
https://github.com/facebookresearch/hiplot
Reference link :
https://ai.facebook.com/blog/hiplot-high-dimensional-interactive-plots-made-easy

# 10、Scalene

Scalene Is a Python The script CPU And memory Analyzer , Be able to handle multithreaded code correctly , Can you tell Python Run time of code and native code .

You don't have to change the code , Just run Scalene Script , It generates a text report , Show each line of code CPU And memory usage . Through this text report , Developers can improve code efficiency .

Scalene Fast 、 High accuracy , It can also annotate high-energy lines of code .

Open source address
https://github.com/emeryberger/scalene

In addition to the above 10 individual , There are also a number of high performance Python The library was called , for example Norfair、Quart、Alibi-detect、Einops…… wait , See the link at the bottom for details .

that , You found something useful this year Python Library ?

If any , Please share it in the comments section ~

Reference link

https://tryolabs.com/blog/2020/12/21/top-10-python-libraries-of-2020/

https://www.upgrad.com/blog/reasons-why-python-popular-with-developers/

-------- End --------

Selected materials

Reply key words , Get the corresponding data :

key word Data name 600《Python Knowledge Manual 》md《Markdown Quick reference table 》time《Python Time use guide 》str《Python String lookup table 》pip《Python:Pip Quick reference table 》style《Pandas Table style configuration guide 》mat《Matplotlib introduction 100 A case 》px《Plotly Express Visualization guide 》

Selected content

Data Science :VS Code in Python Configuration Guide | Financial tools Tushare | Matplotlib The most valuable 50 A chart

Book reading : How to read a book | Buffett's way | value | principle | The most important thing about investing | Davis Dynasty | Where is the customer's yacht | Deliberate practice | Lincoln | Pyramid principle

Investment summary :2021Q4 | 2021Q3 | 2021Q2 | 2021Q1 | 2020Q4

Featured Videos

visualization :Plotly Express

Finance and economics, :Plotly Application in the field of investment | draw K Line chart

Sorting algorithm : Summary | Bubble sort | Selection sort | Quick sort | Merge sort | Heap sort | Insertion sort | Shell Sort | Count sorting | Bucket sort | Radix sorting


  1. 上一篇文章:
  2. 下一篇文章:
Copyright © 程式師世界 All Rights Reserved