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

Use pyproject.toml #78

Merged
merged 3 commits into from
Aug 5, 2024
Merged
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
2 changes: 1 addition & 1 deletion .github/workflows/ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
runs-on: ubuntu-22.04
strategy:
matrix:
python-version: ['3.7', '3.8', '3.9', '3.10']
python-version: ['3.8', '3.9', '3.10', '3.11']
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
Expand Down
9 changes: 6 additions & 3 deletions mathicsscript/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,17 @@
"""
mathicsscript is a command-line interface to Mathics.

Copyright 2020-2021 The Mathics Team
Copyright 2020-2021, 2024 The Mathics3 Team
"""

import os.path as osp

from mathics.core.definitions import autoload_files

from mathicsscript.version import __version__


def load_default_settings_files(definitions):
import os.path as osp
from mathics.core.definitions import autoload_files

root_dir = osp.realpath(osp.dirname(__file__))

Expand Down
4 changes: 2 additions & 2 deletions mathicsscript/completion.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-

# Copyright (C) 2021-2022 Rocky Bernstein <[email protected]>
# Copyright (C) 2021-2022, 2024 Rocky Bernstein <[email protected]>
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
Expand Down Expand Up @@ -126,7 +126,7 @@ def get_word_before_cursor_with_kind(
self, document: Document
) -> Tuple[str, TokenKind]:
"""
Get the word before the cursor and clasify it into one of the kinds
Get the word before the cursor and classify it into one of the kinds
of tokens: NamedCharacter, AsciiOperator, Symbol, etc.


Expand Down
79 changes: 79 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
[build-system]
requires = [
"setuptools>=70.0.0", # CVE-2024-38335 recommends this
# needed for building tables for the sdist:
"PyYAML",
"click",
]
build-backend = "setuptools.build_meta"

[project]
name = "mathicsscript"
description = "Command-line interface to Mathics3"
dependencies = [
"Mathics_Scanner>=1.3.0",
"Mathics3 >= 7.0.0dev0",
"click",
"colorama",
"columnize",
"networkx",
"prompt_toolkit>=3.0.18",
"Pygments>=2.9.0", # Want something late enough that has the "inkpot" style
"mathics_pygments>=1.0.2",
"term-background >= 1.0.1",
]
requires-python = ">=3.8"
readme = "README.rst"
license = {text = "GPL-3.0-only"}
keywords = ["Mathematica", "Wolfram", "Interpreter", "Shell", "Math", "CAS"]
maintainers = [
{name = "Mathics3 Group"},
]
classifiers = [
"Intended Audience :: Developers",
"Intended Audience :: Science/Research",
"License :: OSI Approved :: GNU General Public License v3 (GPLv3)",
"Programming Language :: Python",
"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.optional-dependencies]
dev = [
"pytest",
]
full = [
"PyYAML", # Used for admin-tools/make-tables.sh to build JSON tables
"PyQT5", # For interactive display of graphs via matplotlib
"cairosvg", # For rendering Plots and Graphs as SVGs via matplotlib
"cson", # for xasy
"matplotlib" # For rendering SVG plots
]

[project.scripts]
mathicsscript = "mathicsscript.__main__:main"
# fake_psviewer.py = "mathicsscript.fake_psviewer:main"

[project.urls]
Homepage = "https://mathics.org/"

[tool.setuptools.package-data]
"mathics_scanner" = [
"mathicsscript/data/inputrc-no-unicode",
"mathicsscript/data/inputrc-unicode",
"mathicsscript/user-settings.m",
"mathicsscript/autoload/settings.m",
"mathicsscript/config.asy",
]

[tool.setuptools.dynamic]
version = {attr = "mathicsscript.version.__version__"}
60 changes: 0 additions & 60 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,56 +13,11 @@
python setup.py --help install
"""

import sys
import platform

import os.path as osp
import re
from setuptools import setup, find_packages


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


srcdir = get_srcdir()

# Ensure user has the correct Python version
if sys.version_info < (3, 6):
print("mathicsscript does not support Python %d.%d" % sys.version_info[:2])
sys.exit(-1)


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


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

long_description = read("README.rst") + "\n"
exec(read("mathicsscript/version.py"))

is_PyPy = platform.python_implementation() == "PyPy"

EXTRAS_REQUIRE = {}
for kind in ("dev", "full"):
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

setup(
maintainer="Mathics Group",
maintainer_email="[email protected]",
author_email="[email protected]",
data_files=["requirements-dev.txt", "requirements-full.txt"],
name="mathicsscript",
version=__version__, # noqa
packages=find_packages(),
include_package_data=True,
package_data={
Expand All @@ -74,27 +29,12 @@ def read(*rnames):
"mathicsscript/config.asy",
]
},
install_requires=[
"Mathics_Scanner>=1.3.0",
"Mathics3 >= 6.2.0,<7.1.0",
"click",
"colorama",
"columnize",
"networkx",
"prompt_toolkit>=3.0.18",
"Pygments>=2.9.0", # Want something late enough that has the "inkpot" style
# "mathics_pygments @ https://github.com/Mathics3/mathics-pygments/archive/master.zip#egg=mathics_pygments",
"mathics_pygments>=1.0.2",
"term-background >= 1.0.1",
],
entry_points={
"console_scripts": [
"mathicsscript = mathicsscript.__main__:main",
"fake_psviewer.py = mathicsscript.fake_psviewer:main",
]
},
extras_require=EXTRAS_REQUIRE,
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,
Expand Down
Loading