Skip to content

Commit

Permalink
use pyproject.toml instead of setup.py
Browse files Browse the repository at this point in the history
  • Loading branch information
patrickvossler18 committed Jul 14, 2024
1 parent 3b71176 commit bf4933d
Show file tree
Hide file tree
Showing 3 changed files with 89 additions and 85 deletions.
2 changes: 1 addition & 1 deletion odtlearn/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from odtlearn._version import __version__
from ._version import __version__


class ODTL:
Expand Down
90 changes: 85 additions & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,11 +1,91 @@
[build-system]
requires = [
"setuptools>=42",
"wheel"
]
requires = ["setuptools>=45", "setuptools_scm[toml]>=6.2", "wheel"]
build-backend = "setuptools.build_meta"

[project]
name = "odtlearn"
description = "A package for tree-based statistical estimation and inference using optimal decision trees."
readme = "README.md"
requires-python = ">=3.8"
license = { file = "LICENSE" }
authors = [
{ name = "Patrick Vossler" },
{ name = "Sina Aghaei" },
{ name = "Nathan Justin" },
{ name = "Nathanael Jo" },
]
maintainers = [
{ name = "Patrick Vossler", email = "patrick.vossler18@gmail.com" },
]
keywords = [
"Optimization",
"Mixed Integer Programming",
"Optimal Decision Trees",
"Integer Programming",
"Operations Research",
]
classifiers = [
"Intended Audience :: Science/Research",
"Intended Audience :: Developers",
"License :: OSI Approved",
"Programming Language :: Python",
"Topic :: Software Development",
"Topic :: Scientific/Engineering",
"Operating System :: Unix",
"Operating System :: MacOS",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
]

dependencies = [
"cffi>=1.15",
"mip>=1.15",
"scikit-learn>=1.2",
"numpy>=1.23",
"pandas>=1.5",
"seaborn>=0.13.2",
"matplotlib>=3.5.3",
]

dynamic = ["version"]

[project.optional-dependencies]
docs = [
"sphinx",
"sphinx-autoapi",
"furo",
"lxml",
"sphinx_math_dollar",
"myst-parser",
"nbconvert>=6.5.3",
"nbsphinx>=0.9.3",
"sphinx-copybutton>=0.5.2",
"sphinx-gallery>=0.14.0",
"sphinx-prompt>=1.7.0",
"numpydoc>=1.6.0",
"myst-parser>=2.0.0",
]
test = ["pytest>=7.4", "gurobipy>=10.0.0"]

[project.urls]
"Homepage" = "https://d3m-research-group.github.io/odtlearn/"
"Repository" = "https://github.com/D3M-Research-Group/odtlearn"

[tool.setuptools.packages.find]
where = ["."]
include = ["odtlearn*"]

[tool.setuptools.package-data]
odtlearn = [
"data/*.csv",
"data/*.npz",
"data/prescriptive/test_v2_200.csv",
"data/prescriptive/train_v2_100.csv",
"data/prescriptive/train_50.csv",
]

[tool.setuptools_scm]
write_to = "odtlearn/_version.py"

[tool.isort]
profile = "black"
profile = "black"
82 changes: 3 additions & 79 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,84 +1,8 @@
#! /usr/bin/env python
"""A package for decision tree methods."""

import codecs

from setuptools import find_packages, setup
from setuptools import setup

# get __version__ from _version.py
# ver_file = os.path.join("odtlearn", "_version.py")
# print(ver_file)
# with open(ver_file) as f:
# exec(f.read())

DISTNAME = "odtlearn"
DESCRIPTION = "A package for tree-based statistical estimation and inference using optimal decision trees."
with codecs.open("README.md", encoding="utf-8-sig") as f:
LONG_DESCRIPTION = f.read()
AUTHOR = "Patrick Vossler, Sina Aghaei, Nathanael Jo, Nathan Justin"
MAINTAINER = "Patrick Vossler"
MAINTAINER_EMAIL = "patrick.vossler18@gmail.com"
URL = "https://github.com/D3M-Research-Group/odtlearn"
LICENSE = "GPL-3"
DOWNLOAD_URL = "https://github.com/D3M-Research-Group/odtlearn"
VERSION = "1.0.0"
INSTALL_REQUIRES = [
"numpy",
"scipy",
"scikit-learn",
"pandas",
"mip",
]
CLASSIFIERS = [
"Intended Audience :: Science/Research",
"Intended Audience :: Developers",
"License :: OSI Approved",
"Programming Language :: Python",
"Topic :: Software Development",
"Topic :: Scientific/Engineering",
"Operating System :: Unix",
"Operating System :: MacOS",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
]
EXTRAS_REQUIRE = {
"gurobi": ["gurobipy"],
"tests": ["pytest", "pytest-cov"],
"docs": [
"sphinx",
"sphinx-gallery",
"furo",
"numpydoc",
"matplotlib",
"sphinx-autoapi",
],
}

setup(
name=DISTNAME,
maintainer=MAINTAINER,
maintainer_email=MAINTAINER_EMAIL,
description=DESCRIPTION,
license=LICENSE,
url=URL,
version=VERSION,
download_url=DOWNLOAD_URL,
long_description_content_type="text/markdown",
long_description=LONG_DESCRIPTION,
zip_safe=False, # the package can run out of an .egg file
classifiers=CLASSIFIERS,
packages=find_packages(include=["odtlearn", "odtlearn.*"]),
install_requires=INSTALL_REQUIRES,
extras_require=EXTRAS_REQUIRE,
include_package_data=True,
package_data={
"": [
"data/*.csv",
"data/*.npz",
"data/prescriptive/test_v2_200.csv",
"data/prescriptive/train_v2_100.csv",
"data/prescriptive/train_50.csv",
],
},
python_requires=">=3.8",
)
if __name__ == "__main__":
setup()

0 comments on commit bf4933d

Please sign in to comment.