Skip to content

Commit

Permalink
add version attribute
Browse files Browse the repository at this point in the history
  • Loading branch information
lnthach committed Oct 5, 2023
1 parent e5369d4 commit 09a908c
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
17 changes: 16 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,22 @@

from setuptools import setup, Extension, find_packages
from Cython.Build import cythonize
import os

def read(rel_path: str) -> str:
here = os.path.abspath(os.path.dirname(__file__))
# intentionally *not* adding an encoding option to open, See:
# https://github.com/pypa/virtualenv/issues/201#issuecomment-3145690
with open(os.path.join(here, rel_path)) as fp:
return fp.read()

def get_version(rel_path: str) -> str:
for line in read(rel_path).splitlines():
if line.startswith("__version__"):
# __version__ = "0.9"
delim = '"' if '"' in line else "'"
return line.split(delim)[1]
raise RuntimeError("Unable to find version string.")

cstuff = Extension('mrsqm.mrsqm_wrapper',
language='c++',
Expand All @@ -13,7 +28,7 @@

setup(
name='mrsqm',
version="0.0.5",
version=get_version("src/mrsqm/__init__.py"),
author='Thach Le Nguyen',
author_email='thalng@protonmail.com',
python_requires='>=3.7',
Expand Down
2 changes: 2 additions & 0 deletions src/mrsqm/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# noinspection PyUnresolvedReferences
__version__ = "0.0.6"

from mrsqm.mrsqm_wrapper import MrSQMClassifier
from mrsqm.mrsqm_wrapper import MrSQMTransformer

0 comments on commit 09a908c

Please sign in to comment.