diff --git a/.svnignore b/.svnignore
deleted file mode 100644
index e7a557acd5b9073a907491a77dedb1f502692e1f..0000000000000000000000000000000000000000
--- a/.svnignore
+++ /dev/null
@@ -1,9 +0,0 @@
-.venv
-.idea
-.eggs
-.git
-*.pyc
-data
-docs/_static
-docs/_templates
-docs/_builds
\ No newline at end of file
diff --git a/MANIFEST.in b/MANIFEST.in
index 768082a667c3af43054c115e7c39844a749758aa..20067d14b5bd6146cc3e7f8dff58c610557e34a0 100644
--- a/MANIFEST.in
+++ b/MANIFEST.in
@@ -1,4 +1,5 @@
 graft ariaec/conf
 graft ariaec/templates
 graft ariaec/data
-graft docs
\ No newline at end of file
+graft docs
+prune examples*
diff --git a/ariaec/pdbstat.py b/ariaec/pdbstat.py
index 8977682dbf97b98746bf4bb01fbe152f2531211b..68e963c67ab82cefa8645ea0a060218ac414692e 100644
--- a/ariaec/pdbstat.py
+++ b/ariaec/pdbstat.py
@@ -273,6 +273,9 @@ class PDBStat(object):
         # pool = ProcessingPool(nodes=ncpus)
         # iteresults = pool.imap(self.subdist, [dists]*len(groups), groups)
         # interdists = []
+
+        # TODO: use sql to select subdataframes in order to work with heavy
+        # data http://pythondata.com/working-large-csv-files-python/
         tqdm_out = TqdmToLogger(LOG, level=logging.INFO)
         interdists = [
             self.subdist(dists, group) for group in tqdm(groups, file=tqdm_out,
diff --git a/setup.cfg b/setup.cfg
index 891a0be72387018fc843accede0dec9ea4bcfee3..5de3f6f301720977ea68df109df03a5ebe2589da 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -4,4 +4,4 @@
 # will need to generate wheels for each Python version that you support.
 universal=1
 [egg_info]
-tag_build = .dev
+# tag_build = .dev
diff --git a/setup.py b/setup.py
index 2633f708a1b9a20a041aeb46ad417251e7f83a82..76c6a2c472a5a023dd53d42eb664f13304e6943c 100644
--- a/setup.py
+++ b/setup.py
@@ -6,13 +6,14 @@ from __future__ import absolute_import, division, print_function
 
 import os
 import sys
+import re
 import textwrap
-import subprocess
 import pkg_resources
+from version import get_version
 from setuptools import Command, find_packages, setup
 
 
-DOCLINES = __doc__.split("\n")
+DOCLINES = re.sub("\n", " ", re.sub(" {2,}", "", __doc__))
 
 CLASSIFIERS = """\
 Development Status :: 3 - Alpha
@@ -35,13 +36,6 @@ Operating System :: Unix
 Operating System :: MacOS
 """
 
-MAJOR = 0
-MINOR = 1
-MICRO = 0
-ISRELEASED = False
-# TODO: get version tag in ariabase.py ?
-VERSION = '%d.%d.%d' % (MAJOR, MINOR, MICRO)
-
 
 # Compatibility checks
 # TODO: Change this line after python 3 compatibility done !
@@ -90,61 +84,16 @@ def is_installed(requirement):
         pkg_resources.require(requirement)
     except pkg_resources.ResolutionError:
         return False
-    else:
+    finally:
         return True
 
 
-def git_version():
-    """
-    Return the git revision as a string
-    """
-    def _minimal_ext_cmd(cmd):
-        # construct minimal environment
-        env = {}
-        for k in ['SYSTEMROOT', 'PATH']:
-            v = os.environ.get(k)
-            if v is not None:
-                env[k] = v
-        # LANGUAGE is used on win32
-        env['LANGUAGE'] = 'C'
-        env['LANG'] = 'C'
-        env['LC_ALL'] = 'C'
-        return subprocess.Popen(
-            cmd, stdout=subprocess.PIPE, env=env).communicate()[0]
-
-    try:
-        out = _minimal_ext_cmd(['git', 'rev-parse', 'HEAD'])
-        git_revision = out.strip().decode('ascii')
-    except OSError:
-        git_revision = "Unknown"
-
-    return git_revision
-
-
-def get_version_info():
-    """
-    Return full version number with git revision string
-    """
-    # Adding the git rev number needs to be done inside write_version_py(),
-    # otherwise the import of aria.version messes up the build under Python 3.
-    full_version = VERSION
-    if os.path.exists('.git'):
-        git_revision = git_version()
-    else:
-        git_revision = "Unknown"
-
-    if not ISRELEASED:
-        full_version += '.dev0+' + git_revision[:7]
-
-    return full_version, git_revision
-
-
 def setup_package():
     """Main function"""
 
     metadata = dict(
         name='ariaec',
-        version=get_version_info()[0],
+        version=get_version(),
         maintainer="ARIA Developers",
         # maintainer_email="bardiaux@pasteur.fr",
         author="Allain Fabrice",
@@ -197,24 +146,28 @@ def setup_package():
         # TODO: solution to enable zip_safe
         zip_safe=False,
 
-        package_dir={'ariaec': './ariaec'},
+        # Doesn't works if we use package_dir with include_package_data
+        # package_dir={'ariaec': './ariaec'},
 
-        packages=find_packages(),
+        packages=find_packages(exclude=("examples",)),
 
         # Install any data files found in the package
         include_package_data=True,
 
-        package_data={
-            # If any package contains these files, include them
-            '': ['*.txt', '*.rst'],
-            # And include files found in the 'ariaec' package, too:
-            'ariaec': ['conf/*',
-                       'templates/*',
-                       'data/cullpdb/160427/*',
-                       'data/cullpdb/170315/*'
-                       'data/*',
-                       ],
-        },
+        # Using MANIFEST file, we do not need package_data which doesn't work
+        # for all kind of building process ...
+        # package_data={
+        #     # If any package contains these files, include them
+        #     '': ['*.txt', '*.rst', '*.p', '*.pro'],
+        #     # And include files found in the 'ariaec' package, too:
+        #     'ariaec': ['conf/*',
+        #                'templates/*',
+        #                'data/pdbdists/*'
+        #                'data/cullpdb/160427/*',
+        #                'data/cullpdb/170315/*'
+        #                'data/*',
+        #                ],
+        # },
 
         # If we want to include non data files (documentation, examples, ..)
         # in the sys.prefix directory. The package can't access these files !
@@ -231,7 +184,7 @@ Error: numpy needs to be installed first. You can install it via:
 
 $ pip install numpy
 """), file=sys.stderr)
-    exit(1)
+    sys.exit(1)
 
 
 if not is_installed('matplotlib'):
@@ -240,7 +193,7 @@ Error: matplotlib needs to be installed first. You can install it via:
 
 $ pip install matplotlib
 """), file=sys.stderr)
-    exit(1)
+    sys.exit(1)
 
 
 if __name__ == '__main__':
diff --git a/svnignore.txt b/svnignore.txt
deleted file mode 100644
index e7a557acd5b9073a907491a77dedb1f502692e1f..0000000000000000000000000000000000000000
--- a/svnignore.txt
+++ /dev/null
@@ -1,9 +0,0 @@
-.venv
-.idea
-.eggs
-.git
-*.pyc
-data
-docs/_static
-docs/_templates
-docs/_builds
\ No newline at end of file
diff --git a/version.py b/version.py
index 4f3d3d8980dfda6d1c25acff17c0762480a1ce13..93ab773adc3a6c0049b949e703e97df3875b6af3 100644
--- a/version.py
+++ b/version.py
@@ -1,6 +1,82 @@
 # coding=utf-8
+# This program is placed into the public domain.
+
 """
-                                VERSION
+Gets the current version number.
+If in a git repository, it is the current git tag.
+Otherwise it is the one contained in the PKG-INFO file.
+
+To use this script, simply import it in your setup.py file
+and use the results of get_version() as your package version:
+
+    from version import *
+
+    setup(
+        ...
+        version=get_version(),
+        ...
+    )
 """
-# Do not edit this file, pipeline versioning is governed by git tags
-__version__ = 'v0.1.0'
+
+__all__ = 'get_version'
+
+from os.path import dirname, isdir, join
+import sys
+import os
+import re
+import subprocess
+
+version_re = re.compile('^Version: (.+)$', re.M)
+
+
+def get_version():
+    """
+    
+    Returns
+    -------
+
+    """
+    d = dirname(__file__)
+    version = ''
+    dirty = ''
+
+    if isdir(join(d, '.git')):
+        # Get the version using "git describe".
+        cmd = 'git describe --tags'.split()
+        try:
+            version = subprocess.check_output(cmd).decode().strip()
+        except subprocess.CalledProcessError:
+            print('Unable to get version number from git tags')
+            sys.exit(1)
+
+        # PEP 386 compatibility
+        if '-' in version:
+            version = '.post'.join(version.split('-')[:2])
+
+        # Don't declare a version "dirty" merely because a time stamp has
+        # changed. If it is dirty, append a ".dev1" suffix to indicate a
+        # development revision after the release.
+        with open(os.devnull, 'w') as fd_devnull:
+            subprocess.call(['git', 'status'],
+                            stdout=fd_devnull, stderr=fd_devnull)
+
+        cmd = 'git diff-index --name-only HEAD'.split()
+        try:
+            dirty = subprocess.check_output(cmd).decode().strip()
+        except subprocess.CalledProcessError:
+            print('Unable to get git index status')
+            sys.exit(1)
+
+        if dirty != '':
+            version += '.dev1'
+
+    else:
+        # Extract the version from the PKG-INFO file.
+        with open(join(d, 'PKG-INFO')) as f:
+            version = version_re.search(f.read()).group(1)
+
+    return version
+
+
+if __name__ == '__main__':
+    print(get_version())