Skip to content

Commit

Permalink
Merge pull request #928 from reneeotten/switch-to-pyproject.toml
Browse files Browse the repository at this point in the history
  • Loading branch information
reneeotten committed Dec 1, 2023
2 parents e21a6aa + af16a01 commit caf0930
Show file tree
Hide file tree
Showing 5 changed files with 161 additions and 121 deletions.
3 changes: 2 additions & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -64,3 +64,4 @@ repos:
rev: v1.5.0
hooks:
- id: yesqa
additional_dependencies: [flake8-deprecated, flake8-mutable, Flake8-pyproject]
43 changes: 22 additions & 21 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -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'
Expand Down Expand Up @@ -125,6 +125,8 @@ stages:
python.version: '3.10'
Python311:
python.version: '3.11'
Python312:
python.version: '3.12'

steps:
- task: UsePythonVersion@0
Expand Down Expand Up @@ -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()
Expand All @@ -173,8 +174,8 @@ stages:
vmImage: 'windows-latest'
strategy:
matrix:
Python310:
python.version: '3.10'
Python312:
python.version: '3.12'

steps:
- task: UsePythonVersion@0
Expand Down Expand Up @@ -208,8 +209,8 @@ stages:
vmImage: 'macos-latest'
strategy:
matrix:
Python311:
python.version: '3.11'
Python312:
python.version: '3.12'

steps:
- task: UsePythonVersion@0
Expand All @@ -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 \
Expand All @@ -250,47 +251,47 @@ 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
export numpy_version=1.26.2
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
export scipy_version=1.11.3
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'
2 changes: 1 addition & 1 deletion doc/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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``).
Expand Down
136 changes: 136 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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",
]
98 changes: 0 additions & 98 deletions setup.cfg

This file was deleted.

0 comments on commit caf0930

Please sign in to comment.