From 50ad60b93b8d87e7daf0ad67c235aaacd04614d0 Mon Sep 17 00:00:00 2001 From: Sangjoon Bob Lee Date: Thu, 26 Sep 2024 00:54:11 -0400 Subject: [PATCH 1/6] Add minimal pyproject --- pyproject.toml | 50 +++++++++++++++++++++++++++++++++++++------ setup.py => setup.txt | 0 2 files changed, 44 insertions(+), 6 deletions(-) rename setup.py => setup.txt (100%) diff --git a/pyproject.toml b/pyproject.toml index 339a112..22663b7 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,20 +1,58 @@ +[build-system] +requires = ["setuptools>=62.0", "setuptools-git-versioning>=2.0"] +build-backend = "setuptools.build_meta" + +[project] +name = "diffpy.srfit" +dynamic=['version', 'dependencies'] +classifiers = [ + 'Development Status :: 5 - Production/Stable', + 'Environment :: Console', + 'Intended Audience :: Developers', + 'Intended Audience :: Science/Research', + 'Operating System :: MacOS :: MacOS X', + 'Operating System :: Microsoft :: Windows', + 'Operating System :: POSIX', + 'Operating System :: Unix', + 'Topic :: Scientific/Engineering :: Physics', + 'Topic :: Scientific/Engineering :: Chemistry', +] + + +[tool.setuptools-git-versioning] +enabled = true +template = "{tag}" +dev_template = "{tag}" +dirty_template = "{tag}" + +[tool.setuptools.packages.find] +where = ["src"] # list of folders that contain the packages (["."] by default) +include = ["*"] # package names should match these glob patterns (["*"] by default) +exclude = [] # exclude packages matching these glob patterns (empty by default) +namespaces = false # to disable scanning PEP 420 namespaces (true by default) + +[tool.setuptools.dynamic] +dependencies = {file = ["requirements/run.txt"]} + [tool.black] line-length = 115 include = '\.pyi?$' exclude = ''' /( - \.git\ + \.git + | \.hg | \.mypy_cache | \.tox | \.venv - | _build/ + | \.rst + | \.txt + | _build | buck-out | build | dist + + # The following are specific to Black, you probably don't want those. | blib2to3 - | tests/data/ - | hooks/post_gen_project.py$ - | .*\.py$ - | .*\.toml$ + | tests/data )/ ''' diff --git a/setup.py b/setup.txt similarity index 100% rename from setup.py rename to setup.txt From 876f895a578fe235ccd5d3974442021f9b12a8fa Mon Sep 17 00:00:00 2001 From: Sangjoon Bob Lee Date: Thu, 26 Sep 2024 00:57:39 -0400 Subject: [PATCH 2/6] Move tests and rename test files --- src/diffpy/srfit/.DS_Store | Bin 0 -> 6148 bytes src/diffpy/srfit/tests/__init__.py | 87 ------------------ src/diffpy/srfit/tests/debug.py | 35 ------- src/diffpy/srfit/tests/run.py | 38 -------- .../testbuilder.py => tests/test_builder.py | 2 +- .../test_characteristicfunctions.py | 2 +- .../test_constraint.py | 0 .../test_contribution.py | 2 +- .../test_diffpyparset.py | 2 +- .../testequation.py => tests/test_equation.py | 2 +- .../test_fitrecipe.py | 2 +- .../test_fitresults.py | 2 +- .../testliterals.py => tests/test_literals.py | 0 .../test_objcrystparset.py | 2 +- .../test_parameter.py | 0 .../test_parameterset.py | 0 .../tests/testpdf.py => tests/test_pdf.py | 2 +- .../testprofile.py => tests/test_profile.py | 2 +- .../test_profilegenerator.py | 0 .../test_recipeorganizer.py | 2 +- .../test_restraint.py | 0 .../tests/testsas.py => tests/test_sas.py | 2 +- .../test_sgconstraints.py | 2 +- .../tests/speedtest.py => tests/test_speed.py | 2 +- .../test_tagmanager.py | 0 .../testvisitors.py => tests/test_visitors.py | 2 +- .../test_weakrefcallable.py | 0 .../tests => tests}/testdata/LaMnO3.stru | 0 .../testdata/ni-q27r100-neutron.gr | 0 .../srfit/tests => tests}/testdata/ni.cif | 0 .../tests => tests}/testdata/results.res | 0 .../testdata/sas_ascii_test_1.txt | 0 .../testdata/sas_ellipsoid_testdata.txt | 0 .../testdata/si-q27r60-xray.gr | 0 .../tests => tests}/testdata/testdata.txt | 0 {src/diffpy/srfit/tests => tests}/utils.py | 2 +- 36 files changed, 16 insertions(+), 176 deletions(-) create mode 100644 src/diffpy/srfit/.DS_Store delete mode 100644 src/diffpy/srfit/tests/__init__.py delete mode 100644 src/diffpy/srfit/tests/debug.py delete mode 100644 src/diffpy/srfit/tests/run.py rename src/diffpy/srfit/tests/testbuilder.py => tests/test_builder.py (99%) rename src/diffpy/srfit/tests/testcharacteristicfunctions.py => tests/test_characteristicfunctions.py (98%) rename src/diffpy/srfit/tests/testconstraint.py => tests/test_constraint.py (100%) rename src/diffpy/srfit/tests/testcontribution.py => tests/test_contribution.py (99%) rename src/diffpy/srfit/tests/testdiffpyparset.py => tests/test_diffpyparset.py (98%) rename src/diffpy/srfit/tests/testequation.py => tests/test_equation.py (98%) rename src/diffpy/srfit/tests/testfitrecipe.py => tests/test_fitrecipe.py (99%) rename src/diffpy/srfit/tests/testfitresults.py => tests/test_fitresults.py (98%) rename src/diffpy/srfit/tests/testliterals.py => tests/test_literals.py (100%) rename src/diffpy/srfit/tests/testobjcrystparset.py => tests/test_objcrystparset.py (99%) rename src/diffpy/srfit/tests/testparameter.py => tests/test_parameter.py (100%) rename src/diffpy/srfit/tests/testparameterset.py => tests/test_parameterset.py (100%) rename src/diffpy/srfit/tests/testpdf.py => tests/test_pdf.py (99%) rename src/diffpy/srfit/tests/testprofile.py => tests/test_profile.py (99%) rename src/diffpy/srfit/tests/testprofilegenerator.py => tests/test_profilegenerator.py (100%) rename src/diffpy/srfit/tests/testrecipeorganizer.py => tests/test_recipeorganizer.py (99%) rename src/diffpy/srfit/tests/testrestraint.py => tests/test_restraint.py (100%) rename src/diffpy/srfit/tests/testsas.py => tests/test_sas.py (98%) rename src/diffpy/srfit/tests/testsgconstraints.py => tests/test_sgconstraints.py (99%) rename src/diffpy/srfit/tests/speedtest.py => tests/test_speed.py (99%) rename src/diffpy/srfit/tests/testtagmanager.py => tests/test_tagmanager.py (100%) rename src/diffpy/srfit/tests/testvisitors.py => tests/test_visitors.py (99%) rename src/diffpy/srfit/tests/testweakrefcallable.py => tests/test_weakrefcallable.py (100%) rename {src/diffpy/srfit/tests => tests}/testdata/LaMnO3.stru (100%) rename {src/diffpy/srfit/tests => tests}/testdata/ni-q27r100-neutron.gr (100%) rename {src/diffpy/srfit/tests => tests}/testdata/ni.cif (100%) rename {src/diffpy/srfit/tests => tests}/testdata/results.res (100%) rename {src/diffpy/srfit/tests => tests}/testdata/sas_ascii_test_1.txt (100%) rename {src/diffpy/srfit/tests => tests}/testdata/sas_ellipsoid_testdata.txt (100%) rename {src/diffpy/srfit/tests => tests}/testdata/si-q27r60-xray.gr (100%) rename {src/diffpy/srfit/tests => tests}/testdata/testdata.txt (100%) rename {src/diffpy/srfit/tests => tests}/utils.py (98%) diff --git a/src/diffpy/srfit/.DS_Store b/src/diffpy/srfit/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..5008ddfcf53c02e82d7eee2e57c38e5672ef89f6 GIT binary patch literal 6148 zcmeH~Jr2S!425mzP>H1@V-^m;4Wg<&0T*E43hX&L&p$$qDprKhvt+--jT7}7np#A3 zem<@ulZcFPQ@L2!n>{z**++&mCkOWA81W14cNZlEfg7;MkzE(HCqgga^y>{tEnwC%0;vJ&^%eQ zLs35+`xjp>T0 1 else "" - suite = testsuite(pattern) - suite.debug() - - -# End of file diff --git a/src/diffpy/srfit/tests/run.py b/src/diffpy/srfit/tests/run.py deleted file mode 100644 index a47c886..0000000 --- a/src/diffpy/srfit/tests/run.py +++ /dev/null @@ -1,38 +0,0 @@ -#!/usr/bin/env python -############################################################################## -# -# diffpy.srfit by DANSE Diffraction group -# Simon J. L. Billinge -# (c) 2010 The Trustees of Columbia University -# in the City of New York. All rights reserved. -# -# File coded by: Pavol Juhas -# -# See AUTHORS.txt for a list of people who contributed. -# See LICENSE_DANSE.txt for license information. -# -############################################################################## - -"""Convenience module for executing all unit tests with - -python -m diffpy.srfit.tests.run -""" - - -if __name__ == "__main__": - import sys - - # show warnings by default - if not sys.warnoptions: - import os - import warnings - - warnings.simplefilter("default") - # also affect subprocesses - os.environ["PYTHONWARNINGS"] = "default" - from diffpy.srfit.tests import test - - # produce zero exit code for a successful test - sys.exit(not test().wasSuccessful()) - -# End of file diff --git a/src/diffpy/srfit/tests/testbuilder.py b/tests/test_builder.py similarity index 99% rename from src/diffpy/srfit/tests/testbuilder.py rename to tests/test_builder.py index b7bf6f1..2f27b9b 100644 --- a/src/diffpy/srfit/tests/testbuilder.py +++ b/tests/test_builder.py @@ -21,7 +21,7 @@ import diffpy.srfit.equation.builder as builder import diffpy.srfit.equation.literals as literals -from diffpy.srfit.tests.utils import _makeArgs, noObserversInGlobalBuilders +from utils import _makeArgs, noObserversInGlobalBuilders class TestBuilder(unittest.TestCase): diff --git a/src/diffpy/srfit/tests/testcharacteristicfunctions.py b/tests/test_characteristicfunctions.py similarity index 98% rename from src/diffpy/srfit/tests/testcharacteristicfunctions.py rename to tests/test_characteristicfunctions.py index 7a68487..cb6bf0d 100644 --- a/src/diffpy/srfit/tests/testcharacteristicfunctions.py +++ b/tests/test_characteristicfunctions.py @@ -20,7 +20,7 @@ import numpy from diffpy.srfit.sas.sasimport import sasimport -from diffpy.srfit.tests.utils import _msg_nosas, has_sas +from utils import _msg_nosas, has_sas # Global variables to be assigned in setUp cf = None diff --git a/src/diffpy/srfit/tests/testconstraint.py b/tests/test_constraint.py similarity index 100% rename from src/diffpy/srfit/tests/testconstraint.py rename to tests/test_constraint.py diff --git a/src/diffpy/srfit/tests/testcontribution.py b/tests/test_contribution.py similarity index 99% rename from src/diffpy/srfit/tests/testcontribution.py rename to tests/test_contribution.py index e707b89..36bb7af 100644 --- a/src/diffpy/srfit/tests/testcontribution.py +++ b/tests/test_contribution.py @@ -24,7 +24,7 @@ from diffpy.srfit.fitbase.parameter import Parameter from diffpy.srfit.fitbase.profile import Profile from diffpy.srfit.fitbase.profilegenerator import ProfileGenerator -from diffpy.srfit.tests.utils import noObserversInGlobalBuilders +from utils import noObserversInGlobalBuilders class TestContribution(unittest.TestCase): diff --git a/src/diffpy/srfit/tests/testdiffpyparset.py b/tests/test_diffpyparset.py similarity index 98% rename from src/diffpy/srfit/tests/testdiffpyparset.py rename to tests/test_diffpyparset.py index ca5ce79..11aa423 100644 --- a/src/diffpy/srfit/tests/testdiffpyparset.py +++ b/tests/test_diffpyparset.py @@ -20,7 +20,7 @@ import numpy -from diffpy.srfit.tests.utils import _msg_nostructure, has_structure +from utils import _msg_nostructure, has_structure # Global variables to be assigned in setUp Atom = Lattice = Structure = DiffpyStructureParSet = None diff --git a/src/diffpy/srfit/tests/testequation.py b/tests/test_equation.py similarity index 98% rename from src/diffpy/srfit/tests/testequation.py rename to tests/test_equation.py index 427d90c..a48489b 100644 --- a/src/diffpy/srfit/tests/testequation.py +++ b/tests/test_equation.py @@ -19,7 +19,7 @@ import diffpy.srfit.equation.literals as literals from diffpy.srfit.equation import Equation -from diffpy.srfit.tests.utils import _makeArgs, noObserversInGlobalBuilders +from utils import _makeArgs, noObserversInGlobalBuilders class TestEquation(unittest.TestCase): diff --git a/src/diffpy/srfit/tests/testfitrecipe.py b/tests/test_fitrecipe.py similarity index 99% rename from src/diffpy/srfit/tests/testfitrecipe.py rename to tests/test_fitrecipe.py index b352207..305bf49 100644 --- a/src/diffpy/srfit/tests/testfitrecipe.py +++ b/tests/test_fitrecipe.py @@ -23,7 +23,7 @@ from diffpy.srfit.fitbase.fitrecipe import FitRecipe from diffpy.srfit.fitbase.parameter import Parameter from diffpy.srfit.fitbase.profile import Profile -from diffpy.srfit.tests.utils import capturestdout +from utils import capturestdout class TestFitRecipe(unittest.TestCase): diff --git a/src/diffpy/srfit/tests/testfitresults.py b/tests/test_fitresults.py similarity index 98% rename from src/diffpy/srfit/tests/testfitresults.py rename to tests/test_fitresults.py index 367b948..65d926a 100644 --- a/src/diffpy/srfit/tests/testfitresults.py +++ b/tests/test_fitresults.py @@ -19,7 +19,7 @@ from diffpy.srfit.fitbase.fitrecipe import FitRecipe from diffpy.srfit.fitbase.fitresults import initializeRecipe -from diffpy.srfit.tests.utils import datafile +from utils import datafile class TestInitializeRecipe(unittest.TestCase): diff --git a/src/diffpy/srfit/tests/testliterals.py b/tests/test_literals.py similarity index 100% rename from src/diffpy/srfit/tests/testliterals.py rename to tests/test_literals.py diff --git a/src/diffpy/srfit/tests/testobjcrystparset.py b/tests/test_objcrystparset.py similarity index 99% rename from src/diffpy/srfit/tests/testobjcrystparset.py rename to tests/test_objcrystparset.py index bf5b002..906231c 100644 --- a/src/diffpy/srfit/tests/testobjcrystparset.py +++ b/tests/test_objcrystparset.py @@ -19,7 +19,7 @@ import numpy -from diffpy.srfit.tests.utils import _msg_nopyobjcryst, has_pyobjcryst +from utils import _msg_nopyobjcryst, has_pyobjcryst # Global variables to be assigned in setUp ObjCrystCrystalParSet = spacegroups = None diff --git a/src/diffpy/srfit/tests/testparameter.py b/tests/test_parameter.py similarity index 100% rename from src/diffpy/srfit/tests/testparameter.py rename to tests/test_parameter.py diff --git a/src/diffpy/srfit/tests/testparameterset.py b/tests/test_parameterset.py similarity index 100% rename from src/diffpy/srfit/tests/testparameterset.py rename to tests/test_parameterset.py diff --git a/src/diffpy/srfit/tests/testpdf.py b/tests/test_pdf.py similarity index 99% rename from src/diffpy/srfit/tests/testpdf.py rename to tests/test_pdf.py index fc1c53a..40ec2e4 100644 --- a/src/diffpy/srfit/tests/testpdf.py +++ b/tests/test_pdf.py @@ -23,7 +23,7 @@ from diffpy.srfit.exceptions import SrFitError from diffpy.srfit.pdf import PDFContribution, PDFGenerator, PDFParser -from diffpy.srfit.tests.utils import ( +from utils import ( _msg_nosrreal, _msg_nostructure, datafile, diff --git a/src/diffpy/srfit/tests/testprofile.py b/tests/test_profile.py similarity index 99% rename from src/diffpy/srfit/tests/testprofile.py rename to tests/test_profile.py index 67917e8..de447b8 100644 --- a/src/diffpy/srfit/tests/testprofile.py +++ b/tests/test_profile.py @@ -23,7 +23,7 @@ from diffpy.srfit.exceptions import SrFitError from diffpy.srfit.fitbase.profile import Profile -from diffpy.srfit.tests.utils import datafile +from utils import datafile class TestProfile(unittest.TestCase): diff --git a/src/diffpy/srfit/tests/testprofilegenerator.py b/tests/test_profilegenerator.py similarity index 100% rename from src/diffpy/srfit/tests/testprofilegenerator.py rename to tests/test_profilegenerator.py diff --git a/src/diffpy/srfit/tests/testrecipeorganizer.py b/tests/test_recipeorganizer.py similarity index 99% rename from src/diffpy/srfit/tests/testrecipeorganizer.py rename to tests/test_recipeorganizer.py index 0616f79..30030bc 100644 --- a/src/diffpy/srfit/tests/testrecipeorganizer.py +++ b/tests/test_recipeorganizer.py @@ -27,7 +27,7 @@ RecipeOrganizer, equationFromString, ) -from diffpy.srfit.tests.utils import capturestdout +from utils import capturestdout # ---------------------------------------------------------------------------- diff --git a/src/diffpy/srfit/tests/testrestraint.py b/tests/test_restraint.py similarity index 100% rename from src/diffpy/srfit/tests/testrestraint.py rename to tests/test_restraint.py diff --git a/src/diffpy/srfit/tests/testsas.py b/tests/test_sas.py similarity index 98% rename from src/diffpy/srfit/tests/testsas.py rename to tests/test_sas.py index 63f0898..6b44503 100644 --- a/src/diffpy/srfit/tests/testsas.py +++ b/tests/test_sas.py @@ -21,7 +21,7 @@ from diffpy.srfit.sas import SASGenerator, SASParser, SASProfile from diffpy.srfit.sas.sasimport import sasimport -from diffpy.srfit.tests.utils import _msg_nosas, datafile, has_sas +from utils import _msg_nosas, datafile, has_sas # ---------------------------------------------------------------------------- diff --git a/src/diffpy/srfit/tests/testsgconstraints.py b/tests/test_sgconstraints.py similarity index 99% rename from src/diffpy/srfit/tests/testsgconstraints.py rename to tests/test_sgconstraints.py index 60daa7d..2b0b6b4 100644 --- a/src/diffpy/srfit/tests/testsgconstraints.py +++ b/tests/test_sgconstraints.py @@ -19,7 +19,7 @@ import numpy -from diffpy.srfit.tests.utils import ( +from utils import ( _msg_nopyobjcryst, _msg_nostructure, datafile, diff --git a/src/diffpy/srfit/tests/speedtest.py b/tests/test_speed.py similarity index 99% rename from src/diffpy/srfit/tests/speedtest.py rename to tests/test_speed.py index 407e06c..ad4c951 100644 --- a/src/diffpy/srfit/tests/speedtest.py +++ b/tests/test_speed.py @@ -23,7 +23,7 @@ import diffpy.srfit.equation.literals as literals import diffpy.srfit.equation.visitors as visitors -from diffpy.srfit.tests.utils import _makeArgs +from utils import _makeArgs x = numpy.arange(0, 20, 0.05) diff --git a/src/diffpy/srfit/tests/testtagmanager.py b/tests/test_tagmanager.py similarity index 100% rename from src/diffpy/srfit/tests/testtagmanager.py rename to tests/test_tagmanager.py diff --git a/src/diffpy/srfit/tests/testvisitors.py b/tests/test_visitors.py similarity index 99% rename from src/diffpy/srfit/tests/testvisitors.py rename to tests/test_visitors.py index 8b3da98..7c826a1 100644 --- a/src/diffpy/srfit/tests/testvisitors.py +++ b/tests/test_visitors.py @@ -19,7 +19,7 @@ import diffpy.srfit.equation.literals as literals import diffpy.srfit.equation.visitors as visitors -from diffpy.srfit.tests.utils import _makeArgs +from utils import _makeArgs class TestValidator(unittest.TestCase): diff --git a/src/diffpy/srfit/tests/testweakrefcallable.py b/tests/test_weakrefcallable.py similarity index 100% rename from src/diffpy/srfit/tests/testweakrefcallable.py rename to tests/test_weakrefcallable.py diff --git a/src/diffpy/srfit/tests/testdata/LaMnO3.stru b/tests/testdata/LaMnO3.stru similarity index 100% rename from src/diffpy/srfit/tests/testdata/LaMnO3.stru rename to tests/testdata/LaMnO3.stru diff --git a/src/diffpy/srfit/tests/testdata/ni-q27r100-neutron.gr b/tests/testdata/ni-q27r100-neutron.gr similarity index 100% rename from src/diffpy/srfit/tests/testdata/ni-q27r100-neutron.gr rename to tests/testdata/ni-q27r100-neutron.gr diff --git a/src/diffpy/srfit/tests/testdata/ni.cif b/tests/testdata/ni.cif similarity index 100% rename from src/diffpy/srfit/tests/testdata/ni.cif rename to tests/testdata/ni.cif diff --git a/src/diffpy/srfit/tests/testdata/results.res b/tests/testdata/results.res similarity index 100% rename from src/diffpy/srfit/tests/testdata/results.res rename to tests/testdata/results.res diff --git a/src/diffpy/srfit/tests/testdata/sas_ascii_test_1.txt b/tests/testdata/sas_ascii_test_1.txt similarity index 100% rename from src/diffpy/srfit/tests/testdata/sas_ascii_test_1.txt rename to tests/testdata/sas_ascii_test_1.txt diff --git a/src/diffpy/srfit/tests/testdata/sas_ellipsoid_testdata.txt b/tests/testdata/sas_ellipsoid_testdata.txt similarity index 100% rename from src/diffpy/srfit/tests/testdata/sas_ellipsoid_testdata.txt rename to tests/testdata/sas_ellipsoid_testdata.txt diff --git a/src/diffpy/srfit/tests/testdata/si-q27r60-xray.gr b/tests/testdata/si-q27r60-xray.gr similarity index 100% rename from src/diffpy/srfit/tests/testdata/si-q27r60-xray.gr rename to tests/testdata/si-q27r60-xray.gr diff --git a/src/diffpy/srfit/tests/testdata/testdata.txt b/tests/testdata/testdata.txt similarity index 100% rename from src/diffpy/srfit/tests/testdata/testdata.txt rename to tests/testdata/testdata.txt diff --git a/src/diffpy/srfit/tests/utils.py b/tests/utils.py similarity index 98% rename from src/diffpy/srfit/tests/utils.py rename to tests/utils.py index 71c6b13..03c5d8b 100644 --- a/src/diffpy/srfit/tests/utils.py +++ b/tests/utils.py @@ -21,7 +21,7 @@ import diffpy.srfit.equation.literals as literals from diffpy.srfit.sas.sasimport import sasimport -from diffpy.srfit.tests import logger +import logging as logger # Resolve availability of optional third-party packages. From faed7be31298fd2d8b1d4295964d3255f2dd95cc Mon Sep 17 00:00:00 2001 From: Sangjoon Bob Lee Date: Thu, 26 Sep 2024 00:58:04 -0400 Subject: [PATCH 3/6] Add github CI and change conda-recipe files to .txt --- .github/workflows/tests-on-pr.yml | 16 ++++++++++++++++ conda-recipe/{meta.yaml => meta.txt} | 0 conda-recipe/{run_test.py => run_test.txt} | 0 3 files changed, 16 insertions(+) create mode 100644 .github/workflows/tests-on-pr.yml rename conda-recipe/{meta.yaml => meta.txt} (100%) rename conda-recipe/{run_test.py => run_test.txt} (100%) diff --git a/.github/workflows/tests-on-pr.yml b/.github/workflows/tests-on-pr.yml new file mode 100644 index 0000000..3402e46 --- /dev/null +++ b/.github/workflows/tests-on-pr.yml @@ -0,0 +1,16 @@ +name: Tests on PR + +on: + push: + branches: + - main + pull_request: + workflow_dispatch: + +jobs: + validate: + uses: Billingegroup/release-scripts/.github/workflows/_tests-on-pr.yml@v0 + with: + project: diffpy.srfit + c_extension: false + headless: false diff --git a/conda-recipe/meta.yaml b/conda-recipe/meta.txt similarity index 100% rename from conda-recipe/meta.yaml rename to conda-recipe/meta.txt diff --git a/conda-recipe/run_test.py b/conda-recipe/run_test.txt similarity index 100% rename from conda-recipe/run_test.py rename to conda-recipe/run_test.txt From d50dd9d9f93f6ce7bcf765b83b1d1be6f9980dd0 Mon Sep 17 00:00:00 2001 From: Sangjoon Bob Lee Date: Thu, 26 Sep 2024 00:58:21 -0400 Subject: [PATCH 4/6] Add test.txt, run.txt --- requirements/pip.txt | 0 requirements/run.txt | 3 +++ requirements/test.txt | 6 ++++++ 3 files changed, 9 insertions(+) create mode 100644 requirements/pip.txt create mode 100644 requirements/run.txt create mode 100644 requirements/test.txt diff --git a/requirements/pip.txt b/requirements/pip.txt new file mode 100644 index 0000000..e69de29 diff --git a/requirements/run.txt b/requirements/run.txt new file mode 100644 index 0000000..59149ac --- /dev/null +++ b/requirements/run.txt @@ -0,0 +1,3 @@ +scipy +numpy +matplotlib diff --git a/requirements/test.txt b/requirements/test.txt new file mode 100644 index 0000000..a727786 --- /dev/null +++ b/requirements/test.txt @@ -0,0 +1,6 @@ +flake8 +pytest +codecov +coverage +pytest-cov +pytest-env From 52c4b8079fc0cf98dbcd2a45698b59b669b176d5 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Thu, 26 Sep 2024 05:01:57 +0000 Subject: [PATCH 5/6] [pre-commit.ci] auto fixes from pre-commit hooks --- tests/test_builder.py | 2 +- tests/test_characteristicfunctions.py | 2 +- tests/test_contribution.py | 2 +- tests/test_diffpyparset.py | 1 - tests/test_equation.py | 3 ++- tests/test_fitrecipe.py | 2 +- tests/test_fitresults.py | 3 ++- tests/test_objcrystparset.py | 1 - tests/test_pdf.py | 8 +------- tests/test_profile.py | 2 +- tests/test_recipeorganizer.py | 2 +- tests/test_sas.py | 2 +- tests/test_sgconstraints.py | 1 - tests/test_speed.py | 2 +- tests/test_visitors.py | 3 ++- tests/utils.py | 2 +- 16 files changed, 16 insertions(+), 22 deletions(-) diff --git a/tests/test_builder.py b/tests/test_builder.py index 2f27b9b..60ac3d5 100644 --- a/tests/test_builder.py +++ b/tests/test_builder.py @@ -18,10 +18,10 @@ import unittest import numpy +from utils import _makeArgs, noObserversInGlobalBuilders import diffpy.srfit.equation.builder as builder import diffpy.srfit.equation.literals as literals -from utils import _makeArgs, noObserversInGlobalBuilders class TestBuilder(unittest.TestCase): diff --git a/tests/test_characteristicfunctions.py b/tests/test_characteristicfunctions.py index cb6bf0d..ba9dd19 100644 --- a/tests/test_characteristicfunctions.py +++ b/tests/test_characteristicfunctions.py @@ -18,9 +18,9 @@ import unittest import numpy +from utils import _msg_nosas, has_sas from diffpy.srfit.sas.sasimport import sasimport -from utils import _msg_nosas, has_sas # Global variables to be assigned in setUp cf = None diff --git a/tests/test_contribution.py b/tests/test_contribution.py index 36bb7af..9ca8f13 100644 --- a/tests/test_contribution.py +++ b/tests/test_contribution.py @@ -18,13 +18,13 @@ import unittest from numpy import arange, array_equal, dot, sin +from utils import noObserversInGlobalBuilders from diffpy.srfit.exceptions import SrFitError from diffpy.srfit.fitbase.fitcontribution import FitContribution from diffpy.srfit.fitbase.parameter import Parameter from diffpy.srfit.fitbase.profile import Profile from diffpy.srfit.fitbase.profilegenerator import ProfileGenerator -from utils import noObserversInGlobalBuilders class TestContribution(unittest.TestCase): diff --git a/tests/test_diffpyparset.py b/tests/test_diffpyparset.py index 11aa423..de44983 100644 --- a/tests/test_diffpyparset.py +++ b/tests/test_diffpyparset.py @@ -19,7 +19,6 @@ import unittest import numpy - from utils import _msg_nostructure, has_structure # Global variables to be assigned in setUp diff --git a/tests/test_equation.py b/tests/test_equation.py index a48489b..8678fe5 100644 --- a/tests/test_equation.py +++ b/tests/test_equation.py @@ -17,9 +17,10 @@ import unittest +from utils import _makeArgs, noObserversInGlobalBuilders + import diffpy.srfit.equation.literals as literals from diffpy.srfit.equation import Equation -from utils import _makeArgs, noObserversInGlobalBuilders class TestEquation(unittest.TestCase): diff --git a/tests/test_fitrecipe.py b/tests/test_fitrecipe.py index 305bf49..8795166 100644 --- a/tests/test_fitrecipe.py +++ b/tests/test_fitrecipe.py @@ -18,12 +18,12 @@ import unittest from numpy import array_equal, dot, linspace, pi, sin +from utils import capturestdout from diffpy.srfit.fitbase.fitcontribution import FitContribution from diffpy.srfit.fitbase.fitrecipe import FitRecipe from diffpy.srfit.fitbase.parameter import Parameter from diffpy.srfit.fitbase.profile import Profile -from utils import capturestdout class TestFitRecipe(unittest.TestCase): diff --git a/tests/test_fitresults.py b/tests/test_fitresults.py index 65d926a..928b72d 100644 --- a/tests/test_fitresults.py +++ b/tests/test_fitresults.py @@ -17,9 +17,10 @@ import unittest +from utils import datafile + from diffpy.srfit.fitbase.fitrecipe import FitRecipe from diffpy.srfit.fitbase.fitresults import initializeRecipe -from utils import datafile class TestInitializeRecipe(unittest.TestCase): diff --git a/tests/test_objcrystparset.py b/tests/test_objcrystparset.py index 906231c..00e8170 100644 --- a/tests/test_objcrystparset.py +++ b/tests/test_objcrystparset.py @@ -18,7 +18,6 @@ import unittest import numpy - from utils import _msg_nopyobjcryst, has_pyobjcryst # Global variables to be assigned in setUp diff --git a/tests/test_pdf.py b/tests/test_pdf.py index 40ec2e4..9d43ee3 100644 --- a/tests/test_pdf.py +++ b/tests/test_pdf.py @@ -20,16 +20,10 @@ import unittest import numpy +from utils import _msg_nosrreal, _msg_nostructure, datafile, has_srreal, has_structure from diffpy.srfit.exceptions import SrFitError from diffpy.srfit.pdf import PDFContribution, PDFGenerator, PDFParser -from utils import ( - _msg_nosrreal, - _msg_nostructure, - datafile, - has_srreal, - has_structure, -) # ---------------------------------------------------------------------------- diff --git a/tests/test_profile.py b/tests/test_profile.py index de447b8..74b8382 100644 --- a/tests/test_profile.py +++ b/tests/test_profile.py @@ -20,10 +20,10 @@ import unittest from numpy import allclose, arange, array, array_equal, ones_like +from utils import datafile from diffpy.srfit.exceptions import SrFitError from diffpy.srfit.fitbase.profile import Profile -from utils import datafile class TestProfile(unittest.TestCase): diff --git a/tests/test_recipeorganizer.py b/tests/test_recipeorganizer.py index 30030bc..a65adf7 100644 --- a/tests/test_recipeorganizer.py +++ b/tests/test_recipeorganizer.py @@ -18,6 +18,7 @@ import unittest import numpy +from utils import capturestdout from diffpy.srfit.equation.builder import EquationFactory from diffpy.srfit.fitbase.calculator import Calculator @@ -27,7 +28,6 @@ RecipeOrganizer, equationFromString, ) -from utils import capturestdout # ---------------------------------------------------------------------------- diff --git a/tests/test_sas.py b/tests/test_sas.py index 6b44503..fe17ca1 100644 --- a/tests/test_sas.py +++ b/tests/test_sas.py @@ -18,10 +18,10 @@ import unittest import numpy +from utils import _msg_nosas, datafile, has_sas from diffpy.srfit.sas import SASGenerator, SASParser, SASProfile from diffpy.srfit.sas.sasimport import sasimport -from utils import _msg_nosas, datafile, has_sas # ---------------------------------------------------------------------------- diff --git a/tests/test_sgconstraints.py b/tests/test_sgconstraints.py index 2b0b6b4..ea323a0 100644 --- a/tests/test_sgconstraints.py +++ b/tests/test_sgconstraints.py @@ -18,7 +18,6 @@ import unittest import numpy - from utils import ( _msg_nopyobjcryst, _msg_nostructure, diff --git a/tests/test_speed.py b/tests/test_speed.py index ad4c951..93ef32f 100644 --- a/tests/test_speed.py +++ b/tests/test_speed.py @@ -20,10 +20,10 @@ import random import numpy +from utils import _makeArgs import diffpy.srfit.equation.literals as literals import diffpy.srfit.equation.visitors as visitors -from utils import _makeArgs x = numpy.arange(0, 20, 0.05) diff --git a/tests/test_visitors.py b/tests/test_visitors.py index 7c826a1..2a32d5e 100644 --- a/tests/test_visitors.py +++ b/tests/test_visitors.py @@ -17,9 +17,10 @@ import unittest +from utils import _makeArgs + import diffpy.srfit.equation.literals as literals import diffpy.srfit.equation.visitors as visitors -from utils import _makeArgs class TestValidator(unittest.TestCase): diff --git a/tests/utils.py b/tests/utils.py index 03c5d8b..e2afb4b 100644 --- a/tests/utils.py +++ b/tests/utils.py @@ -15,13 +15,13 @@ """Helper routines for testing.""" +import logging as logger import sys import six import diffpy.srfit.equation.literals as literals from diffpy.srfit.sas.sasimport import sasimport -import logging as logger # Resolve availability of optional third-party packages. From 2fafe83ef10b639207e3f5dd3b59e189fcc45090 Mon Sep 17 00:00:00 2001 From: Sangjoon Bob Lee Date: Thu, 26 Sep 2024 01:04:12 -0400 Subject: [PATCH 6/6] Add env.yml file --- environment.yml | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 environment.yml diff --git a/environment.yml b/environment.yml new file mode 100644 index 0000000..0e279fb --- /dev/null +++ b/environment.yml @@ -0,0 +1,6 @@ +name: diffpy.srfit +channels: + - conda-forge +dependencies: + - python=3 + - pip