Daemon Skeleton introduction

Posted by 4Aiur on 02/24/2013 in Python |

Daemon Skeleton introduction

Past couple of days, i’ve builded some daemon tools, tired to do the same thing again and again, i think i need a template, to create python project with daemon easy and fast. So created this template Daemon Skeleton.

In this template i used python-daemon as the daemonizer, and did some tweak, add SIGQUIT signal catching in this module, and reformat the source code according to PEP8.

Daemon Skeleton Quick start

Clone the git repository, remove folder .git, create isolated Python environment with virturalenv, install dependencies:

git clone https://github.com/mlf4aiur/daemon-skeleton.git
rm -rf .git
sudo pip install virtuall
virtualenv .venv
. .venv/bin/activate
pip install -r requirements.txt

Then, done. You can continue your daemon project now.

Another things for build good Python project

Automation

  • Create your own requirements.txt, when you need
pip freeze | awk -F = '{print $1}' > requirements.txt
  • Upgrade the packages to latest version
pip install -U -r requirements.txt
  • create a new source distribution as tarball
python setup.py sdist --formats=gztar
# Fabric
fab pack
  • Deploying your code automatically
fab pack deploy
  • Testing code
# nose
nosetests
# Fabric
fab test
# setuptools
python setup.py test

Good Documentation

pip install Sphinx
sphinx-quickstart
# Build docs
python setup.py build_sphinx

Related links

Tags: ,

Copyright © 2010-2024 4Aiur All rights reserved.
This site is using the Desk Mess Mirrored theme, v2.5, from BuyNowShop.com.