From c5a6fadbe5331c57602bdb0f961466fa15a64f0d Mon Sep 17 00:00:00 2001 From: Richard Berger Date: Mon, 11 Mar 2024 21:34:05 -0600 Subject: [PATCH] Use pyprojecy.toml and fix on newer Python --- README.md | 4 +-- pyproject.toml | 33 +++++++++++++++++++ setup.py | 30 ----------------- .../lammps_testing}/__init__.py | 0 .../lammps_testing}/commands/__init__.py | 0 .../lammps_testing}/commands/build.py | 0 .../lammps_testing}/commands/compile.py | 0 .../lammps_testing}/commands/config.py | 0 .../lammps_testing}/commands/env.py | 0 .../lammps_testing}/commands/reg.py | 0 .../lammps_testing}/commands/runtest.py | 0 .../lammps_testing}/commands/unit.py | 0 .../lammps_testing}/common.py | 0 .../lammps_testing}/formats.py | 0 .../lammps_testing}/lammps_test.py | 31 +++++++++-------- .../lammps_testing}/regression_testing.py | 2 +- .../lammps_testing}/run_regression_test.py | 4 +-- .../lammps_testing}/run_tests.py | 5 --- .../lammps_testing}/testrunner.py | 2 -- .../lammps_testing}/tests.py | 0 20 files changed, 53 insertions(+), 58 deletions(-) create mode 100644 pyproject.toml delete mode 100644 setup.py rename {lammps_testing => src/lammps_testing}/__init__.py (100%) rename {lammps_testing => src/lammps_testing}/commands/__init__.py (100%) rename {lammps_testing => src/lammps_testing}/commands/build.py (100%) rename {lammps_testing => src/lammps_testing}/commands/compile.py (100%) rename {lammps_testing => src/lammps_testing}/commands/config.py (100%) rename {lammps_testing => src/lammps_testing}/commands/env.py (100%) rename {lammps_testing => src/lammps_testing}/commands/reg.py (100%) rename {lammps_testing => src/lammps_testing}/commands/runtest.py (100%) rename {lammps_testing => src/lammps_testing}/commands/unit.py (100%) rename {lammps_testing => src/lammps_testing}/common.py (100%) rename {lammps_testing => src/lammps_testing}/formats.py (100%) rename {lammps_testing => src/lammps_testing}/lammps_test.py (78%) rename {lammps_testing => src/lammps_testing}/regression_testing.py (99%) rename {lammps_testing => src/lammps_testing}/run_regression_test.py (94%) rename {lammps_testing => src/lammps_testing}/run_tests.py (97%) rename {lammps_testing => src/lammps_testing}/testrunner.py (98%) rename {lammps_testing => src/lammps_testing}/tests.py (100%) diff --git a/README.md b/README.md index 5530d2d4..acbd2114 100644 --- a/README.md +++ b/README.md @@ -17,10 +17,10 @@ various environments using containers and perform compilation, run, regression, ```bash # regular install -python setup.py install +pip install . # for development install -python setup.py develop +pip install --editable . ``` ## Configuration diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 00000000..d3085871 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,33 @@ +[build-system] +requires = ["setuptools >= 61.0"] +build-backend = "setuptools.build_meta" + + +[project] +name = "lammps_testing" +version = "1.0.1" +description = "Utilities to run LAMMPS tests" +authors = [ + {name = "Richard Berger", email = "richard.berger@outlook.com"} +] +license = {text = "GPL"} +dependencies = [ + "nose", + "gcovr", + "termcolor", + "matplotlib", + "pyyaml", + "Jinja2", + "coverage" +] + +[project.urls] +Homepage = "https://github.com/lammps/lammps-testing" +Repository = "https://github.com/lammps/lammps-testing.git" + +[project.scripts] +lammps_run_tests = "lammps_testing.run_tests:main" +lammps_generate_regression_xml = "lammps_testing.generate_regression_xml:main" +lammps_regression_tests = "lammps_testing.regression:main" +lammps_test = "lammps_testing.lammps_test:main" +lammps_run_regression_test = "lammps_testing.run_regression_test:main" diff --git a/setup.py b/setup.py deleted file mode 100644 index ce168cd3..00000000 --- a/setup.py +++ /dev/null @@ -1,30 +0,0 @@ -from setuptools import setup -from glob import glob -import os - -setup(name='lammps_testing', - version='1.0.0', - description='Utilities to run LAMMPS tests', - url='https://github.com/lammps/lammps-testing', - author='Richard Berger', - author_email='richard.berger@outlook.com', - license='GPL', - packages=['lammps_testing'], - entry_points = { - "console_scripts": ['lammps_run_tests = lammps_testing.run_tests:main', - 'lammps_generate_regression_xml = lammps_testing.generate_regression_xml:main', - 'lammps_regression_tests = lammps_testing.regression:main', - 'lammps_test = lammps_testing.lammps_test:main', - 'lammps_run_regression_test = lammps_testing.run_regression_test:main' - ] - }, - install_requires=[ - 'nose', - 'gcovr', - 'termcolor', - 'matplotlib', - 'pyyaml', - 'Jinja2', - 'coverage' - ] -) diff --git a/lammps_testing/__init__.py b/src/lammps_testing/__init__.py similarity index 100% rename from lammps_testing/__init__.py rename to src/lammps_testing/__init__.py diff --git a/lammps_testing/commands/__init__.py b/src/lammps_testing/commands/__init__.py similarity index 100% rename from lammps_testing/commands/__init__.py rename to src/lammps_testing/commands/__init__.py diff --git a/lammps_testing/commands/build.py b/src/lammps_testing/commands/build.py similarity index 100% rename from lammps_testing/commands/build.py rename to src/lammps_testing/commands/build.py diff --git a/lammps_testing/commands/compile.py b/src/lammps_testing/commands/compile.py similarity index 100% rename from lammps_testing/commands/compile.py rename to src/lammps_testing/commands/compile.py diff --git a/lammps_testing/commands/config.py b/src/lammps_testing/commands/config.py similarity index 100% rename from lammps_testing/commands/config.py rename to src/lammps_testing/commands/config.py diff --git a/lammps_testing/commands/env.py b/src/lammps_testing/commands/env.py similarity index 100% rename from lammps_testing/commands/env.py rename to src/lammps_testing/commands/env.py diff --git a/lammps_testing/commands/reg.py b/src/lammps_testing/commands/reg.py similarity index 100% rename from lammps_testing/commands/reg.py rename to src/lammps_testing/commands/reg.py diff --git a/lammps_testing/commands/runtest.py b/src/lammps_testing/commands/runtest.py similarity index 100% rename from lammps_testing/commands/runtest.py rename to src/lammps_testing/commands/runtest.py diff --git a/lammps_testing/commands/unit.py b/src/lammps_testing/commands/unit.py similarity index 100% rename from lammps_testing/commands/unit.py rename to src/lammps_testing/commands/unit.py diff --git a/lammps_testing/common.py b/src/lammps_testing/common.py similarity index 100% rename from lammps_testing/common.py rename to src/lammps_testing/common.py diff --git a/lammps_testing/formats.py b/src/lammps_testing/formats.py similarity index 100% rename from lammps_testing/formats.py rename to src/lammps_testing/formats.py diff --git a/lammps_testing/lammps_test.py b/src/lammps_testing/lammps_test.py similarity index 78% rename from lammps_testing/lammps_test.py rename to src/lammps_testing/lammps_test.py index 80fc7545..1956b606 100644 --- a/lammps_testing/lammps_test.py +++ b/src/lammps_testing/lammps_test.py @@ -1,25 +1,24 @@ -#!/usr/bin/python import argparse import glob import os import re import sys -from .common import logger, Settings, get_containers, get_configurations, get_container -from .tests import RunTest, RegressionTest, UnitTest - -from .commands.env import init_command as init_env_command -from .commands.config import init_command as init_config_command -from .commands.build import init_command as init_build_command -from .commands.compile import init_command as init_compile_command -from .commands.runtest import init_command as init_runtest_command -from .commands.unit import init_command as init_unit_command -from .commands.reg import init_command as init_reg_command - -from .commands.build import build_status -from .commands.runtest import run_status -from .commands.unit import unittest_status -from .commands.reg import reg_status +from lammps_testing.common import logger, Settings, get_containers, get_configurations, get_container +from lammps_testing.tests import RunTest, RegressionTest, UnitTest + +from lammps_testing.commands.env import init_command as init_env_command +from lammps_testing.commands.config import init_command as init_config_command +from lammps_testing.commands.build import init_command as init_build_command +from lammps_testing.commands.compile import init_command as init_compile_command +from lammps_testing.commands.runtest import init_command as init_runtest_command +from lammps_testing.commands.unit import init_command as init_unit_command +from lammps_testing.commands.reg import init_command as init_reg_command + +from lammps_testing.commands.build import build_status +from lammps_testing.commands.runtest import run_status +from lammps_testing.commands.unit import unittest_status +from lammps_testing.commands.reg import reg_status def status(args, settings): args.config = ["ALL"] diff --git a/lammps_testing/regression_testing.py b/src/lammps_testing/regression_testing.py similarity index 99% rename from lammps_testing/regression_testing.py rename to src/lammps_testing/regression_testing.py index 6396eda2..a72adc37 100644 --- a/lammps_testing/regression_testing.py +++ b/src/lammps_testing/regression_testing.py @@ -5,7 +5,7 @@ import shutil from datetime import datetime -from .formats import LammpsLog +from lammps_testing.formats import LammpsLog def L1_norm(seq): diff --git a/lammps_testing/run_regression_test.py b/src/lammps_testing/run_regression_test.py similarity index 94% rename from lammps_testing/run_regression_test.py rename to src/lammps_testing/run_regression_test.py index 9f3de987..0bd88f22 100644 --- a/lammps_testing/run_regression_test.py +++ b/src/lammps_testing/run_regression_test.py @@ -2,8 +2,8 @@ import os import sys import argparse -from .common import Settings, LocalRunner, MPIRunner -from .regression_testing import RegressionTest +from lammps_testing.common import Settings, LocalRunner, MPIRunner +from lammps_testing.regression_testing import RegressionTest def regression(args, settings): test_directory = os.path.realpath(os.path.dirname(args.input_script)) diff --git a/lammps_testing/run_tests.py b/src/lammps_testing/run_tests.py similarity index 97% rename from lammps_testing/run_tests.py rename to src/lammps_testing/run_tests.py index 635473bb..a519e9be 100755 --- a/lammps_testing/run_tests.py +++ b/src/lammps_testing/run_tests.py @@ -1,4 +1,3 @@ -#!/bin/env python from __future__ import print_function import os import nose @@ -8,10 +7,6 @@ import glob from multiprocessing import Pool -__author__ = 'Richard Berger' -__email__ = "richard.berger@temple.edu" - - def load_tests(filename): print("Loading tests from %s..." % filename) tests = [] diff --git a/lammps_testing/testrunner.py b/src/lammps_testing/testrunner.py similarity index 98% rename from lammps_testing/testrunner.py rename to src/lammps_testing/testrunner.py index e32d4e76..3f1ae6d6 100644 --- a/lammps_testing/testrunner.py +++ b/src/lammps_testing/testrunner.py @@ -1,7 +1,5 @@ # LAMMPS regression test driver using Python's unittest from __future__ import print_function -__author__ = 'Richard Berger' -__email__ = "richard.berger@temple.edu" import unittest import os diff --git a/lammps_testing/tests.py b/src/lammps_testing/tests.py similarity index 100% rename from lammps_testing/tests.py rename to src/lammps_testing/tests.py