A summary of interesting open source projects in Python

Game Python open source project

First let’s take a look at what digg has done with Python.

Python: Game: Gobang vs man

By comparing gobang with previous games, the author introduces how to use Python to draw boards, pieces, and pieces. Gobang man-machine battle compared to the ordinary battle difficulty increased a lot. If it’s a person-to-person fight, the computer just needs to decide if it won. If it’s man versus machine, you have to let the computer know how to play. To learn about gobang man-machine war, see details: gobang man-machine war

Python Tkinter Tutorial series: Rock, Paper, Scissors Games

How to develop the same game using Python 3 and Tkinter. Implementing rock-paper-scissors gameplay? Python Tkinter tutorial series: Rock paper Scissors game

Childhood Memories — How to write a Tetris mini-game in Python!

When it comes to memory games, tetris is a game, you will think of their writing should play more feeling, and then write a tetris game, the author in this paper shows the source code in detail, and the detailed operation flow, details see: [the memory of his childhood – how to use python to write a small game tetris!]

1.15-minute-apps

A collection of small desktop applications written based on the PyQt framework. If you want to write desktop applications in Python, this project should help you. Like writing a minesweeper game:

2,running_page

A Python project that presents a personal running page. Features:

  • GitHub Actions Management automatically synchronizes running processes and automatically generates new pages
  • Gatsby generated static web pages, fast
  • Mapbox displays maps
  • Support data from Nike, Runtastic, Garmin and Keep
  • Automatic backup of GPX data, easy backup and upload to other software

3,free-python-games

True entry-level Python game collection library. Are simple small games: snake, maze, Pong, guess the word, etc., easy to run, simple code to understand. Start your Python learning journey with the game, and have fun learning the source code after playing. Installation and operation:

pip install freegames python -m freegames.snake # freegames. The game nameCopy the code

4,PyBoy

GameBoy emulator written in Python. Not only can be used to remember childhood, but also can use this library to write “plugins”, before the abuse of your thousands of times of the game. Now use Python to find the field, don’t go after school, see you at the school gate! Sample code:

from pyboy import PyBoy
pyboy = PyBoy('ROMs/gamerom.gb')
while not pyboy.tick():
    pass
Copy the code

5,rssant

A free open source RSS subscription project written by Django server. You can deploy it yourself or use the online version directly, avoiding the noise of recommendations and ads and focusing on what you subscribe to

🔙

6,wttr.in

A Python command-line weather viewing tool

7,akshare

An open source financial data interface library based on Python. It provides basic data, real-time and historical market data and derivative data of financial products such as stocks, futures, options, funds and digital currencies, including a set of open source tools for data collection, data cleaning and data landing. It meets the needs of financial data scientists and data science enthusiasts in financial data acquisition. Sample code:

Import akshare as ak bond_df = ak.bond_spot_deal() print(bond_df) net traded price (yuan) Latest yield (%) Up/down (BP) Weighted yield (%) Trading volume (hundred million) 0 19 open 15 98.97 3.5750 1.00 3.5826 None 1 19 treasurys 03 99.82 2.7714 0.14 2.7772 None 2 19 treasurys 11 99.87 2.8000 0.25 2.7963 None 3 19 Treasury Bonds 04 100.82 2.9832-1.54 2.9747 None 4 15 Treasury bonds 05 102.95 3.0359-1.41 3.0359 NoneCopy the code

Eight,activitywatch

A Python project that tracks where you spend your time. Supports Web visualization, with the following effects

9,PythonPlantsVsZombies

Plants vs Zombies written in Python. Learn an excellent example of how to write a small game in Python, run the following steps:

2. Install dependent libraries: PIP install Pygame 3. Python main.pyCopy the code

Tutorial Python open source project

1.learn-python

A free tutorial on Python with code and comments. Each basic Python syntax and knowledge is explained using examples of working code, along with appropriate comments and references to get you started. This project can be used not only as a source for learning Python, but also as a quick reference

"""WHILE statement @see: https://docs.python.org/3/tutorial/controlflow.html @see: https://docs.python.org/3/reference/compound_stmts.html#the-while-statement The while loop executes as long as the condition remains true. In Python, like in C, any non-zero integer value is true; zero is false. The condition may also be a string or list value, in fact any sequence; anything with a non-zero length is true, empty sequences are false. The test used in the example is a simple comparison. The standard comparison operators are written the same as in C: < (less than), > (greater than), == (equal to), <= (less than or equal to), >= (greater than or equal to) and ! = (not equal to). """ def test_while_statement(): """WHILE statement""" # Let's raise the number to certain power using while loop. number = 2 power = 5 result = 1 while power > 0: result *= number power -= 1 # 2^5 = 32 assert result == 32Copy the code

2,python-patterns

A collection of Python design patterns and usage scenarios

3,practical-python

David Beazley’s open source Python tutorial is a free introductory tutorial. He is the author of the Python Cookbook, Third Edition, and the Python Reference Manual, which includes hands-on teaching and after-school practice problems. Online learning, the tutorial directory is as follows:

4,readthedocs.org

Readthedocs.org. This site hosts Scrapy, Requests, bootstrap-datepicker, and other popular libraries. I checked that the project was developed based on Django, and the files required patience

5,learn-python3

A copy of Python3 tutorial, please check. This course is easy to run and read thanks to the notebooks format of Jupyter. It also includes practice questions for beginners. The disadvantage is the English tutorial, but I can understand you can certainly

6,Computer-Networking-A-Top-Down-Approach-NOTES

Computer Networking – top-down approach programming assignment. Contains questions and Python code solutions, and Wireshark experiment sections are official documentation translations

7,geek_crawler

Geek Time courses (currently audio, text and text only) download to a local Python script. You need to input your account password before you can save the specified Geek time column courses to your local computer, which is convenient for learning anytime and anywhere

Eight,python-small-examples

A collection of interesting and useful Python code examples. Python basics, tips, pits, file manipulation, machine learning, drawing, etc. The code is as follows:

From Pyecharts import options as opts from Pyecharts. Charts import Liquid, Page from pyecharts.globals import SymbolType def liquid() -> Liquid: C = (Liquid().add("lq", [0.67, 0.30, Set_global_opts (title_opts= opts.titleopts (title="Liquid"))) return c Liquid ().render('./img/liquid.html')Copy the code

Work efficiency improvement zone

1.BaoTa

Pagoda Linux server operation and maintenance management platform. Simple and easy to use server operation and maintenance platform, support one-click LNMP installation, cluster management, website, database and other functions, can effectively improve the standardization and security of operation, reduce the probability of error. The open source project is available for free, and there is a paid professional version

2,recommenders

Recommended system best practices presented in the form of Jupyter Notebook This is Microsoft’s open source recommendation system tutorial. The project also includes the Python toolkit for recommendation systems

3,magic-wormhole

A tool that can safely transfer files to another computer with a single command. Based on the Password-authenticated Key Exchange (PAKE) protocol, encrypted files are transmitted on the public network. Only one command is required for sending and receiving files

4,tomato-clock

Command line Pomodoro timer written in Python. The code is just over 100 lines long and does not rely on other third-party libraries

🍅 tomato, 25 minutes. Ctrl + C to exit 🍅 🍅 -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- - "⏰ [8%]Copy the code

5,vardbg

Python is a code debugging tool that can export the execution of Python programs as videos or gifs. It can be used for animation algorithm, making code to explain video and other scenes

6,apkleaks

A command line tool that scans APK files for sensitive information

// custom-rules.json
{
  "Amazon AWS Access Key ID": "AKIA[0-9A-Z]{16}",
  ...
}
$ apkleaks -f /path/to/file.apk -p rules.json -o ~/Documents/apkleaks-results.txt
Copy the code

7,ArchiveBox

Web archive platform based on Python implementation. It is a tool that can automatically turn web pages (HTML, PDF, pictures, etc.) into static pages and download them to local storage and management. It can be used as a mirror station, archive, offline reading, etc

Eight,Airtest

Cross-platform UI automation framework for mobile applications. Based on image recognition and location elements, it might be easy to test an APP or swipe without a line of code

9,lux

An open source Python library for data science. The library is designed for laboratory data analysis. Pandas, with its rich data access methods and data processing capabilities, provides simple data analysis to find the “truth” hidden in data.

10,qutebrowser

Based on PyQt5 prepared Vim mode of operation browser. It supports Linux, Windows and macOS operating systems. You can install it first. And then look at the source code and learn how to write a browser in Python

11,requests-html

Good Python parsing HTML library. Any crawler has experienced the agony of parsing HTML with BeautifulSoup, LXML, and Scrapy’s selector. Today you have the new options-HTML with support for XPath, CSS selectors, dynamic pages, filtering specified content, and more. Getting started was so easy and fast that I used it in my crawler project Hydra, which made parsing HTML a lot easier. Here are some examples of functions that I find useful:

# to find elements of all links about. Absolute_links {' http://brochure.getpython.info/ ', 'https://www.python.org/about/quotes/', 'https://www.python.org/about/help/'} # matching content > > > r.h. HTML. The search (' Python is a {} language) [0] # programming directly extracts the value of the attribute > > > Attrs {'id': 'about', 'class': ('tier-1', 'element-1'), 'aria-haspopup': 'true'}Copy the code

12,alive-progress

New! Python cool progress bar project. Example code for supporting PYTHon2.7-3.8:

PIP install alive-progress from alive_progress import alive_bar with alive_bar(total) as bar: # declare your expected total for item in items: # iterate as usual over your items ... # process each item bar() # call after consuming one itemCopy the code

13,PyG2Plot

Python3 visual library based on G2Plot encapsulation. G2Plot is ant group’s open source visual analysis chart library based on chart taxonomy, built in 25+ common chart types. This library is Python’s encapsulation of G2Plot and is a good experience, right out of the box

from pyg2plot import Plot line = Plot("Line") line.set_options({ "height": 400, # set a default height in jupyter preview "data": [ { "year": "1991", "value": 3 }, { "year": "1992", "value": 4}, {" year ":" 1993 ", "value" : 3.5}, {" year ":" 1994 ", "value" : 5}, {" year ":" 1995 ", "value" : 4.9}, {" year ": "1996", "value": 6 }, { "year": "1997", "value": 7 }, { "year": "1998", "value": 9 }, { "year": "1999", "value": 13 }, ], "xField": "year", "yField": "value", }) line.render_notebook()Copy the code

14,Zappa

Python has no serverless framework. Do you know what serverless is? Don’t understand old iron buckle 1 🤝 I lay my cards on the table I don’t understand this thing. Until I saw Zappa, and the words came to my mind: Get out of the way. Use it to develop features, package up a few commands, upload them to the cloud, and forget about it! Not only programmers like it, but also bosses like it because it reduces server costs (and saves money). Feel the power of knowledge

15,xonsh

A shell that supports Python enabling. If you can’t write shell scripts, but you know Python. This project allows you to mix shell commands with Python syntax to do what you want efficiently and quickly

16,python-cheatsheet

A comprehensive and useful Python memo. For example, I can’t remember how to write regs in Python, I can’t remember library names and basic usage for a progress bar, and I can’t remember method parameters for processing data in PANDAS. I found this project just when I thought I needed to “go back to the drawing board,” and I found snippets of code that worked with all of its problems. I’m the happy Pythoneer again.

# $ pip3 install tqdm >>> from tqdm import tqdm >>> from time import sleep >>> for el in tqdm([1, 2, 3], desc='Processing'): ... Sleep (1) Processing: 100% | █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ | 3/3 00:03 < 00:00, 1.00 s/itCopy the code

17,flask-state

Flask is a portable Flask plugin for monitoring machine state. Sample code:

flask_state.init_app(app)
// npm
import 'echarts';
import 'flask-state/flask-state.min.css';
import {init} from 'flask-state';
// Create a DOM node with ID 'test'. After init() binds the node, click to open the listening window
init({dom:document.getElementById('test')});
Copy the code

18,playwright-python

Microsoft’s open source browser automation tool allows you to operate your browser in Python. Supports Chromium, Firefox, and WebKit browsers on Linux, macOS, Windows, and Windows

19,wagtail

One of the most powerful open source Django CMS (Content management System) available today. I rarely use the word “most,” so let’s save time by talking about what amazes me about it. First of all, the project is updated and iterated actively. Secondly, the functions mentioned on the first page of the project are free, and there is no such operation as inexplicable lock. Wagtail focuses on content management without tying up front-end implementations. StreamField is an interesting technology that makes your content flexible and structured. It even supports A/B testing, and eventually Google, NASA, and others are using it

20,altair

Powerful Python library for data visualization. Support a variety of data display methods, simple interface, cool effect, sample code and effect are as follows:

import altair as alt from vega_datasets import data source = data.cars() brush = alt.selection(type='interval') points =  alt.Chart(source).mark_point().encode( x='Horsepower', y='Miles_per_Gallon', color=alt.condition(brush, 'Origin', alt.value('lightgray')) ).add_selection( brush ) bars = alt.Chart(source).mark_bar().encode( y='Origin', color='Origin', x='count(Origin)' ).transform_filter( brush ) points & barsCopy the code

21,butterfly

Another lightweight Python Web framework. There are so many Web frameworks, this project aims to develop a lightweight, reliable and usable Web framework to gain a deeper understanding of the often overlooked but very important knowledge points in Web development. I don’t understand until I do it again. The architecture diagram is as follows:

22,ar-cutpaste

AR copy physical photos to PS software tools. It can be used on an iPhone or Android phone to pull real objects out of their surroundings and paste them into Photoshop, with other applications to come

23,scalene

A high performance CPU and memory parser for Python. Scalene is fast, inexpensive, and provides comprehensive information for troubleshooting and optimizing Python programs that consume too many resources

24,KubeOperator

Open source container cluster management platform developed in Python. Plan, deploy, and manage production level Kubernetes cluster on VMware, Openstack, or physical machines through visual Web UI in offline network environment. Start your Kubernetes journey