diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 812280964..e71f7daa4 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -8,16 +8,9 @@ repos: - repo: local hooks: - - id: black - name: Run black + - id: ruff + name: Run ruff stages: [pre-commit] language: system - entry: black --check --diff - types: [python] - - - id: flake8 - name: Run flake8 - stages: [pre-commit] - language: system - entry: flake8 + entry: ruff check types: [python] diff --git a/pyproject.toml b/pyproject.toml index 88c92c35f..48d3ed0d7 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -2,6 +2,81 @@ requires = ["setuptools>=45", "setuptools_scm[toml]>=6.2", "wheel"] build-backend = "setuptools.build_meta" +[project] +name = "ophyd" +description = "Bluesky hardware abstraction with an emphasis on EPICS" +dynamic = ["version"] +readme = "README.rst" +requires-python = ">=3.8" +license = {text = "BSD-3-Clause"} +classifiers = [ + "Development Status :: 5 - Production/Stable", + "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 :: 3.13", +] +dependencies = [ + "networkx>=2.0", + "numpy", + "opentelemetry-api", + "packaging", + "pint", +] + +[project.optional-dependencies] +dev = [ + "attrs>=19.3.0", + "bluesky>=1.11.0", + "caproto[standard] >=0.4.2rc1,!=1.2.0", + "pytest-codecov", + "databroker>=1.0.0b1", + "doctr", + "epics-pypdb", + "ruff", + "h5py", + "inflection", + "ipython", + "ipywidgets", + "matplotlib", + "mypy", + "myst-parser", + "numpydoc", + "pre-commit", + "pydata-sphinx-theme", + "pyepics>=3.4.2,<3.5.7", + "pytest", + "pytest-asyncio", + "pytest-cov", + "pytest-faulthandler", + "pytest-rerunfailures", + "pytest-timeout", + "pipdeptree", + "setuptools>=64", + "setuptools_scm[toml]>=6.2", + "sphinx-autobuild", + "sphinx-design", + "tox-direct", +] + +[project.urls] +Homepage = "https://github.com/bluesky/ophyd" +Documentation = "https://blueskyproject.io/ophyd/" +Repository = "https://github.com/bluesky/ophyd.git" +Issues = "https://github.com/bluesky/ophyd/issues" +Changelog = "https://github.com/bluesky/ophyd/blob/main/docs/user/reference/release_notes.rst" + +[project.entry-points."databroker.handlers"] +NPY_SEQ = "ophyd.sim:NumpySeqHandler" + +[tool.setuptools] +packages = ["ophyd"] + +[tool.setuptools.package-data] +ophyd = ["*.rst"] + [tool.setuptools_scm] write_to = "ophyd/_version.py" @@ -20,4 +95,47 @@ markers = [ asyncio_mode = "auto" # https://iscinumpy.gitlab.io/post/bound-version-constraints/#watch-for-warnings # filterwarnings = "error" -python_files = "test_*.py" \ No newline at end of file +python_files = "test_*.py" + +[tool.ruff] +line-length = 115 +extend-ignore = [ + "E203", + "F811", + "F722", +] + +exclude = [ + "ui_*", + ".tox", + ".venv", + "docs/source", + "ophyd/areadetector/docs.py", +] + +[tool.coverage.run] +concurrency = [ + "thread", + "multiprocessing", +] +data_file = "/tmp/ophyd.coverage" + +[tool.tox] +legacy_tox_ini = """ +[tox] +skipsdist = True + +[testenv:pytest] +allowlist_externals = pytest +commands = pytest {posargs} + +[testenv:pre-commit] +allowlist_externals = pre-commit +commands = pre-commit run --all-files {posargs} + +[testenv:docs] +allowlist_externals = + sphinx-build + sphinx-autobuild +commands = sphinx-{posargs:build -EW --keep-going} -T docs build/html +""" \ No newline at end of file diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index 1a33deeea..000000000 --- a/setup.cfg +++ /dev/null @@ -1,128 +0,0 @@ -[metadata] -name = ophyd -description = Bluesky hardware abstraction with an emphasis on EPICS -url = https://github.com/bluesky/ophyd -license = BSD -long_description = file: README.rst -long_description_content_type = text/x-rst -classifiers = - License :: OSI Approved :: BSD License - Development Status :: 5 - Production/Stable - 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 :: 3.13 - -[options] -python_requires = >=3.8 -packages = find: -setup_requires = - setuptools_scm[toml]>=6.2 - -# Specify any package dependencies below. -install_requires = - networkx>=2.0 - numpy - opentelemetry-api - packaging - pint - -[options.extras_require] -# For development tests/docs -dev = - attrs>=19.3.0 - black==22.3.0 - bluesky>=1.11.0 - caproto[standard] >=0.4.2rc1,!=1.2.0 - pytest-codecov - databroker>=1.0.0b1 - doctr - epics-pypdb - # Upper bound on flake8 while flake8-isort catches up - # https://github.com/gforcada/flake8-isort/issues/115 - flake8 - flake8-isort - h5py - inflection - ipython - ipywidgets - matplotlib - mypy - myst-parser - numpydoc - pre-commit - pydata-sphinx-theme - pyepics>=3.4.2,<3.5.7 - pytest - pytest-asyncio - pytest-cov - pytest-faulthandler - pytest-rerunfailures - pytest-timeout - pipdeptree - setuptools>=64 - setuptools_scm[toml]>=6.2 - sphinx-autobuild - sphinx-design - tox-direct - -# Specify any package data to be included in the wheel below. -[options.package_data] -ophyd = - # Include our documentation helpers: - "*.rst" - -[options.entry_points] -databroker.handlers = - NPY_SEQ = ophyd.sim:NumpySeqHandler - -[isort] -profile=black - -[flake8] -max-line-length = 115 -extend-ignore = - W504, - W503, - # See https://github.com/PyCQA/pycodestyle/issues/373 - E203, - # support typing.overload decorator - F811, - # allow Annotated[typ, some_func("some string")] - F722, -exclude = - ui_* - .tox - .venv - docs/source, - ophyd/areadetector/docs.py - -[coverage:run] -concurrency= - thread - multiprocessing -data_file = /tmp/ophyd.coverage - -# Use tox to provide parallel linting and testing -# NOTE that we pre-install all tools in the dev dependencies (including tox). -# Hence the use of allowlist_externals instead of using the tox virtualenvs. -# This ensures a match between developer time tools in the IDE and tox tools. -# Setting TOX_DIRECT=1 in the environment will make this even faster -[tox:tox] -skipsdist = True - -[testenv:pytest] -allowlist_externals = pytest -commands = pytest {posargs} - -[testenv:pre-commit] -allowlist_externals = pre-commit -commands = pre-commit run --all-files {posargs} - -[testenv:docs] -allowlist_externals = - sphinx-build - sphinx-autobuild -commands = sphinx-{posargs:build -EW --keep-going} -T docs build/html diff --git a/setup.py b/setup.py deleted file mode 100644 index 6b13f70e8..000000000 --- a/setup.py +++ /dev/null @@ -1,7 +0,0 @@ -#!/usr/bin/env python -from setuptools import setup - -# NOTE: This file must remain Python 2 compatible for the foreseeable future, -# to ensure that we error out properly for people with outdated setuptools -# and/or pip. -setup()