python package template

Tue 08 July 2014

I've been sitting on this for a while, it's time to announce it as I don't know what I can improve in it. It's a python library template with all the nuts and bolts included, designed to address packaging issues and pitfalls. Travis, Coveralls, AppVeyor, Pytest, Tox, coverage, bumpversion, isort are preconfigured. No need to futz around for 3 hours trying to figure out what's wrong with your coverage or test settings every time you create a library anymore.

It also includes a test grid configurator, along the lines of what I previously wrote about, but better, with declarative configuration.

This template errs on the side of "too much stuff" - it's easier to remove stuff you don't need than figuring out how to write it properly when you need it. Don't need sphinx docs? Easy, just delete the docs directory. Don't need basic version management, want to use something more complex? Just remove that .bumpversion.cfg.

Why is this good? *

I created this because every time I had the same problems:

  • I had to copy over configuration around from other projects, do a bit of search and replace, commit, realize it's wrong and then end up with lots of "Oooops, I forgot about this." commit messages.
  • The large amount of boilerplate required for a package is a detractor to getting a good package out there. It's daunting to write all that configuration, docs skeleton, contributor guides and whatnot - it's always more pleasing to write useful core than boring boilerplate.

The test grid configurator [1] is incredibly useful in situations where you want to test that your package works properly everywhere, in every configuration. Which you should :)

Where & how? *

Get cookiecutter:

pip install cookiecutter

And then create your library:



当前网页内容, 由 大妈 ZoomQuiet 使用工具: ScrapBook :: Firefox Extension 人工从互联网中收集并分享;
若有不妥, 欢迎评注提醒:


订阅 substack 体验古早写作:

点击注册~> 获得 100$ 体验券: DigitalOcean Referral Badge

关注公众号, 持续获得相关各种嗯哼:


关于 ~ DebugUself with DAMA ;-)
公安备案号: 44049002000656 ...::