From 3cbb9e559f557fe240c61f117781583cf01a4a27 Mon Sep 17 00:00:00 2001 From: Justin Mahlik Date: Fri, 15 Sep 2023 11:38:53 -0500 Subject: [PATCH] Fix mlxtend importing itself during installation --- docs/sources/CHANGELOG.md | 4 +++- setup.py | 19 ++++++++++++++----- 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/docs/sources/CHANGELOG.md b/docs/sources/CHANGELOG.md index 093dad1d2..89d427870 100755 --- a/docs/sources/CHANGELOG.md +++ b/docs/sources/CHANGELOG.md @@ -21,6 +21,8 @@ The CHANGELOG for the current development version is available at - Address NumPy deprecations to make mlxtend compatible to NumPy 1.24 - Changed the signature of the `LinearRegression` model of sklearn in the test removing the `normalize` parameter as it is deprecated. ([#1036](https://github.com/rasbt/mlxtend/issues/1036)) +- Add `pyproject.toml` to support PEP 518 builds +- Fixed installation from sdist failing ##### New Features and Enhancements @@ -951,4 +953,4 @@ imput arrays via `transform` and `fit_transform` ### Version 0.1.1 (2014-08-13) -- Simplified code for ColumnSelector. \ No newline at end of file +- Simplified code for ColumnSelector. diff --git a/setup.py b/setup.py index 70fb43c6a..b8e1c4609 100644 --- a/setup.py +++ b/setup.py @@ -4,15 +4,24 @@ # # License: BSD 3 clause -from os.path import dirname, join, realpath +from os.path import abspath, dirname, join, realpath from setuptools import find_packages, setup -import mlxtend - -VERSION = mlxtend.__version__ PROJECT_ROOT = dirname(realpath(__file__)) + +def get_version(rel_path): + here = abspath(dirname(__file__)) + with open(join(here, rel_path), "r") as f: + for line in f.readlines(): + if line.startswith("__version__"): + delim = '"' if '"' in line else "'" + return line.split(delim)[1] + else: + raise RuntimeError("Unable to find version string.") + + REQUIREMENTS_FILE = join(PROJECT_ROOT, "requirements.txt") with open(REQUIREMENTS_FILE) as f: @@ -20,7 +29,7 @@ setup( name="mlxtend", - version=VERSION, + version=get_version("mlxtend/__init__.py"), description="Machine Learning Library Extensions", author="Sebastian Raschka", author_email="mail@sebastianraschka.com",