From 10bce90381c82290eb68a099a4fe929d779e20e9 Mon Sep 17 00:00:00 2001 From: Bas van Beek Date: Wed, 26 Apr 2023 15:52:43 +0200 Subject: [PATCH] MAINT: Migrate from setup.cfg to pyproject.toml --- linting_requirements.txt | 5 +++-- pyproject.toml | 25 +++++++++++++++++++++++++ scripts/prepare_test_dir.sh | 1 - setup.cfg | 27 --------------------------- setup.py | 17 ++++++++++------- 5 files changed, 38 insertions(+), 37 deletions(-) delete mode 100644 setup.cfg diff --git a/linting_requirements.txt b/linting_requirements.txt index 0e4c593e..5b84be68 100644 --- a/linting_requirements.txt +++ b/linting_requirements.txt @@ -1,5 +1,6 @@ -pydocstyle -flake8 +pydocstyle[toml]>=6.1 +flake8>=5 +Flake8-pyproject>=1.0.1 # Mypy-related stuff mypy diff --git a/pyproject.toml b/pyproject.toml index cae5088c..668a02c7 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -19,6 +19,31 @@ module = [ ] ignore_missing_imports = true +[tool.pydocstyle] +add_ignore = ["D401"] + +[tool.coverage.run] +branch = true +source = ["nanoqm"] + +[tool.pytest.ini_options] +testpaths = "test" +addopts = "--tb=short --cov --cov-report xml --cov-report term --cov-report html --cache-clear --pdbcls=IPython.terminal.debugger:TerminalPdb --durations=6" +markers = [ + "slow: A marker for slow tests requiring external quantum-chemical packages." +] +filterwarnings = [ + "error::qmflows.warnings_qmflows.QMFlows_Warning", + "ignore:Generic keyword '_pytestfixturefunction' not implemented for package \\w+:qmflows.warnings_qmflows.Key_Warning", +] + +[tool.flake8] +max-line-length = 100 +per-file-ignores = [ + "nanoqm/workflows/input_validation.py: E704,E501", + "nanoqm/analysis/tools.py: F821", +] + [tool.cibuildwheel] build = [ "cp38-manylinux_x86_64", diff --git a/scripts/prepare_test_dir.sh b/scripts/prepare_test_dir.sh index 464598b8..50b83603 100644 --- a/scripts/prepare_test_dir.sh +++ b/scripts/prepare_test_dir.sh @@ -8,7 +8,6 @@ set -euo pipefail mkdir /tmp/nanoqm -cp setup.cfg /tmp/nanoqm/ cp conftest.py /tmp/nanoqm/ cp -r test /tmp/nanoqm/ cp CITATION.cff /tmp/nanoqm/ diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index 6ca4b683..00000000 --- a/setup.cfg +++ /dev/null @@ -1,27 +0,0 @@ -[coverage:run] -branch = True -source = nanoqm - -[flake8] -max-line-length = 100 -per-file-ignores = - nanoqm/workflows/input_validation.py: E704,E501 - nanoqm/analysis/tools.py: F821 - -[tool:pytest] -testpaths = test -addopts = --tb=short --cov --cov-report xml --cov-report term --cov-report html --cache-clear --pdbcls=IPython.terminal.debugger:TerminalPdb --durations=6 -markers = slow: A marker for slow tests requiring external quantum-chemical packages. -filterwarnings = - error::qmflows.warnings_qmflows.QMFlows_Warning - ignore:Generic keyword '_pytestfixturefunction' not implemented for package \w+:qmflows.warnings_qmflows.Key_Warning - -# Define `python setup.py build_sphinx` -[build_sphinx] -source-dir = docs -build-dir = docs/_build -all_files = 1 -builder = html - -[pydocstyle] -add-ignore = D401 diff --git a/setup.py b/setup.py index 2bc2e628..96a157ed 100644 --- a/setup.py +++ b/setup.py @@ -12,14 +12,17 @@ from setuptools.command.build_ext import build_ext from wheel.bdist_wheel import bdist_wheel -here = os.path.abspath(os.path.dirname(__file__)) -version: "dict[str, str]" = {} -with open(os.path.join(here, 'nanoqm', '_version.py'), 'r', encoding='utf8') as f: - exec(f.read(), version) +def get_version() -> str: + """Load the version.""" + here = os.path.abspath(os.path.dirname(__file__)) + version: "dict[str, str]" = {} + with open(os.path.join(here, 'nanoqm', '_version.py'), 'r', encoding='utf8') as f: + exec(f.read(), version) + return version["__version__"] -def readme() -> str: +def get_readme() -> str: """Load readme.""" with open('README.rst', 'r', encoding='utf8') as f: return f.read() @@ -152,7 +155,7 @@ def get_paths() -> "tuple[list[str], list[str]]": setup( name='nano-qmflows', - version=version['__version__'], + version=get_version(), description='Derivative coupling calculation', license='Apache-2.0', license_files=["LICENSE*.txt"], @@ -160,7 +163,7 @@ def get_paths() -> "tuple[list[str], list[str]]": author='Felipe Zapata & Ivan Infante', author_email='f.zapata@esciencecenter.nl', keywords='chemistry Photochemistry Simulation', - long_description=readme() + '\n\n', + long_description=get_readme() + '\n\n', long_description_content_type='text/x-rst', packages=find_packages(exclude=["test"]), classifiers=[