Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modernize Python metadata (pyproject.toml) #1013

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
146 changes: 146 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,146 @@
[build-system]
requires = [
"setuptools>=61.2",
"cython>=0.15.1; implementation_name!='pypy'"
]

[project]
name = "Mathics3"
description = "A general-purpose computer algebra system."
dependencies = [
"Mathics-Scanner >= 1.3.0",
"llvmlite",
"mpmath>=1.2.0",
"numpy<1.27",
"palettable",
# Pillow 9.1.0 supports BigTIFF with big-endian byte order.
# ExampleData image hedy.tif is in this format.
# Pillow 9.2 handles sunflowers.jpg
"pillow >= 9.2",
"pint",
"python-dateutil",
"requests",
"setuptools",
"sympy>=1.8",
]
requires-python = ">=3.7"
readme = "README.rst"
license = {text = "GPL"}
keywords = ["Mathematica", "Wolfram", "Interpreter", "Shell", "Math", "CAS"]
maintainers = [
{name = "Mathics Group", email = "[email protected]"},
]
classifiers = [
"Intended Audience :: Developers",
"Intended Audience :: Science/Research",
"License :: OSI Approved :: GNU General Public License v3 (GPLv3)",
"Programming Language :: Python",
"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",
"Programming Language :: Python :: Implementation :: CPython",
"Programming Language :: Python :: Implementation :: PyPy",
"Topic :: Scientific/Engineering",
"Topic :: Scientific/Engineering :: Mathematics",
"Topic :: Scientific/Engineering :: Physics",
"Topic :: Software Development :: Interpreters",
]
dynamic = ["version"]

[project.urls]
Homepage = "https://mathics.org/"
Downloads = "https://github.com/Mathics3/mathics-core/releases"

[project.optional-dependencies]
dev = [
"pexpect",
"pytest",
]
full = [
"ipywidgets",
"lxml",
"psutil",
"pyocr",
"scikit-image >= 0.17",
"unidecode",
"wordcloud >= 1.9.3",
]
cython = [
"cython",
]

[project.scripts]
mathics = "mathics.main:main"

[tool.setuptools]
include-package-data = false
packages = [
"mathics",
"mathics.algorithm",
"mathics.compile",
"mathics.core",
"mathics.core.convert",
"mathics.core.parser",
"mathics.builtin",
"mathics.builtin.arithfns",
"mathics.builtin.assignments",
"mathics.builtin.atomic",
"mathics.builtin.binary",
"mathics.builtin.box",
"mathics.builtin.colors",
"mathics.builtin.distance",
"mathics.builtin.exp_structure",
"mathics.builtin.drawing",
"mathics.builtin.fileformats",
"mathics.builtin.files_io",
"mathics.builtin.forms",
"mathics.builtin.functional",
"mathics.builtin.image",
"mathics.builtin.intfns",
"mathics.builtin.list",
"mathics.builtin.matrices",
"mathics.builtin.numbers",
"mathics.builtin.numpy_utils",
"mathics.builtin.pymimesniffer",
"mathics.builtin.pympler",
"mathics.builtin.quantum_mechanics",
"mathics.builtin.scipy_utils",
"mathics.builtin.specialfns",
"mathics.builtin.statistics",
"mathics.builtin.string",
"mathics.builtin.testing_expressions",
"mathics.builtin.vectors",
"mathics.eval",
"mathics.doc",
"mathics.format",
]

[tool.setuptools.package-data]
"mathics" = [
"data/*.csv",
"data/*.json",
"data/*.yml",
"data/*.yaml",
"data/*.pcl",
"data/ExampleData/*",
"doc/xml/data",
"doc/tex/data",
"autoload/*.m",
"autoload-cli/*.m",
"autoload/formats/*/Import.m",
"autoload/formats/*/Export.m",
"packages/*/*.m",
"packages/*/Kernel/init.m",
]
"mathics.doc" = [
"documentation/*.mdoc",
"xml/data",
]
"mathics.builtin.pymimesniffer" = [
"mimetypes.xml",
]

[tool.setuptools.dynamic]
version = {attr = "mathics.version.__version__"}
166 changes: 5 additions & 161 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@

"""

import logging
import os
import os.path as osp
import platform
Expand All @@ -35,58 +36,19 @@

from setuptools import Extension, setup

log = logging.getLogger(__name__)


is_PyPy = platform.python_implementation() == "PyPy" or hasattr(
sys, "pypy_version_info"
)

INSTALL_REQUIRES = [
"Mathics-Scanner >= 1.3.0",
]

# Ensure user has the correct Python version
# Address specific package dependencies based on Python version
if sys.version_info < (3, 7):
print("Mathics does not support Python %d.%d" % sys.version_info[:2])
sys.exit(-1)

INSTALL_REQUIRES += [
"numpy<1.27",
"llvmlite",
"sympy>=1.8",
# Pillow 9.1.0 supports BigTIFF with big-endian byte order.
# ExampleData image hedy.tif is in this format.
# Pillow 9.2 handles sunflowers.jpg
"pillow >= 9.2",
]

# if not is_PyPy:
# INSTALL_REQUIRES += ["recordclass"]


def get_srcdir():
filename = osp.normcase(osp.dirname(osp.abspath(__file__)))
return osp.realpath(filename)


def read(*rnames):
return open(osp.join(get_srcdir(), *rnames)).read()


long_description = read("README.rst") + "\n"

# stores __version__ in the current namespace
exec(compile(open("mathics/version.py").read(), "mathics/version.py", "exec"))

EXTRAS_REQUIRE = {}
for kind in ("dev", "full", "cython"):
extras_require = []
requirements_file = f"requirements-{kind}.txt"
for line in open(requirements_file).read().split("\n"):
if line and not line.startswith("#"):
requires = re.sub(r"([^#]+)(\s*#.*$)?", r"\1", line)
extras_require.append(requires)
EXTRAS_REQUIRE[kind] = extras_require

DEPENDENCY_LINKS = []
# "http://github.com/Mathics3/mathics-scanner/tarball/master#egg=Mathics_Scanner-1.0.0.dev"
# ]
Expand All @@ -103,7 +65,7 @@ def read(*rnames):
pass
else:
if os.environ.get("USE_CYTHON", False):
print("Running Cython over code base")
log.info("Running Cython over code base")
EXTENSIONS_DICT = {
"core": (
"expression",
Expand Down Expand Up @@ -134,130 +96,12 @@ def read(*rnames):
# for module in modules
# )
CMDCLASS = {"build_ext": build_ext}
INSTALL_REQUIRES += ["cython>=0.15.1"]

# General Requirements
INSTALL_REQUIRES += [
"mpmath>=1.2.0",
"palettable",
"pint",
"python-dateutil",
"requests",
"setuptools",
]

print(f'Installation requires "{", ".join(INSTALL_REQUIRES)}')


def subdirs(root, file="*.*", depth=10):
for k in range(depth):
yield root + "*/" * k + file


setup(
name="Mathics3",
cmdclass=CMDCLASS,
ext_modules=EXTENSIONS,
version=__version__,
packages=[
"mathics",
"mathics.algorithm",
"mathics.compile",
"mathics.core",
"mathics.core.convert",
"mathics.core.parser",
"mathics.builtin",
"mathics.builtin.arithfns",
"mathics.builtin.assignments",
"mathics.builtin.atomic",
"mathics.builtin.binary",
"mathics.builtin.box",
"mathics.builtin.colors",
"mathics.builtin.distance",
"mathics.builtin.exp_structure",
"mathics.builtin.drawing",
"mathics.builtin.fileformats",
"mathics.builtin.files_io",
"mathics.builtin.forms",
"mathics.builtin.functional",
"mathics.builtin.image",
"mathics.builtin.intfns",
"mathics.builtin.list",
"mathics.builtin.matrices",
"mathics.builtin.numbers",
"mathics.builtin.numpy_utils",
"mathics.builtin.pymimesniffer",
"mathics.builtin.pympler",
"mathics.builtin.quantum_mechanics",
"mathics.builtin.scipy_utils",
"mathics.builtin.specialfns",
"mathics.builtin.statistics",
"mathics.builtin.string",
"mathics.builtin.testing_expressions",
"mathics.builtin.vectors",
"mathics.eval",
"mathics.doc",
"mathics.format",
],
install_requires=INSTALL_REQUIRES,
extras_require=EXTRAS_REQUIRE,
dependency_links=DEPENDENCY_LINKS,
package_data={
"mathics": [
"data/*.csv",
"data/*.json",
"data/*.yml",
"data/*.yaml",
"data/*.pcl",
"data/ExampleData/*",
"doc/xml/data",
"doc/tex/data",
"autoload/*.m",
"autoload-cli/*.m",
"autoload/formats/*/Import.m",
"autoload/formats/*/Export.m",
"packages/*/*.m",
"packages/*/Kernel/init.m",
"requirements-cython.txt",
"requirements-full.txt",
],
"mathics.doc": ["documentation/*.mdoc", "xml/data"],
"mathics.builtin.pymimesniffer": ["mimetypes.xml"],
"pymathics": ["doc/documentation/*.mdoc", "doc/xml/data"],
},
entry_points={
"console_scripts": [
"mathics = mathics.main:main",
],
},
long_description=long_description,
long_description_content_type="text/x-rst",
# don't pack Mathics in egg because of media files, etc.
zip_safe=False,
# metadata for upload to PyPI
maintainer="Mathics Group",
maintainer_email="[email protected]",
description="A general-purpose computer algebra system.",
license="GPL",
url="https://mathics.org/",
download_url="https://github.com/Mathics3/mathics-core/releases",
keywords=["Mathematica", "Wolfram", "Interpreter", "Shell", "Math", "CAS"],
classifiers=[
"Intended Audience :: Developers",
"Intended Audience :: Science/Research",
"License :: OSI Approved :: GNU General Public License v3 (GPLv3)",
"Programming Language :: Python",
"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",
"Programming Language :: Python :: Implementation :: CPython",
"Programming Language :: Python :: Implementation :: PyPy",
"Topic :: Scientific/Engineering",
"Topic :: Scientific/Engineering :: Mathematics",
"Topic :: Scientific/Engineering :: Physics",
"Topic :: Software Development :: Interpreters",
],
# TODO: could also include long_description, download_url,
)