diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..4973c84 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,3 @@ +[build-system] +requires = ["setuptools", "wheel", "numpy"] +build-backend = "setuptools.build_meta" diff --git a/setup.py b/setup.py index e709474..75a549a 100644 --- a/setup.py +++ b/setup.py @@ -1,16 +1,28 @@ import setuptools -from multilabel_oversampling import __version__ -print(__version__) +import re +import os -with open("README.md", "r") as file: +# Read version from __init__.py without importing the package (avoids build-time dependency issues) +_init_path = os.path.join(os.path.dirname(__file__), "multilabel_oversampling", "__init__.py") +with open(_init_path, "r", encoding="utf-8") as f: + _content = f.read() +# Accept either single or double quotes for the version string +_version_match = re.search(r"__version__\s*=\s*['\"]([^'\"]+)['\"]", _content) +if _version_match is None: + raise RuntimeError("Unable to find version string in __init__.py") +__version__ = _version_match.group(1) + +with open("README.md", "r", encoding="utf-8") as file: long_description = file.read() -with open("requirements.txt") as file: - required = file.read().splitlines() - +# Read runtime requirements from requirements.txt and ignore blank/comment lines +with open("requirements.txt", "r", encoding="utf-8") as file: + required = [l.strip() for l in file if l.strip() and not l.strip().startswith("#")] + + setuptools.setup( name="multilabel-oversampling", - version=__version__, + version=__version__, author="Philipp J. Rösch", author_email="phiyodr@gmail.com", description="Multilabel Oversampling", @@ -18,20 +30,14 @@ long_description_content_type="text/markdown", url="https://github.com/phiyodr/multilabel-oversampling", classifiers=[ - "Topic :: Scientific/Engineering :: Artificial Intelligence", + "Topic :: Scientific/Engineering :: Artificial Intelligence", "Programming Language :: Python :: 3", ], packages=setuptools.find_packages(), python_requires='>=3.6', package_data={ # If any package contains *.txt or *.rst files, include them: - "": ["*.txt", "*.csv", "*.json"]}, - install_requires=[ - "numpy", - "scikit-learn", - "pandas", - "seaborn", - "tqdm", - "matplotlib" - ] - ) + "": ["*.txt", "*.csv", "*.json"], + }, + install_requires=required, +)