diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 0ed6a930..c8cdeeaa 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -26,7 +26,7 @@ repos: rev: 6.1.0 hooks: - id: flake8 - additional_dependencies: [flake8-deprecated, flake8-mutable] + additional_dependencies: [flake8-deprecated, flake8-mutable, Flake8-pyproject] - repo: https://github.com/PyCQA/isort/ rev: 5.12.0 @@ -64,3 +64,4 @@ repos: rev: v1.5.0 hooks: - id: yesqa + additional_dependencies: [flake8-deprecated, flake8-mutable, Flake8-pyproject] diff --git a/azure-pipelines.yml b/azure-pipelines.yml index ae2cfdd2..36f881f4 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -14,7 +14,7 @@ stages: steps: - task: UsePythonVersion@0 inputs: - versionSpec: '3.11' + versionSpec: '3.12' - script: | python -m pip install --upgrade build pip setuptools wheel displayName: 'Install Python build tools and dependencies' @@ -43,7 +43,7 @@ stages: steps: - task: UsePythonVersion@0 inputs: - versionSpec: '3.11' + versionSpec: '3.12' - script: | python -m pip install --upgrade build pip setuptools wheel displayName: 'Install Python build tools' @@ -125,6 +125,8 @@ stages: python.version: '3.10' Python311: python.version: '3.11' + Python312: + python.version: '3.12' steps: - task: UsePythonVersion@0 @@ -163,7 +165,6 @@ stages: ./codecov -v -f "coverage.xml" displayName: 'Upload to codecov.io' -# Python 3.11 on Windows currently fails to build pycairo - stage: test_Windows_latest dependsOn: check_codestyle condition: succeededOrFailed() @@ -173,8 +174,8 @@ stages: vmImage: 'windows-latest' strategy: matrix: - Python310: - python.version: '3.10' + Python312: + python.version: '3.12' steps: - task: UsePythonVersion@0 @@ -208,8 +209,8 @@ stages: vmImage: 'macos-latest' strategy: matrix: - Python311: - python.version: '3.11' + Python312: + python.version: '3.12' steps: - task: UsePythonVersion@0 @@ -235,13 +236,13 @@ stages: dependsOn: check_codestyle condition: succeededOrFailed() jobs: - - job: Python312_dev + - job: Python313_dev pool: vmImage: 'ubuntu-latest' steps: - script: | sudo add-apt-repository ppa:deadsnakes/nightly - sudo apt-get update && sudo apt-get install -y --no-install-recommends python3.12-dev python3.12-venv + sudo apt-get update && sudo apt-get install -y --no-install-recommends python3.13-dev python3.13-venv displayName: Install Python development version from the deadsnakes PPA - script: | sudo apt-get update && sudo apt-get install -yq --no-install-suggests --no-install-recommends \ @@ -250,10 +251,8 @@ stages: displayName: 'Install dependencies' - script: | export PATH=/home/vsts/.local/bin:$PATH - ##curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py - ##python3.12 get-pip.py --user - python3.12 -m ensurepip --upgrade - pip3.12 install -U build pip setuptools wheel pybind11 cython || echo -e "\043#vso[task.logissue type=warning;] Allowed failure for development version!!" + python3.13 -m ensurepip --upgrade + pip3.13 install -U build pip setuptools wheel pybind11 cython || echo -e "\043#vso[task.logissue type=warning;] Allowed failure for development version!!" displayName: 'Install build, pip, setuptools, wheel, pybind11, and cython' - script: | export PATH=/home/vsts/.local/bin:$PATH @@ -261,11 +260,12 @@ stages: wget https://github.com/numpy/numpy/releases/download/v${numpy_version}/numpy-${numpy_version}.tar.gz tar xzvf numpy-${numpy_version}.tar.gz cd numpy-${numpy_version} - python3.12 setup.py install --user || echo -e "\043#vso[task.logissue type=warning;] Allowed failure for development version!!" + python3.13 -m build || echo -e "\043#vso[task.logissue type=warning;] Allowed failure for development version!!" + python3.13 -m pip install . --user || echo -e "\043#vso[task.logissue type=warning;] Allowed failure for development version!!" displayName: 'Install latest available version of NumPy' - script: | export PATH=/home/vsts/.local/bin:$PATH - pip3.12 install -U pythran || echo -e "\043#vso[task.logissue type=warning;] Allowed failure for development version!!" + pip3.13 install -U pythran || echo -e "\043#vso[task.logissue type=warning;] Allowed failure for development version!!" displayName: 'Install pythran' - script: | export PATH=/home/vsts/.local/bin:$PATH @@ -273,24 +273,25 @@ stages: wget https://github.com/scipy/scipy/releases/download/v${scipy_version}/scipy-${scipy_version}.tar.gz tar xzvf scipy-${scipy_version}.tar.gz cd scipy-${scipy_version} - python3.12 setup.py install --user || echo -e "\043#vso[task.logissue type=warning;] Allowed failure for development version!!" + python3.13 -m build || echo -e "\043#vso[task.logissue type=warning;] Allowed failure for development version!!" + python3.13 -m pip install . --user || echo -e "\043#vso[task.logissue type=warning;] Allowed failure for development version!!" displayName: 'Install latest available version of SciPy' - script: | export PATH=/home/vsts/.local/bin:$PATH # remove numdifftools for now as it pulls in statsmodels, that wants to build with NumPy 1.14.5 - pip3.12 install asteval uncertainties dill emcee flaky pytest pytest-cov || echo -e "\043#vso[task.logissue type=warning;] Allowed failure for development version!!" + pip3.13 install asteval uncertainties dill emcee flaky pytest pytest-cov || echo -e "\043#vso[task.logissue type=warning;] Allowed failure for development version!!" displayName: 'Install latest available version of Python dependencies' - script: | - python3.12 -m build - python3.12 -m pip install '.[test]' --user || echo -e "\043#vso[task.logissue type=warning;] Allowed failure for development version!!" + python3.13 -m build + python3.13 -m pip install '.[test]' --user || echo -e "\043#vso[task.logissue type=warning;] Allowed failure for development version!!" displayName: 'Build wheel/sdist and install lmfit' - script: | export PATH=/home/vsts/.local/bin:$PATH - pip3.12 list || echo -e "\043#vso[task.logissue type=warning;] Allowed failure for development version!!" + pip3.13 list || echo -e "\043#vso[task.logissue type=warning;] Allowed failure for development version!!" displayName: 'List installed Python packages' - script: | export PATH=/home/vsts/.local/bin:$PATH - pip3.12 install pytest-azurepipelines + pip3.13 install pytest-azurepipelines cd $(Agent.BuildDirectory)/s/tests pytest || echo -e "\043#vso[task.logissue type=warning;] Allowed failure for development version!!" displayName: 'Run test-suite' diff --git a/doc/installation.rst b/doc/installation.rst index 9b59e554..09c0916d 100644 --- a/doc/installation.rst +++ b/doc/installation.rst @@ -57,7 +57,7 @@ the Python packages `sphinxcontrib-svg2pdfconverter`_ and `cairosvg`_ are also r as well as the LaTex package `Latexmk`_ (which is included by default in some LaTex distributions). -Please refer to ``setup.cfg`` under ``options.extras_require`` for a list of all +Please refer to ``pyproject.toml`` under ``project.optional-dependencies`` for a list of all dependencies that are needed if you want to participate in the development of lmfit. You can install all these dependencies automatically by doing ``pip install lmfit[all]``, or select only a subset (e.g., ``dev```, ``doc``, or ``test``). diff --git a/pyproject.toml b/pyproject.toml index 5a184b9c..facffc83 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -2,6 +2,142 @@ requires = ["setuptools>=45", "wheel", "setuptools_scm>=6.2"] build-backend = "setuptools.build_meta" +[project] +name = "lmfit" +dynamic = ["version"] +dependencies = [ + "asteval>=0.9.28", + "numpy>=1.19", + "scipy>=1.6", + "uncertainties>=3.1.4", +] +requires-python = ">= 3.8" +authors = [ + {name = "LMFit Development Team", email = "matt.newville@gmail.com"}, +] +description = "Least-Squares Minimization with Bounds and Constraints" +readme = "README.rst" +license = {file = "LICENSE"} +keywords = ["curve-fitting, least-squares minimization"] +classifiers = [ + "Development Status :: 5 - Production/Stable", + "Intended Audience :: Science/Research", + "Topic :: Scientific/Engineering", + "License :: OSI Approved :: BSD License", + "Operating System :: OS Independent", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3 :: Only", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", + "Programming Language :: Python :: Implementation :: CPython", + "Programming Language :: Python :: Implementation :: PyPy", +] + +[project.urls] +Homepage = "https://lmfit.github.io//lmfit-py/" +Documentation = "https://lmfit.github.io/lmfit-py/" +Changelog = "https://lmfit.github.io/lmfit-py/whatsnew.html" + +[project.optional-dependencies] +dev = [ + "build", + "check-wheel-contents", + "flake8-pyproject", + "pre-commit", + "twine", +] +doc = [ + "cairosvg", + "corner", + "dill", + "emcee>=3.0.0", + "ipykernel", + "jupyter_sphinx>=0.2.4", + "matplotlib", + "numdifftools", + "pandas", + "Pillow", + "pycairo;platform_system=='Windows'", + "Sphinx", + "sphinx-gallery>=0.10", + "sphinxcontrib-svg2pdfconverter", + "sympy", +] +test = [ + "coverage", + "flaky", + "pytest", + "pytest-cov", +] +all = ["lmfit[dev, doc, test]"] + +[tool.setuptools.packages.find] +include = ["lmfit"] + [tool.setuptools_scm] write_to = "lmfit/version.py" version_scheme = "post-release" + +[tool.isort] +skip = [ + "lmfit/__init__.py", + "doc/conf.py", +] +known_third_party = [ + "asteval", + "dill" , + "emcee", + "IPython", + "matplotlib", + "numdifftools", + "numpy", + "NISTModels", + "pandas", + "pytest", + "scipy", + "uncertainties", +] +known_first_party = [ + "lmfit", + "lmfit_testutils", +] +force_sort_within_sections = "True" + +[tool.rstcheck] +report_level = "WARNING" +ignore_substitutions = [ + "release" +] +ignore_roles = [ + "scipydoc", + "numpydoc", +] +ignore_directives = [ + "autoclass", + "autodoc", + "autofunction", + "automethod", + "jupyter-execute", + "math", +] + +[tool.coverage.run] +omit = [ + "tests/*", +] + +[tool.pytest.ini_options] +addopts = "--cov=lmfit --cov-report html" + +[tool.flake8] +ignore = [ + "E121", "E123", "E126", "E226", + "W503", "W504", "E501", "E731", +] +exclude = [ + "doc/conf.py", + "lmfit/__init__.py", +] diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index 366bf4bf..00000000 --- a/setup.cfg +++ /dev/null @@ -1,98 +0,0 @@ -[metadata] -name = lmfit -description = Least-Squares Minimization with Bounds and Constraints -long_description = file: README.rst -long_description_content_type = text/x-rst -author = LMFit Development Team -author_email = matt.newville@gmail.com -url = https://lmfit.github.io//lmfit-py/ -license = BSD 3-Clause -platforms = any -classifiers = - Development Status :: 5 - Production/Stable - Intended Audience :: Science/Research - Topic :: Scientific/Engineering - License :: OSI Approved :: BSD License - Operating System :: OS Independent - Programming Language :: Python :: 3 - Programming Language :: Python :: 3 :: Only - 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 -keywords = curve-fitting, least-squares minimization -project_urls = - Source = https://github.com/lmfit/lmfit-py - Changelog = https://lmfit.github.io/lmfit-py/whatsnew.html - Documentation = https://lmfit.github.io/lmfit-py/ - Tracker = https://github.com/lmfit/lmfit-py/issues - -[options] -packages = find: -python_requires = >=3.8 -setup_requires = setuptools_scm -install_requires = - asteval>=0.9.28 - numpy>=1.23 - scipy>=1.8 - uncertainties>=3.1.4 - -[options.packages.find] -include = - lmfit - -[options.extras_require] -dev = - build - check-wheel-contents - pre-commit - twine -doc = - cairosvg - corner - dill - emcee>=3.0.0 - ipykernel - jupyter_sphinx>=0.2.4 - matplotlib - numdifftools - pandas - Pillow - pycairo;platform_system=="Windows" - Sphinx - sphinx-gallery>=0.10 - sphinxcontrib-svg2pdfconverter - sympy -test = - coverage - flaky - pytest - pytest-cov -all = - %(dev)s - %(test)s - %(doc)s - -[isort] -skip=lmfit/__init__.py,doc/conf.py -known_third_party=asteval,dill,emcee,IPython,matplotlib,numdifftools,numpy,NISTModels,pandas,pytest,scipy,uncertainties -known_first_party=lmfit,lmfit_testutils -force_sort_within_sections=True - -[rstcheck] -report=warning -ignore_substitutions=release -ignore_roles=scipydoc,numpydoc -ignore_directives=autoclass,autodoc,autofunction,automethod,jupyter-execute,math - -[flake8] -ignore = E121,E123,E126,E226,W503,W504,E501,E731 -exclude = doc/conf.py,lmfit/__init__.py - -[coverage:run] -omit = tests/* - -[tool:pytest] -addopts = --cov=lmfit --cov-report html