diff --git a/.flake8 b/.flake8 new file mode 100644 index 000000000..15db9adfd --- /dev/null +++ b/.flake8 @@ -0,0 +1,43 @@ +# Configure flake8 + +[flake8] +max-line-length = 88 +max-doc-length = 79 +ignore = + # Too many leading '#' for block comment + E266, + # Line too long (82 > 79 characters) + E501, + # Do not use variables named 'I', 'O', or 'l' + E741, + # Line break before binary operator (conflicts with black) + W503, + # Ignore spaces before a colon (Black handles it) + E203, +exclude = + .git, + __pycache__, + .ipynb_checkpoints, +per-file-ignores = + # disable unused-imports errors on __init__.py + __init__.py: F401 + +# Configure flake8-rst-docstrings +# ------------------------------- +# Add some roles used in our docstrings +rst-roles = + class, + func, + mod, + meth, + ref, +# Add some directives used in our docstrings +rst-directives = + pyvista-plot, +# Ignore "Unknown target name" raised on citations +extend-ignore = RST306 + +# Configure flake8-functions +# -------------------------- +# Allow a max of 10 arguments per function +max-parameters-amount = 10 diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 2a031efcf..e62f8fcaa 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -77,7 +77,7 @@ jobs: - name: Collect requirements run: | echo "Install Dependente to capture dependencies:" - mamba install dependente==0.1.0 -c conda-forge + mamba install dependente==0.3.0 -c conda-forge echo "" echo "Capturing run-time dependencies:" dependente --source install > requirements-full.txt diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index f39e6e8d8..ee0ad349b 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -90,7 +90,7 @@ jobs: - name: Collect requirements run: | echo "Install Dependente to capture dependencies:" - python -m pip install dependente==0.1.0 + python -m pip install dependente==0.3.0 echo "" echo "Capturing run-time dependencies:" if [[ "${{ matrix.dependencies }}" == "oldest" ]]; then diff --git a/.gitignore b/.gitignore index dc74ac933..cbd6559f4 100644 --- a/.gitignore +++ b/.gitignore @@ -17,4 +17,4 @@ doc/sample_data MANIFEST dask-worker-space .coverage.* -harmonica/_version_generated.py +harmonica/_version.py diff --git a/harmonica/__init__.py b/harmonica/__init__.py index 97de1f8b5..6b0ab3c7d 100644 --- a/harmonica/__init__.py +++ b/harmonica/__init__.py @@ -32,6 +32,9 @@ from ._utils import magnetic_angles_to_vec, magnetic_vec_to_angles from ._version import __version__ +# Append a leading "v" to the generated version by setuptools_scm +__version__ = f"v{__version__}" + def test(doctest=True, verbose=True, coverage=False, figures=False): """ diff --git a/harmonica/_version.py b/harmonica/_version.py deleted file mode 100644 index eea22ba87..000000000 --- a/harmonica/_version.py +++ /dev/null @@ -1,14 +0,0 @@ -# Copyright (c) 2018 The Harmonica Developers. -# Distributed under the terms of the BSD 3-Clause License. -# SPDX-License-Identifier: BSD-3-Clause -# -# This code is part of the Fatiando a Terra project (https://www.fatiando.org) -# -""" -Define the __version__ variable as the version number with leading "v" -""" -# This file is generated automatically by setuptools_scm -from ._version_generated import version - -# Add a "v" to the version number -__version__ = f"v{version}" diff --git a/pyproject.toml b/pyproject.toml index edf1519ec..001af6c0c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,13 +1,55 @@ -# Specify that we use setuptools and setuptools_scm (to generate the version -# string). Actual configuration is in setup.py and setup.cfg. [build-system] -requires = ["setuptools>=45", "wheel", "setuptools_scm[toml]>=6.2"] +requires = ["setuptools>=61", "wheel", "setuptools_scm[toml]>=8.0.3"] build-backend = "setuptools.build_meta" +[project] +name = "harmonica" +description = "Forward modeling, inversion, and processing gravity and magnetic data" +dynamic = ["version"] +authors = [ + { name="The Harmonica Developers", email="fatiandoaterra@protonmail.com" }, +] +maintainers = [ + {name = "Santiago Soler", email = "santisoler@fastmail.com"} +] +readme = "README.md" +requires-python = ">=3.8" +license = {file = "LICENSE.txt"} +keywords = ["geoscience", "geophysics"] +classifiers = [ + "Programming Language :: Python :: 3", + "License :: OSI Approved :: MIT License", + "Operating System :: OS Independent", +] +dependencies = [ + "numpy >= 1.21", + "pandas >= 1.1", + "scipy >= 1.5", + "scikit-learn >= 0.24", + "numba >= 0.52", + "xarray >= 0.16", + "verde >= 1.7", + "xrft >= 1.0", + "choclo >= 0.1", +] + +[project.urls] +"Homepage" = "https://www.fatiando.org/harmonica" +"Documentation" = "https://www.fatiando.org/harmonica" +"Repository" = "https://github.com/fatiando/harmonica.git" +"Changelog" = "https://www.fatiando.org/harmonica/latest/changes.html" +"Bug Tracker" = "https://github.com/fatiando/harmonica/issues" +"Source Code" = "https://github.com/fatiando/harmonica" +"Release Notes" = "https://github.com/fatiando/harmonica/releases" + +[project.optional-dependencies] +visualizations = ["pyvista>=0.27", "vtk>=9"] +numba_progress = ["numba_progress"] + [tool.setuptools_scm] -version_scheme = "post-release" -local_scheme = "node-and-date" -write_to = "harmonica/_version_generated.py" +version_scheme = "post-release" +local_scheme = "node-and-date" +version_file = "harmonica/_version.py" [tool.pytest.ini_options] doctest_optionflags = "NUMBER" diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index 0dad585ad..000000000 --- a/setup.cfg +++ /dev/null @@ -1,104 +0,0 @@ -[metadata] -name = harmonica -fullname = Harmonica -description = "Forward modeling, inversion, and processing gravity and magnetic data" -long_description = file: README.md -long_description_content_type = text/markdown -author = The Harmonica Developers -author_email = fatiandoaterra@protonmail.com -maintainer = "Santiago Soler" -maintainer_email = santiago.r.soler@gmail.com -license = BSD 3-Clause License -license_file = LICENSE.txt -platform = any -keywords = geoscience, geophysics -classifiers = - Development Status :: 5 - Production/Stable - Intended Audience :: Science/Research - Intended Audience :: Developers - Intended Audience :: Education - License :: OSI Approved :: BSD License - Natural Language :: English - Operating System :: OS Independent - Topic :: Scientific/Engineering - Topic :: Software Development :: Libraries - 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 -url = https://github.com/fatiando/harmonica -project_urls = - Documentation = https://www.fatiando.org/harmonica - Release Notes = https://github.com/fatiando/harmonica/releases - Bug Tracker = https://github.com/fatiando/harmonica/issues - Source Code = https://github.com/fatiando/harmonica - -[options] -zip_safe = True -include_package_data = True -packages = find: -python_requires = >=3.8 -install_requires = - numpy>=1.21 - pandas>=1.1 - scipy>=1.5 - scikit-learn>=0.24 - numba>=0.52 - xarray>=0.16 - verde>=1.7 - xrft>=1.0 - choclo>=0.1 - -[options.extras_require] -visualizations = - pyvista>=0.27 - vtk>=9 -numba_progress = - numba_progress - -[options.package_data] -harmonica.tests = data/*, baseline/* -harmonica.datasets = registry.txt - -[flake8] -max-line-length = 88 -max-doc-length = 79 -ignore = - # Too many leading '#' for block comment - E266, - # Line too long (82 > 79 characters) - E501, - # Do not use variables named 'I', 'O', or 'l' - E741, - # Line break before binary operator (conflicts with black) - W503, - # Ignore spaces before a colon (Black handles it) - E203, -exclude = - .git, - __pycache__, - .ipynb_checkpoints, -per-file-ignores = - # disable unused-imports errors on __init__.py - __init__.py: F401 - -# Configure flake8-rst-docstrings -# ------------------------------- -# Add some roles used in our docstrings -rst-roles = - class, - func, - mod, - meth, - ref, -# Add some directives used in our docstrings -rst-directives = - pyvista-plot, -# Ignore "Unknown target name" raised on citations -extend-ignore = RST306 - -# Configure flake8-functions -# -------------------------- -# Allow a max of 10 arguments per function -max-parameters-amount = 10 diff --git a/setup.py b/setup.py deleted file mode 100644 index a275f1301..000000000 --- a/setup.py +++ /dev/null @@ -1,15 +0,0 @@ -# Copyright (c) 2018 The Harmonica Developers. -# Distributed under the terms of the BSD 3-Clause License. -# SPDX-License-Identifier: BSD-3-Clause -# -# This code is part of the Fatiando a Terra project (https://www.fatiando.org) -# -""" -Setup script for the Python package. -Metadata and build configuration are defined in setup.cfg -Uses setuptools-scm to manage version numbers using git tags. -""" -from setuptools import setup - -if __name__ == "__main__": - setup()