Skip to content

Commit dee8c56

Browse files
committed
[Quality] Automatically get version
1 parent a37e79f commit dee8c56

1 file changed

Lines changed: 17 additions & 1 deletion

File tree

setup.py

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,28 @@
11
# Copyright (c) 2022-2024.
22
# ProrokLab (https://www.proroklab.org/)
33
# All rights reserved.
4+
import pathlib
45

56
from setuptools import find_packages, setup
67

8+
9+
def get_version():
10+
"""Gets the vmas version."""
11+
path = CWD / "vmas" / "__init__.py"
12+
content = path.read_text()
13+
14+
for line in content.splitlines():
15+
if line.startswith("__version__"):
16+
return line.strip().split()[-1].strip().strip('"')
17+
raise RuntimeError("bad version data in __init__.py")
18+
19+
20+
CWD = pathlib.Path(__file__).absolute().parent
21+
22+
723
setup(
824
name="vmas",
9-
version="1.4.0",
25+
version=get_version(),
1026
description="Vectorized Multi-Agent Simulator",
1127
url="https://github.com/proroklab/VectorizedMultiAgentSimulator",
1228
license="GPLv3",

0 commit comments

Comments
 (0)