Skip to content

Commit

Permalink
[Quality] Automatically get version
Browse files Browse the repository at this point in the history
  • Loading branch information
matteobettini committed Apr 25, 2024
1 parent 2a85cd9 commit 7b70efe
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
4 changes: 4 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@

[build-system]
requires = ["setuptools"]
build-backend = "setuptools.build_meta"
16 changes: 15 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
# LICENSE file in the root directory of this source tree.
#
import os
import pathlib
from pathlib import Path

from setuptools import find_packages, setup
Expand All @@ -17,6 +18,19 @@ def package_files(directory):
return paths


def get_version():
"""Gets the benchmarl version."""
path = CWD / "benchmarl" / "__init__.py"
content = path.read_text()

for line in content.splitlines():
if line.startswith("__version__"):
return line.strip().split()[-1].strip().strip('"')
raise RuntimeError("bad version data in __init__.py")


CWD = pathlib.Path(__file__).absolute().parent

extra_files = package_files(
str(
Path(os.path.dirname(os.path.realpath(__file__)))
Expand All @@ -27,7 +41,7 @@ def package_files(directory):

setup(
name="benchmarl",
version="1.1.1",
version=get_version(),
description="BenchMARL",
url="https://github.com/facebookresearch/BenchMARL",
author="Matteo Bettini",
Expand Down

0 comments on commit 7b70efe

Please sign in to comment.