歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux基礎 >> Linux教程 >> Github上Python開發者應該關心的Repo

Github上Python開發者應該關心的Repo

日期:2017/2/28 13:47:50   编辑:Linux教程

carbaugh/lice

lice : Generate license files for your projects

一個用來為你的項目生成許可證的工具。這下可方便了,不用手工的去修改了!

coleifer/peewee

peewee: a small, expressive orm – supports postgresql, mysql and sqlite

你在用SQLAlchemy ? 我強烈推薦你看下peewee

來看一個例子:

User.select().where(User.active == True).order_by(User.username)

一個單文件的Python ORM.相當輕巧,支持三個數據庫。而且,它最討人喜歡的是它的輕量級的語法。

docopt/docopt

docopt : Pythonic command line arguments parser, that will make you smile

用過doctest? 那來看看docopt。有時候你用py寫一個命令行程序,需要接收命令行參數,看看這個例子:

"""Usage: test.py <file> [--verbose]"""

from docopt import docopt

print docopt(__doc__)

如果你這麼執行程序:

python test.py somefile --verbose

你會得到這樣的輸出:

{'--verbose': True, '<file>': 'somefile'}

hhatto/autopep8

autopep8 : A tool that automatically formats Python code to conform to the PEP 8 style guide.

每個Python程序員都應該checkout的repo.自動的把你的Python代碼轉成符合PEP8風格的代碼.

使用 -i 參數來直接修改你的 Python文件:

autopep8 -i mycode.py

kachayev/fn.py

fn.py : Functional programming in Python: implementation of missing features to enjoy FP

這是個很有趣的項目,來彌補Python在函數式編程方面沒有的一些特性。來看個sample:

from fn import _
assert list(map(_ * 2, range(5))) == [0,2,4,6,8]

nose-devs/nose

nose : nose is nicer testing for python

或許nose已經不是新鮮的測試框架了,現在還有很多新的測試框架誕生,不過大家都在用它,而且似乎沒要離開nose的意思。

amoffat/sh

sh : Python subprocess interface

這個庫已經被津津樂道很久了。看代碼:

from sh import git
git.clone("https://github.com/amoffat/sh")

是不是比 os.system 更簡潔明了。

Lokaltog/powerline

如果你是個linux(or mac)下的開發者,又喜歡在終端下工作的話,你一定喜歡用powerline來美化自己的工作空間。

之前github上興起了vim-powerline,tmux-powerline,還有powerline-bash,現在Lokaltog提供了一個統一的解決方案,只要安裝這個python包,再追加些東西到配置文件就可以使用漂亮的powerline了

具體的效果請見repo : https://github.com/Lokaltog/powerline

benoitc/gunicorn

gunicorn : gunicorn ‘Green Unicorn’ is a WSGI HTTP Server for UNIX, fast clients and sleepy applications

一個Python WSGI UNIX的HTTP服務器,從Ruby的獨角獸(Unicorn)項目移植。Gunicorn大致與各種Web框架兼容.

一個例子,運行你的flask app:

gunicorn myproject:app

使用起來超級簡單!我現在基本上不用uWSGI來部署我的Flask服務器了,如果有興趣的朋友可以看我之前寫的一篇博客 Flask + Gunicorn + Nginx 部署

faif/python-patterns

python-patterns : A collection of design patterns implemented (by other people) in python

這個repo收集了很多設計模式的python寫法

gutworth/six

six : Six is a Python 2 and 3 compatibility library

Six沒有托管在Github上,而是托管在了Bitbucket上,不過這些都不是重點,重點是它的作用。

眾所周知 Python 2 和 Python 3 版本的分裂給 Python 開發者們帶來了很大的煩惱,為了使代碼同時兼容兩個版本,往往要增加大量的代碼。 於是 Six 出現了。正如它的介紹所說,它是一個專門用來兼容 Python 2 和 Python 3 的庫。它解決了諸如 urllib 的部分方法不兼容, str 和 bytes 類型不兼容等“知名”問題。

它的效果怎麼樣?pypi上單日十萬以上,單月幾百萬的下載量足以說明了。要知道諸如 Flask 和 Django 這類知名的庫,月下載量也只有幾十萬。

Copyright © Linux教程網 All Rights Reserved