Home > Article > Backend Development > 6 libraries that Python programmers need to know
1.Pyglet
What is: Pyglet is a cross-platform framework written in pure Python language, used to develop multimedia and Window special effects are applied.
Why it is needed: Developing the functional modules required for graphical interface applications from scratch is very cumbersome. Pyglet provides a large number of ready-made modules, saving a lot of time: window functions, OpenGL special effects, audio and video playback, keyboard and mouse processing and image processing. (However, Pyglet does not provide UI components such as buttons, toolbars or menus.)
All the above modules are implemented natively under Windows, OSX or Linux platforms , does not rely on external binary packages; it is written in pure Python. Pyglet is released under the BSD license and can be used in any commercial and open source projects. If you want to learn python, you can come to this group, 472, 309, 261. There are a lot of learning materials you can download.
2.Peewee
What is: Peewee is a small but very powerful library that supports database access through ORM and natively supports SQLite and MySQL and databases such as PostgreSQL.
Why it is needed: Any application that needs to frequently use external data will basically use a database, but reading and writing data from the database through temporary connections will cause a lot of trouble.
Peewee provides a safe and stable channel to access database resources. For Python programmers and database engineers, the Python classes provided by this library will be
handy. With the support of Peewee, we can access the database quickly and easily, and can be expanded to add more options in the future without redesigning. Peewee also natively supports database transactions and has many optional additional modules, providing everything from database connection pooling to advanced fields like many-to-many. Type and other functions.
If you want to learn python, you can come to this group, 472, 309, 261. There are a lot of learning materials that can be downloaded.
3.Bottle
What it is: Bottle is a small, lightweight network development framework that is also very fast.
Why you need it: If you just want to quickly create a Restful
APIinterface, or just want to use a network development framework to make a simple application, Bottle can easily to meet your requirements. It has all the features you will need: routing, templates, accessrequest and response
data (request and response data), support for multiple network servers, and advanced features such as WebSockets Function.
Creating an application requires very little work, and Bottle is designed with scalability in mind. If you need more advanced features, you can access them at any time.
4.Invoke
What it is: Simply put, Invoke allows you to easily perform system management tasks through a Python library.
Why you need it:
Who doesn’t want a “concise, high-level interface that can run shell commands, define and categorize execution tasks”? It is completely reasonable to use Python to replace ordinary shell scripts and perform corresponding tasks. Invoke provides solutions for performing common command line tasks and managing them. For Invoke, each management task is like a Python function, and more complex tasks can be designed elegantly on this basis.
It should be noted that Invoke is still a preview version; if you want to use a stable tool (even if it is no longer actively developed), you can consider Invoke's predecessor-Fabric.
5.Splinter
What it is: Splinter is a Python library for automated testing of network applications.
Why you need it: As we all know, there is nothing more boring than automated web application testing. With Splinter, you can automate all operations such as opening a browser, entering a URL, filling in a form, and clicking a button.
Specific browsers need to use corresponding drivers, but fortunately Chrome and Firefox drivers are already included. In addition, Splinter can also remotely control browsers on other machines through Selenium Remote. You can even manually execute JavaScript code in the target browser.
If you want to know the specific situation of a certain browser when browsing a specified website, then Splinter will be a very useful tool. If you want to learn about interacting with websites without relying on a browser, check out Twill. (Translator: Twill is a scripting language that supports users to browse the network through the command line.)
6.Arrow
What is: Arrow is a library that can better handle dates and times in Python (data/time ).
Why you need it: Dealing with time zones, date conversions, dealing with different date formats, and other date-related stuff is enough to give you a day and a half of headaches. If you use the modules in the standard library that comes with Python, you will probably have a headache for two days.
There are four major benefits to using the Arrow library, which are very useful in both the long and short term. First, it can perfectly replace the datetime module in Python, which means you can still use common function call forms like .now() and .utcnow().
Second, it provides methods to meet common needs such as converting time zones. Third, it provides "human-friendly" date/time information - that is, it can easily tell you whether something happened "one hour ago" or "will happen in two hours" . Fourth, it easily converts date/time information to local time.
The above is the detailed content of 6 libraries that Python programmers need to know. For more information, please follow other related articles on the PHP Chinese website!