diff --git a/pyproject.toml b/pyproject.toml
index 473a883b0..3143478aa 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -17,7 +17,8 @@ name = "quantus" # Required
#
# For a discussion on single-sourcing the version, see
# https://packaging.python.org/guides/single-sourcing-package-version/
-version = "0.4.1" # Required
+# version = "0.4.1" # Required
+dynamic = ["version"]
# This is a one-line description or tagline of what your project does. This
# corresponds to the "Summary" metadata field:
diff --git a/quantus/__init__.py b/quantus/__init__.py
index c2e598fef..6c84d1beb 100644
--- a/quantus/__init__.py
+++ b/quantus/__init__.py
@@ -3,6 +3,12 @@
# Quantus is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
# You should have received a copy of the GNU Lesser General Public License along with Quantus. If not, see .
# Quantus project URL: .
+import subprocess
+
+commit_sha = subprocess.check_output(['git', 'rev-parse', 'HEAD']).strip().decode('utf-8')
+version = subprocess.check_output(['git', 'describe', '--tags', '--always', '--dirty=-pre', commit_sha]).strip().decode('utf-8')
+
+__version__ = version
# Expose quantus.evaluate to the user.
from quantus.evaluation import evaluate