From ecf4a876efbed2ad86b6a9607b67d3451a6cdcfb Mon Sep 17 00:00:00 2001 From: Justin Mahlik Date: Wed, 20 Sep 2023 17:21:00 -0500 Subject: [PATCH] Convert to pyproject.toml for project informaiton --- docs/sources/CHANGELOG.md | 1 + docs/sources/CONTRIBUTING.md | 15 ++++--- pyproject.toml | 53 +++++++++++++++++++++++++ setup.cfg | 5 --- setup.py | 77 ------------------------------------ 5 files changed, 64 insertions(+), 87 deletions(-) delete mode 100644 setup.cfg delete mode 100644 setup.py diff --git a/docs/sources/CHANGELOG.md b/docs/sources/CHANGELOG.md index 89d427870..7dbb530b4 100755 --- a/docs/sources/CHANGELOG.md +++ b/docs/sources/CHANGELOG.md @@ -23,6 +23,7 @@ The CHANGELOG for the current development version is available at - 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 +- Converted configuration to `pyproject.toml` ##### New Features and Enhancements diff --git a/docs/sources/CONTRIBUTING.md b/docs/sources/CONTRIBUTING.md index 3ae16a823..38e8164e4 100755 --- a/docs/sources/CONTRIBUTING.md +++ b/docs/sources/CONTRIBUTING.md @@ -446,18 +446,23 @@ Consider deploying the package to the PyPI test server first. The setup instruct **First**, install Twine if you don't have it already installed. E.g., use the following to install all recommended packages: ```bash -$ conda install wheel twine setuptools +$ python -m pip install twine build ``` - -**Second**, create the binaries +**Second**, create the distribution. This by default creates an sdist and wheel +in the ``./dist`` directory. ```bash -$ python setup.py sdist +$ python -m build ``` +Install the wheel and sdist to make sure they work. +The distributions file names will change with each version. + ```bash -$ python setup.py bdist_wheel --universal +python -m pip install ./dist/mlxtend-0.23.0.dev0.tar.gz --force-reinstall +python -m pip install ./dist/mlxtend-0.23.0.dev0-py3-none-any.whl --force-reinstall +python -m pip uninstall mlxtend ``` **Third**, upload the packages to the test server: diff --git a/pyproject.toml b/pyproject.toml index 6dad6ec9c..b9ce846e1 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -3,3 +3,56 @@ requires = [ "setuptools >= 59.0.0", ] build-backend = "setuptools.build_meta" + +[project] +name = "mlxtend" +authors = [ + {name = "Sebastian Raschka", email = "mail@sebastianraschka.com"} +] +description="Machine Learning Library Extensions" +dynamic = ["version", "dependencies"] +license= {text = "BSD 3-Clause"} +readme = "README.md" +classifiers=[ + "License :: OSI Approved :: BSD License", + "Development Status :: 5 - Production/Stable", + "Operating System :: Microsoft :: Windows", + "Operating System :: POSIX", + "Operating System :: Unix", + "Operating System :: MacOS", + "Programming Language :: Python :: 3.7", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Topic :: Scientific/Engineering", + "Topic :: Scientific/Engineering :: Artificial Intelligence", + "Topic :: Scientific/Engineering :: Information Analysis", + "Topic :: Scientific/Engineering :: Image Recognition", +] + +[project.optional-dependencies] +testing = ["pytest"] +docs = ["mkdocs"] + +[project.urls] +Homepage = "https://github.com/rasbt/mlxtend" +Documentation = "https://rasbt.github.io/mlxtend" +Repository = "https://github.com/rasbt/mlxtend" + +[tool.setuptools] +platforms = ["any"] + +[tool.setuptools.dynamic] +version = {attr = "mlxtend.__version__"} +dependencies = {file = "requirements.txt"} + +[tool.setuptools.package-data] +"*" = ["LICENSE-BSD3.txt", "LICENSE-CC-BY.txt", "README.md", "requirements.txt"] + +[tool.pytest.ini_options] +norecursedirs = [ + "plotting/*", + "image/*", + "build/", +] diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index ead3fa338..000000000 --- a/setup.cfg +++ /dev/null @@ -1,5 +0,0 @@ -[bdist_wheel] -universal = 1 - -[tool:pytest] -norecursedirs = plotting/* image/* \ No newline at end of file diff --git a/setup.py b/setup.py deleted file mode 100644 index b8e1c4609..000000000 --- a/setup.py +++ /dev/null @@ -1,77 +0,0 @@ -# Sebastian Raschka 2014-2016 -# mlxtend Machine Learning Library Extensions -# Author: Sebastian Raschka -# -# License: BSD 3 clause - -from os.path import abspath, dirname, join, realpath - -from setuptools import find_packages, setup - -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: - install_reqs = f.read().splitlines() - -setup( - name="mlxtend", - version=get_version("mlxtend/__init__.py"), - description="Machine Learning Library Extensions", - author="Sebastian Raschka", - author_email="mail@sebastianraschka.com", - url="https://github.com/rasbt/mlxtend", - packages=find_packages(), - package_data={ - "": ["LICENSE-BSD3.txt", "LICENSE-CC-BY.txt", "README.md", "requirements.txt"] - }, - include_package_data=True, - install_requires=install_reqs, - extras_require={"testing": ["pytest"], "docs": ["mkdocs"]}, - license="BSD 3-Clause", - platforms="any", - classifiers=[ - "License :: OSI Approved :: BSD License", - "Development Status :: 5 - Production/Stable", - "Operating System :: Microsoft :: Windows", - "Operating System :: POSIX", - "Operating System :: Unix", - "Operating System :: MacOS", - "Programming Language :: Python :: 3.7", - "Topic :: Scientific/Engineering", - "Topic :: Scientific/Engineering :: Artificial Intelligence", - "Topic :: Scientific/Engineering :: Information Analysis", - "Topic :: Scientific/Engineering :: Image Recognition", - ], - long_description=""" - -A library of Python tools and extensions for data science. - - -Contact -============= - -If you have any questions or comments about mlxtend, -please feel free to contact me via -eMail: mail@sebastianraschka.com -or Twitter: https://twitter.com/rasbt - -This project is hosted at https://github.com/rasbt/mlxtend - -The documentation can be found at https://rasbt.github.io/mlxtend/ - -""", -)