diff --git a/docs/conf.py b/docs/conf.py
index aca5f67ea934faf619e92da1d6fe9b42225056ee..131090f636bb67a739fae43b169f5d0ea9a361e8 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -15,6 +15,8 @@
 import sys
 import os
 
+import jppy
+
 # If extensions (or modules to document with autodoc) are in another directory,
 # add these directories to sys.path here. If the directory is relative to the
 # documentation root, use os.path.abspath to make it absolute, like shown here.
@@ -61,9 +63,9 @@ author = u'Tamas Gal'
 # built documents.
 #
 # The short X.Y version.
-version = u'3.0.0'
+version = jppy.version
 # The full version, including alpha/beta/rc tags.
-release = u'3.0.0'
+release = ujppy.version
 
 # The language for content autogenerated by Sphinx. Refer to documentation
 # for a list of supported languages.
diff --git a/pyproject.toml b/pyproject.toml
index 51000e45b7991ca1dd65e0f3637695586c8216b5..a0a6409d121e6d9da585868d7f0fed0d3dcff874 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -1,2 +1,5 @@
 [build-system]
 requires = ["setuptools>=42", "wheel", "setuptools_scm[toml]>=3.4"]
+
+[tool.setuptools_scm]
+write_to = "jppy/version.py"
diff --git a/setup.py b/setup.py
index 063f36e42cc4326eb192e07427a25bf2fb6f964d..2251ecacfbe6a4620fc9ac29e49cac02c2c94a09 100644
--- a/setup.py
+++ b/setup.py
@@ -5,8 +5,6 @@ import sys
 import setuptools
 import subprocess as sp
 
-__version__ = '3.0.0'
-
 
 class get_pybind_include(object):
     """Helper class to determine the pybind11 include path
@@ -50,6 +48,7 @@ ext_modules = [
 # Populating the __init__.py with submodule imports, so that one can import
 # the package and use the submodules directly with the dot-sytax.
 with open("jppy/__init__.py", "w") as fobj:
+    fobj.write("from .version import version\n")
     for module in ext_modules:
         fobj.write("from . import {}\n".format(module.name.split('.')[1]))
 
@@ -128,7 +127,6 @@ class BuildExt(build_ext):
 
 setup(
     name='jppy',
-    version=__version__,
     author='Tamas Gal',
     author_email='tgal@km3net.de',
     url='https://git.km3net.de/km3py/jppy',