"vscode:/vscode.git/clone" did not exist on "89abfc3120141c774584dc33c440180393176e02"
Commit 31f78a98 authored by Max H. Gerlach's avatar Max H. Gerlach
Browse files

Allow adding an optional local version to the package version

parent 40a25c8e
...@@ -2,6 +2,8 @@ ...@@ -2,6 +2,8 @@
import sys import sys
import warnings import warnings
import os import os
import re
import ast
from pathlib import Path from pathlib import Path
from packaging.version import parse, Version from packaging.version import parse, Version
...@@ -160,9 +162,19 @@ ext_modules.append( ...@@ -160,9 +162,19 @@ ext_modules.append(
) )
) )
def get_package_version():
with open(Path(this_dir) / "flash_attn" / "__init__.py", "r") as f:
version_match = re.search(r"^__version__\s*=\s*(.*)$", f.read(), re.MULTILINE)
public_version = ast.literal_eval(version_match.group(1))
local_version = os.environ.get("FLASH_ATTN_LOCAL_VERSION")
if local_version:
return f"{public_version}+{local_version}"
else:
return str(public_version)
setup( setup(
name="flash_attn", name="flash_attn",
version="1.0.5", version=get_package_version(),
packages=find_packages( packages=find_packages(
exclude=("build", "csrc", "include", "tests", "dist", "docs", "benchmarks", "flash_attn.egg-info",) exclude=("build", "csrc", "include", "tests", "dist", "docs", "benchmarks", "flash_attn.egg-info",)
), ),
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment