setup.pyの雛形

だいたい同じパターンで書けるので流用できるようにメモ。
githubとかbitbucketにリポジトリを作ってpypiで公開する想定。
setup.py, README.rst, MANIFEST.inの3つからはじめる。

setup.py

#!/usr/bin/env python
# coding: utf-8


from setuptools import setup, find_packages
import sys

setup(
        name='glbase', # パッケージ名。他と被らないように適当に決める
        version='0.0.1',
        description='OpenGL scene graph and utilities', # 短い説明
        long_description=open('README.rst').read(), # 長い説明
        classifiers=[ # pypi登録用
            'Programming Language :: Python :: 2',
            'License :: OSI Approved :: zlib/libpng License',
            'Topic :: Multimedia :: Graphics :: 3D Modeling',
            ],
        keywords=['opengl'],  # pypi登録用
        author='ousttrue',  # pypi登録用
        author_email='ousttrue@gmail.com', # pypi登録用
        license='zlib', # pypi登録用
        install_requires=[ # easy_install用
            'glglue', 'pymeshio', # 依存パッケージ
            ],
        packages=find_packages(), # パッケージをカレントディレクトリから自動で探すっぽい
        test_suite='nose.collector', # noseでテストする
        tests_require=['Nose'], # noseでテストする
        )

README.rst

======
glbase
======
reStructuredText形式で説明を書く(utf-8)。githubの説明ページになる。setup.pyのlong_descriptionにも指定しているのでpypiのドキュメントにもなる。

MANIFEST.in

include README.rst

README.rstが無いとsetup.py installに失敗してしまう(setup.pyでopenしている・・・)ので忘れずに追加しておく。