diff --git a/CMakeLists.txt b/CMakeLists.txt
index e6833cbf85ec91a0d5a98cdaa6e9afaef49890ed..409ef786e46e62b32648e7eb7287cdb7f1df0a13 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,5 +1,9 @@
 cmake_minimum_required (VERSION 2.8.6)
 project (opendht)
+set (opendht_VERSION_MAJOR 0)
+set (opendht_VERSION_MINOR 1)
+set (opendht_VERSION ${opendht_VERSION_MAJOR}.${opendht_VERSION_MINOR})
+set (PACKAGE_VERSION ${opendht_VERSION})
 
 list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake")
 
@@ -78,6 +82,10 @@ if (OPENDHT_TOOLS)
 	add_subdirectory(tools)
 endif ()
 
+if (OPENDHT_PYTHON)
+	add_subdirectory(python)
+endif ()
+
 install (TARGETS opendht opendht-static DESTINATION ${CMAKE_INSTALL_LIBDIR})
 install (DIRECTORY include DESTINATION ${CMAKE_INSTALL_PREFIX})
 install (FILES ${CMAKE_CURRENT_BINARY_DIR}/opendht.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
diff --git a/configure.ac b/configure.ac
index c4a3f058128950b5ff6179a3d998ac0a4568380c..2f3c37915d7a0e13dd9359e9ad63be387110c193 100644
--- a/configure.ac
+++ b/configure.ac
@@ -80,7 +80,15 @@ AC_ARG_ENABLE([tools], AS_HELP_STRING([--disable-tools],[Disable tools (CLI DHT
 AM_CONDITIONAL(ENABLE_TOOLS, test x$build_tools == xyes)
 
 AM_COND_IF([HAVE_DOXYGEN], [AC_CONFIG_FILES([doc/Doxyfile doc/Makefile])])
-AM_COND_IF([USE_CYTHON], [AC_CONFIG_FILES([python/Makefile])])
+
+dnl Configure setup.py if we build the python module
+AM_COND_IF([USE_CYTHON], [
+    AC_SUBST(CURRENT_SOURCE_DIR, ".")
+    AC_SUBST(CURRENT_BINARY_DIR, ".")
+    AC_SUBST(PROJECT_SOURCE_DIR, "..")
+    AC_SUBST(PROJECT_BINARY_DIR, "../src/.libs")
+    AC_CONFIG_FILES([python/Makefile python/setup.py])
+])
 
 AC_CONFIG_FILES([Makefile
                  src/Makefile
diff --git a/python/CMakeLists.txt b/python/CMakeLists.txt
new file mode 100644
index 0000000000000000000000000000000000000000..d712c12456fe0a497224781a39554c5116d2f786
--- /dev/null
+++ b/python/CMakeLists.txt
@@ -0,0 +1,11 @@
+
+set(CURRENT_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
+set(CURRENT_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR})
+
+configure_file(setup.py.in setup.py)
+
+add_custom_target(python ALL
+	COMMAND python3 setup.py build
+	DEPENDS opendht opendht_cpp.pxd opendht.pyx)
+
+install(CODE "execute_process(COMMAND python3 setup.py install --prefix=${CMAKE_INSTALL_PREFIX} WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})")
diff --git a/python/Makefile.am b/python/Makefile.am
index 3c6100be7a7dd79dffb9fa1b039d93491a9364b3..f2a55852a91d8aec02d209e93adba1f49b2a828c 100644
--- a/python/Makefile.am
+++ b/python/Makefile.am
@@ -11,7 +11,7 @@ clean-local:
 	rm -rf $(builddir)/build $(builddir)/*.so
 
 install:
-	$(PYTHON) setup.py install
+	$(PYTHON) setup.py install --prefix=$(PYTHON_PREFIX)
 	rm -rf $(builddir)/build
 
 endif
\ No newline at end of file
diff --git a/python/setup.py b/python/setup.py.in
similarity index 59%
rename from python/setup.py
rename to python/setup.py.in
index 29a416a36cde528b0a72e0ecf44095b9d924bcb5..2088709bacf6fc3336b8a84ca210a778f291d97e 100644
--- a/python/setup.py
+++ b/python/setup.py.in
@@ -26,17 +26,32 @@ from Cython.Build import cythonize
 from Cython.Distutils import build_ext
 
 setup(name="opendht",
-      version="0.1",
-      description="Cython generated wrapper for opendht",
-      author="Guillaume Roguez",
+      version="@PACKAGE_VERSION@",
+      description="Python wrapper for opendht",
+      author="Adrien Béraud, Guillaume Roguez",
       license="GPLv3",
+      classifiers=[
+          'Development Status :: 3 - Alpha',
+          'Intended Audience :: Developers',
+          'Topic :: Software Development :: Libraries :: Python Modules',
+          'Topic :: System :: Distributed Computing',
+          'Topic :: System :: Networking'
+          'License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)',
+          'Programming Language :: Python :: 3',
+          'Programming Language :: Python :: 3.2',
+          'Programming Language :: Python :: 3.3',
+          'Programming Language :: Python :: 3.4',
+          'Programming Language :: Python :: 3.5',
+      ],
       cmdclass = { 'build_ext' : build_ext },
       ext_modules = cythonize(Extension(
           "opendht",
-          ["opendht.pyx"],
+          ["@CURRENT_SOURCE_DIR@/opendht.pyx"],
+          include_dirs = ['@PROJECT_SOURCE_DIR@/include'],
           language="c++",
           extra_compile_args=["-std=c++11"],
           extra_link_args=["-std=c++11"],
-          libraries=["opendht"]
+          libraries=["opendht"],
+          library_dirs = ['@CURRENT_BINARY_DIR@', '@PROJECT_BINARY_DIR@']
       ))
 )