From b993a447638f215916573f55a1dd9e58568fe784 Mon Sep 17 00:00:00 2001 From: zachjweiner Date: Thu, 9 Jun 2022 20:07:22 -0500 Subject: [PATCH] add pyproject.toml --- pyproject.toml | 53 +++++++++++++++++++++++++++ setup.cfg | 14 +------ setup.py | 99 ++------------------------------------------------ 3 files changed, 59 insertions(+), 107 deletions(-) create mode 100644 pyproject.toml diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..62f304d --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,53 @@ +[build-system] +build-backend = "setuptools.build_meta" +requires = [ + "setuptools>=42", + "wheel", +] + +[tool.pytest.ini_options] +minversion = "6.0" +addopts = "-ra --durations=30 --tb=native" + +[tool.pylint.main] +recursive = true +jobs = 4 +ignore = [".git", "__pycache__", "build", "dist"] + +[tool.pylint."messages control"] +disable = "all" +enable = "E,F" + +[tool.pylint.REPORTS] +output-format = "colorized" + +[project] +name = "pystella" +version = "2021.1" +license = {file = "LICENSE"} +description = "A code generator for grid-based PDE solving on CPUs and GPUs" +readme = "README.rst" +authors = [ + {name = "Zachary J Weiner"} +] +requires-python = ">=3.8" +classifiers = [ + "Development Status :: 5 - Production/Stable", + "Intended Audience :: Developers", + "Intended Audience :: Science/Research", + "License :: OSI Approved :: MIT License", + "Programming Language :: Python :: 3", + "Topic :: Scientific/Engineering", + "Topic :: Scientific/Engineering :: Physics", + "Topic :: Software Development :: Code Generators", +] +dependencies = [ + "numpy>=1.18.5", + "pyopencl>=2020.2", + "loopy>=2022.1", +] + +[project.urls] +homepage = "https://github.com/zachjweiner/pystella" +documentation = "https://pystella.readthedocs.io/en/latest/" +source = "https://github.com/zachjweiner/pystella" diff --git a/setup.cfg b/setup.cfg index 288a2ea..17cd995 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,17 +1,7 @@ -[pylint] -disable = all -enable = E,C0330 -output-format = colorized - -[build_sphinx] -build-dir = doc/_build/ - -[tool:pytest] -filterwarnings = ignore::DeprecationWarning - [flake8] ignore = E133,E226,E241,E242,E265,W503,E402 -max-line-length=85 +max-line-length = 85 +exclude = .git,__pycache__,build,dist inline-quotes = " docstring-quotes = """ diff --git a/setup.py b/setup.py index 7051e15..e50fe6e 100644 --- a/setup.py +++ b/setup.py @@ -1,10 +1,7 @@ #!/usr/bin/env python -# -*- coding: utf-8 -*- from pathlib import Path -from setuptools import setup, find_packages, Command - -PACKAGE_NAME = "pystella" +from setuptools import setup def find_git_revision(tree_root): @@ -35,97 +32,9 @@ def write_git_revision(package_name): dn = Path(__file__).parent git_rev = find_git_revision(dn) text = 'GIT_REVISION = "%s"\n' % git_rev - dn.joinpath(package_name, "_git_rev.py").write_text(text) - - -write_git_revision(PACKAGE_NAME) - - -class PylintCommand(Command): - description = "run pylint on Python source files" - user_options = [ - # The format is (long option, short option, description). - ("pylint-rcfile=", None, "path to Pylint config file"), - ] - - def initialize_options(self): - setup_cfg = Path("setup.cfg") - if setup_cfg.exists(): - self.pylint_rcfile = setup_cfg - else: - self.pylint_rcfile = None - - def finalize_options(self): - if self.pylint_rcfile: - assert Path(self.pylint_rcfile).exists() - - def run(self): - command = ["pylint"] - if self.pylint_rcfile is not None: - command.append(f"--rcfile={self.pylint_rcfile}") - command.append(PACKAGE_NAME) - - from glob import glob - for directory in ["test", "examples", "."]: - command.extend(glob(f"{directory}/*.py")) - - from subprocess import run - run(command) - - -class Flake8Command(Command): - description = "run flake8 on Python source files" - user_options = [] - - def initialize_options(self): - pass - - def finalize_options(self): - pass - - def run(self): - command = ["flake8"] - command.append(PACKAGE_NAME) - - from glob import glob - for directory in ["test", "examples", "."]: - command.extend(glob(f"{directory}/*.py")) + (dn / package_name / "_git_rev.py").write_text(text) - from subprocess import run - run(command) +write_git_revision("pystella") -setup( - name=PACKAGE_NAME, - version="2021.1", - description="A code generator for grid-based PDE solving on CPUs and GPUs", - long_description=open("README.rst", "rt").read(), - install_requires=[ - "numpy", - "pyopencl>=2020.2", - "loopy>=2022.1", - ], - author="Zachary J Weiner", - url="https://github.com/zachjweiner/pystella", - license="MIT", - classifiers=[ - "Development Status :: 5 - Production/Stable", - "Intended Audience :: Developers", - "Intended Audience :: Science/Research", - "License :: OSI Approved :: MIT License", - "Programming Language :: Python :: 3", - "Topic :: Scientific/Engineering", - "Topic :: Scientific/Engineering :: Physics", - "Topic :: Software Development :: Code Generators", - ], - packages=find_packages(), - python_requires=">=3", - project_urls={ - "Documentation": "https://pystella.readthedocs.io/en/latest/", - "Source": "https://github.com/zachjweiner/pystella", - }, - cmdclass={ - "run_pylint": PylintCommand, - "run_flake8": Flake8Command, - }, -) +setup()