Based on this reddit post
This is a python script template, and it's a demonstrator and reminder for the most usefull python libraries and best practices
The Hitchhiker’s Guide to Python and Python patterns
This script template aim is to enforce best-pratices use.
Please contribute if you feel it should be better written. Pull Request welcome !!!
- logging
- Makefile
- requirement.txt / virtualenv
- Json configuration / Borg
- argument parsing: click
- python 2.7 / 3.4 compatibility
- py.test
- travis ci
- pep8 compliance check
- colorlog
- click progress bar
- collections: specifically namedtuples
- tempfile: always use this to create temporary files
- pillow: image juggling
- decimal: you will need it, try this if you dare:
print((0.1 + 0.1 + 0.1 - 0.3) == 0)
- csv: always use this to read/write CSV files, don't try and roll your own methods, it'll end in tears
- sqllite
- pandas -- csv loading and quick graphing
- datetime
- math -- try and use these functions rather than the global ones, as they're faster when you import them into the global namespace
- re -- regular expressions
- requests -- if you need to do any http requests at all, use this
- string -- I rarely see this used, but it's very handy
- rename git repo to perfect python script
- sphinx
- matplotlib
- unittest
- lxml -- always use this for working with XML data
- BeautifulSoup -- for webscraping and/or parsing potentially malformed HTML
- os / shutils
- setuptools
- redis
## Don't know if it's usefull
- buildout -- I'd recommend this over virtualenv any day
- PyYAML -- for working with YAML docs.
- ujson -- faster than both simplejson and the built-in json modules, handy if you work with lots of/big JSON blobs