diff --git a/.coveragerc b/.coveragerc deleted file mode 100644 index b9a7622..0000000 --- a/.coveragerc +++ /dev/null @@ -1,11 +0,0 @@ -[run] -source = anaflow -omit = *docs*, *examples*, *tests* - -[report] -exclude_lines = - pragma: no cover - if __name__ == '__main__': - def __repr__ - def __str__ - diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 1f097b3..95b8db8 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -18,6 +18,32 @@ env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} jobs: + source_check: + name: source check + runs-on: ubuntu-latest + strategy: + fail-fast: false + + steps: + - uses: actions/checkout@v2 + + - name: Set up Python 3.8 + uses: actions\setup-python@v2 + with: + python-version: 3.8 + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install black #pylint + pip install --editable . + - name: black check + run: | + python -m black --check . + # - name: pylint check + # run: | + # python -m pylint anaflow/ + build_sdist: name: sdist on ${{ matrix.os }} with py ${{ matrix.python-version }} runs-on: ${{ matrix.os }} @@ -25,7 +51,7 @@ jobs: fail-fast: false matrix: os: [ubuntu-latest, windows-latest, macos-latest] - python-version: [3.5, 3.6, 3.7, 3.8, 3.9] + python-version: [3.6, 3.7, 3.8, 3.9] steps: - uses: actions/checkout@v2 @@ -40,21 +66,18 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - pip install -U wheel - pip install -r requirements_setup.txt - pip install -r requirements.txt - pip install -r requirements_test.txt - pip install coveralls>=3.0.0 - - - name: Build sdist - run: | - python setup.py sdist --formats=gztar bdist_wheel -d dist + pip install build coveralls>=3.0.0 + pip install --editable .[test] - name: Run tests run: | python -m pytest --cov anaflow --cov-report term-missing -v tests/ python -m coveralls --service=github + - name: Build sdist + run: | + python -m build + - uses: actions/upload-artifact@v2 if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.9' with: @@ -73,7 +96,7 @@ jobs: - name: Publish to Test PyPI # only if working on develop if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/develop' - uses: pypa/gh-action-pypi-publish@master + uses: pypa/gh-action-pypi-publish@release/v1 with: user: __token__ password: ${{ secrets.test_pypi_password }} @@ -83,7 +106,7 @@ jobs: - name: Publish to PyPI # only if tagged if: startsWith(github.ref, 'refs/tags') - uses: pypa/gh-action-pypi-publish@master + uses: pypa/gh-action-pypi-publish@release/v1 with: user: __token__ password: ${{ secrets.pypi_password }} diff --git a/.readthedocs.yml b/.readthedocs.yml new file mode 100644 index 0000000..f88c11a --- /dev/null +++ b/.readthedocs.yml @@ -0,0 +1,14 @@ +version: 2 + +sphinx: + configuration: docs/source/conf.py + +formats: all + +python: + version: 3.7 + install: + - method: pip + path: . + extra_requirements: + - doc diff --git a/MANIFEST.in b/MANIFEST.in index 6b39b13..ffe9e94 100755 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,9 +1,6 @@ -include README.md -include MANIFEST.in -include setup.py -include setup.cfg -recursive-include anaflow *.py -recursive-include tests *.py -recursive-include docs/source * -include docs/Makefile docs/requirements.txt -include LICENSE +prune * +graft anaflow +graft tests + +include LICENSE README.md pyproject.toml setup.cfg +global-exclude __pycache__ *.py[cod] .* diff --git a/anaflow/flow/ext_grf_model.py b/anaflow/flow/ext_grf_model.py index 7a4b91c..3285539 100644 --- a/anaflow/flow/ext_grf_model.py +++ b/anaflow/flow/ext_grf_model.py @@ -123,7 +123,7 @@ def ext_grf_steady( rate=-1e-4, h_ref=0.0, arg_dict=None, - **kwargs + **kwargs, ): """ The extended "General radial flow" model for steady flow. diff --git a/anaflow/tools/mean.py b/anaflow/tools/mean.py index b396084..3b671ce 100644 --- a/anaflow/tools/mean.py +++ b/anaflow/tools/mean.py @@ -192,7 +192,7 @@ def annular_amean(func, val_arr, ann_dim=2, arg_dict=None, **kwargs): f_inv=lambda x: x, ann_dim=ann_dim, arg_dict=arg_dict, - **kwargs + **kwargs, ) @@ -260,7 +260,7 @@ def annular_gmean(func, val_arr, ann_dim=2, arg_dict=None, **kwargs): f_inv=np.exp, ann_dim=ann_dim, arg_dict=arg_dict, - **kwargs + **kwargs, ) @@ -322,7 +322,7 @@ def annular_hmean(func, val_arr, ann_dim=2, arg_dict=None, **kwargs): f_inv=lambda x: 1.0 / x, ann_dim=ann_dim, arg_dict=arg_dict, - **kwargs + **kwargs, ) @@ -392,5 +392,5 @@ def annular_pmean(func, val_arr, p=2.0, ann_dim=2, arg_dict=None, **kwargs): f_inv=lambda x: np.power(x, 1.0 / p), ann_dim=ann_dim, arg_dict=arg_dict, - **kwargs + **kwargs, ) diff --git a/docs/requirements.txt b/docs/requirements.txt deleted file mode 100644 index c5a6a23..0000000 --- a/docs/requirements.txt +++ /dev/null @@ -1,3 +0,0 @@ --r requirements_doc.txt --r ../requirements_setup.txt --r ../requirements.txt diff --git a/docs/requirements_doc.txt b/docs/requirements_doc.txt deleted file mode 100755 index a2954e3..0000000 --- a/docs/requirements_doc.txt +++ /dev/null @@ -1 +0,0 @@ -numpydoc diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..1972ced --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,65 @@ +[build-system] +requires = [ + "setuptools>=42", + "wheel", + "setuptools_scm[toml]>=3.5", +] +build-backend = "setuptools.build_meta" + +[tool.setuptools_scm] +write_to = "anaflow/_version.py" +write_to_template = "__version__ = '{version}'" +local_scheme = "no-local-version" +fallback_version = "0.0.0.dev0" + +[tool.black] +exclude = """ +^/( ( examples ) /| anaflow/_version.py ) +""" +line-length = 79 +target-version = [ + "py36", + "py37", + "py38", +] + +[tool.coverage] + [tool.coverage.run] + source = ["anaflow"] + omit = [ + "*docs*", + "*examples*", + "*tests*", + ] + + [tool.coverage.report] + exclude_lines = [ + "pragma: no cover", + "if __name__ == '__main__':", + "def __repr__", + "def __str__", + ] + +[tool.pylint] + [tool.pylint.master] + extension-pkg-whitelist = [ + "numpy", + "scipy", + ] + ignore = "_version.py" + + [tool.pylint.message_control] + disable = [ + "R0801", + ] + + [tool.pylint.reports] + output-format = "colorized" + + [tool.pylint.design] + max-args = 20 + max-locals = 50 + max-branches = 30 + max-statements = 80 + max-attributes = 25 + max-public-methods = 75 diff --git a/requirements.txt b/requirements.txt deleted file mode 100755 index 42aca73..0000000 --- a/requirements.txt +++ /dev/null @@ -1,3 +0,0 @@ -numpy>=1.14.5 -scipy>=1.1.0 -pentapy>=1.1.0 diff --git a/requirements_setup.txt b/requirements_setup.txt deleted file mode 100755 index 80e9200..0000000 --- a/requirements_setup.txt +++ /dev/null @@ -1,2 +0,0 @@ -setuptools>=41.0.1 -setuptools_scm>=3.5.0 diff --git a/requirements_test.txt b/requirements_test.txt deleted file mode 100755 index be10813..0000000 --- a/requirements_test.txt +++ /dev/null @@ -1,2 +0,0 @@ -pytest-cov>=2.8.0 -pytest>=5.3.0 diff --git a/setup.cfg b/setup.cfg index f48fdad..ba29793 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,3 +1,67 @@ [metadata] -description-file = README.md +name = anaflow +description = AnaFlow - analytical solutions for the groundwater-flow equation. +long_description = file: README.md +long_description_content_type = text/markdown +url = https://github.com/GeoStat-Framework/AnaFlow +author = Sebastian Mueller +author_email = sebastian.mueller@ufz.de +maintainer = Sebastian Mueller +maintainer_email = sebastian.mueller@ufz.de +license = MIT license_file = LICENSE +platforms = any +classifiers = + Development Status :: 5 - Production/Stable + Intended Audience :: Developers + Intended Audience :: End Users/Desktop + Intended Audience :: Science/Research + License :: OSI Approved :: MIT License + Natural Language :: English + Operating System :: MacOS + Operating System :: MacOS :: MacOS X + Operating System :: Microsoft + Operating System :: Microsoft :: Windows + Operating System :: POSIX + Operating System :: Unix + Programming Language :: Python + Programming Language :: Python :: 3 + Programming Language :: Python :: 3 :: Only + Programming Language :: Python :: 3.6 + Programming Language :: Python :: 3.7 + Programming Language :: Python :: 3.8 + Programming Language :: Python :: 3.9 + Topic :: Scientific/Engineering + Topic :: Software Development + Topic :: Utilities +project_urls = + Documentation = https://anaflow.readthedocs.io + Source = https://github.com/GeoStat-Framework/anaflow + Tracker = https://github.com/GeoStat-Framework/anaflow/issues + Changelog = https://github.com/GeoStat-Framework/anaflow/blob/develop/CHANGELOG.md + Conda-Forge = https://anaconda.org/conda-forge/anaflow + +[options] +packages = find: +install_requires = + numpy>=1.14.5,<2 + pentapy>=1.1.0,<2 + scipy>=1.1.0,<2 +python_requires = >=3.6 +zip_safe = False + +[options.packages.find] +exclude = + tests* + docs* + +[options.extras_require] +doc = + numpydoc>=1.1 + sphinx>=3 + sphinx-gallery>=0.8 + sphinx-rtd-theme>=0.5 +test = + coverage[toml]>=5.2.1 + pytest>=6.0 + pytest-cov>=2.11.0 diff --git a/setup.py b/setup.py deleted file mode 100644 index f737183..0000000 --- a/setup.py +++ /dev/null @@ -1,73 +0,0 @@ -# -*- coding: utf-8 -*- -"""AnaFlow - analytical solutions for the groundwater-flow equation.""" - -import os -from setuptools import setup, find_packages - - -HERE = os.path.abspath(os.path.dirname(__file__)) - -with open(os.path.join(HERE, "README.md"), encoding="utf-8") as f: - README = f.read() -with open(os.path.join(HERE, "requirements.txt"), encoding="utf-8") as f: - REQ = f.read().splitlines() -with open(os.path.join(HERE, "requirements_setup.txt"), encoding="utf-8") as f: - REQ_SETUP = f.read().splitlines() -with open(os.path.join(HERE, "requirements_test.txt"), encoding="utf-8") as f: - REQ_TEST = f.read().splitlines() -with open( - os.path.join(HERE, "docs", "requirements_doc.txt"), encoding="utf-8" -) as f: - REQ_DOC = f.read().splitlines() - -REQ_DEV = REQ_SETUP + REQ_TEST + REQ_DOC - -DOCLINE = __doc__.split("\n")[0] -CLASSIFIERS = [ - "Development Status :: 5 - Production/Stable", - "Intended Audience :: Developers", - "Intended Audience :: End Users/Desktop", - "Intended Audience :: Science/Research", - "License :: OSI Approved :: MIT License", - "Natural Language :: English", - "Operating System :: MacOS", - "Operating System :: MacOS :: MacOS X", - "Operating System :: Microsoft", - "Operating System :: Microsoft :: Windows", - "Operating System :: POSIX", - "Operating System :: Unix", - "Programming Language :: Python", - "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3 :: Only", - "Topic :: Scientific/Engineering", - "Topic :: Software Development", - "Topic :: Utilities", -] - -setup( - name="anaflow", - description=DOCLINE, - long_description=README, - long_description_content_type="text/markdown", - maintainer="Sebastian Mueller", - maintainer_email="sebastian.mueller@ufz.de", - author="Sebastian Mueller", - author_email="sebastian.mueller@ufz.de", - url="https://github.com/GeoStat-Framework/AnaFlow", - license="MIT", - classifiers=CLASSIFIERS, - platforms=["Windows", "Linux", "Mac OS-X"], - include_package_data=True, - python_requires=">=3.5", - use_scm_version={ - "relative_to": __file__, - "write_to": "anaflow/_version.py", - "write_to_template": "__version__ = '{version}'", - "local_scheme": "no-local-version", - "fallback_version": "0.0.0.dev0", - }, - install_requires=REQ, - setup_requires=REQ_SETUP, - extras_require={"doc": REQ_DOC, "test": REQ_TEST, "dev": REQ_DEV}, - packages=find_packages(exclude=["tests*", "docs*"]), -)