diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 00000000..3ca8edde Binary files /dev/null and b/.DS_Store differ diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 00000000..c45ea829 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,77 @@ +[build-system] +requires = ["setuptools>=62.0", "setuptools-git-versioning<2"] +build-backend = "setuptools.build_meta" + +[project] +name = "diffpy.srfit" +dynamic=['version'] +authors = [ + { name="Simon J.L. Billinge group", email="simon.billinge@gmail.com" }, +] +maintainers = [ + { name="Simon J.L. Billinge group", email="simon.billinge@gmail.com" }, +] +description = "SrFit - Structure refinement from diffraction data" +keywords = "optimization constraints restraints structure refinement complex modeling" +readme = "README.rst" +requires-python = ">=3.10" +classifiers = [ + # List of possible values at + # http://pypi.python.org/pypi?:action=list_classifiers + 'Development Status :: 5 - Production/Stable', + 'Environment :: Console', + 'Intended Audience :: Developers', + 'Intended Audience :: Education', + 'Intended Audience :: Science/Research', + 'License :: OSI Approved :: BSD License', + 'Operating System :: MacOS', + 'Operating System :: POSIX', + 'Programming Language :: Python :: 3.9', + 'Programming Language :: Python :: 3.10', + 'Programming Language :: Python :: 3.11', + 'Programming Language :: Python :: 3.12', + 'Topic :: Scientific/Engineering :: Chemistry', + 'Topic :: Scientific/Engineering :: Physics', + 'Topic :: Software Development :: Libraries', +] + +[project.urls] +Homepage = "https://github.com/diffpy/diffpy.srfit" +Issues = "https://github.com/diffpy/diffpy.srfit/issues" + +[tool.setuptools-git-versioning] +enabled = true +template = "{tag}" +dev_template = "{tag}" +dirty_template = "{tag}" + +[project.scripts] +srfit = "diffpy.srfit:main" + +[tool.setuptools.packages.find] +where = ["src"] # list of folders that contain the packages (["."] by default) +include = ["diffpy*"] # package names should match these glob patterns (["*"] by default) +exclude = ["diffpy.srfit.tests*"] # exclude packages matching these glob patterns (empty by default) +namespaces = false # to disable scanning PEP 420 namespaces (true by default) + +[tool.black] +line-length = 115 +include = '\.pyi?$' +exclude = ''' +/( + \.git + | \.hg + | \.mypy_cache + | \.tox + | \.venv + | _build + | buck-out + | build + | dist + + # The following are specific to Black, you probably don't want those. + | blib2to3 + | tests/data +)/ +''' + diff --git a/src/diffpy/srfit/tests/__init__.py b/src/diffpy/srfit/tests/__init__.py index 845b5c39..391786e8 100644 --- a/src/diffpy/srfit/tests/__init__.py +++ b/src/diffpy/srfit/tests/__init__.py @@ -16,8 +16,8 @@ """Unit tests for diffpy.srfit. """ -import unittest import logging +import unittest # create logger instance for the tests subpackage logging.basicConfig() @@ -43,9 +43,9 @@ def testsuite(pattern=''): import re from os.path import dirname from itertools import chain - from pkg_resources import resource_filename + from importlib.resources import files loader = unittest.defaultTestLoader - thisdir = resource_filename(__name__, '') + thisdir = files(__name__) / "" depth = __name__.count('.') + 1 topdir = thisdir for i in range(depth): @@ -82,4 +82,5 @@ def test(): return result + # End of file diff --git a/src/diffpy/srfit/version.py b/src/diffpy/srfit/version.py index 98c20188..ebde11de 100644 --- a/src/diffpy/srfit/version.py +++ b/src/diffpy/srfit/version.py @@ -26,12 +26,12 @@ import os.path -from pkg_resources import resource_filename +from importlib.resources import files # obtain version information from the version.cfg file cp = dict(version='', date='', commit='', timestamp='0') -fcfg = resource_filename(__name__, 'version.cfg') +fcfg = files(__name__) / "version.cfg" if not os.path.isfile(fcfg): # pragma: no cover from warnings import warn warn('Package metadata not found, execute "./setup.py egg_info".') @@ -47,6 +47,7 @@ __git_commit__ = cp['commit'] __timestamp__ = int(cp['timestamp']) + # TODO remove deprecated __gitsha__ in version 3.1. __gitsha__ = __git_commit__