From fcfe1f9637973c4c5f7f2f57aba4ce77c0fb2002 Mon Sep 17 00:00:00 2001 From: Mario Mulansky Date: Tue, 4 Nov 2014 12:02:08 +0100 Subject: packaging info to distribute on PyPI --- Readme.rst | 19 +++++++++++++--- setup.cfg | 2 ++ setup.py | 73 ++++++++++++++++++++++++++++++++++++++++++++++++++++---------- 3 files changed, 80 insertions(+), 14 deletions(-) create mode 100644 setup.cfg diff --git a/Readme.rst b/Readme.rst index 662cc1f..4053995 100644 --- a/Readme.rst +++ b/Readme.rst @@ -20,12 +20,25 @@ All source codes are published under the BSD_License_. Requirements and Installation ----------------------------- -To use PySpike you need Python installed with the following additional packages: +PySpike is available at Python Package Index and this is the easiest way to obtain the PySpike package. +If you have `pip` installed, just run + +.. code:: bash + + sudo pip install pyspike + +to install pyspike. +PySpike requires `numpy` as minimal requirement, as well as a C compiler to generate the binaries. + +Install from Github sources +........................... + +You can also obtain the latest PySpike developer version from the github repository. +For that, make sure you have the following Python libraries installed: - numpy -- scipy -- matplotlib - cython +- matplotlib (for the examples) - nosetests (for running the tests) In particular, make sure that cython_ is configured properly and able to locate a C compiler, otherwise PySpike will use the much slower Python implementations. diff --git a/setup.cfg b/setup.cfg new file mode 100644 index 0000000..2aee194 --- /dev/null +++ b/setup.cfg @@ -0,0 +1,2 @@ +[metadata] +description-file = Readme.rst diff --git a/setup.py b/setup.py index fc8d0d2..3bae9d5 100644 --- a/setup.py +++ b/setup.py @@ -1,24 +1,75 @@ """ setup.py -Handles the compilation of pyx source files - -run as: +to compile cython files: python setup.py build_ext --inplace + Copyright 2014, Mario Mulansky Distributed under the BSD License """ -from distutils.core import setup +from setuptools import setup, find_packages +from distutils.extension import Extension import numpy try: - from Cython.Build import cythonize - setup( - ext_modules=cythonize("pyspike/*.pyx"), - include_dirs=[numpy.get_include()] - ) + from Cython.Distutils import build_ext except ImportError: - print("Error: Cython is not installed! You will only be able to use the \ -much slower Python backend in PySpike.") + use_cython = False +else: + use_cython = True + +cmdclass = {} +ext_modules = [] + +if use_cython: + ext_modules += [ + Extension("pyspike.cython_add", ["pyspike/cython_add.pyx"]), + Extension("pyspike.cython_distance", ["pyspike/cython_distance.pyx"]), + ] + cmdclass.update({'build_ext': build_ext}) +else: + ext_modules += [ + Extension("pyspike.cython_add", ["pyspike/cython_add.c"]), + Extension("pyspike.cython_distance", ["pyspike/cython_distance.c"]), + ] + +setup( + name='pyspike', + packages=find_packages(exclude=['doc']), + version='0.1.2', + cmdclass=cmdclass, + ext_modules=ext_modules, + description='A Python library for the numerical analysis of spike\ +train similarity', + author='Mario Mulansky', + author_email='mario.mulanskygmx.net', + license='BSD', + url='https://github.com/mariomulansky/PySpike', + # download_url='https://github.com/mariomulansky/PySpike/tarball/0.1', + install_requires=['numpy'], + keywords=['data analysis', 'spike', 'neuroscience'], # arbitrary keywords + classifiers=[ + # How mature is this project? Common values are + # 3 - Alpha + # 4 - Beta + # 5 - Production/Stable + 'Development Status :: 3 - Alpha', + + # Indicate who your project is intended for + 'Intended Audience :: Science/Research', + 'Topic :: Scientific/Engineering', + 'Topic :: Scientific/Engineering :: Information Analysis', + + 'License :: OSI Approved :: BSD License', + + 'Programming Language :: Python :: 2', + 'Programming Language :: Python :: 2.6', + 'Programming Language :: Python :: 2.7', + ], + package_data={ + 'pyspike': ['cython_add.c', 'cython_distance.c'], + 'test': ['Spike_testdata.txt'] + } +) -- cgit v1.2.3