From 107b554cefe32e65932749478d4fc54483bded40 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20M=C3=BCller?= Date: Tue, 6 Apr 2021 15:19:07 +0200 Subject: [PATCH 01/28] Setup: update test req --- requirements_test.txt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/requirements_test.txt b/requirements_test.txt index be10813ec..f515e1cad 100755 --- a/requirements_test.txt +++ b/requirements_test.txt @@ -1,2 +1,3 @@ -pytest-cov>=2.8.0 -pytest>=5.3.0 +pytest>=6.0 +coverage[toml]>=5.2.1 +pytest-cov>=2.11.0 \ No newline at end of file From 22324f65a81cba1cb59a98217d088cb868ca4451 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20M=C3=BCller?= Date: Tue, 6 Apr 2021 15:22:48 +0200 Subject: [PATCH 02/28] Setup: remove cfg redundant setup.cfg --- setup.cfg | 3 --- 1 file changed, 3 deletions(-) delete mode 100644 setup.cfg diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index f48fdadb8..000000000 --- a/setup.cfg +++ /dev/null @@ -1,3 +0,0 @@ -[metadata] -description-file = README.md -license_file = LICENSE From d550b22ad1c03e9d81462434f2163333f601d3e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20M=C3=BCller?= Date: Tue, 6 Apr 2021 15:44:55 +0200 Subject: [PATCH 03/28] Setup: add pyproject.toml: move setup req there, config black there, move converage config there --- .coveragerc | 10 ---------- examples/08_geo_coordinates/01_dwd_krige.py | 4 ++-- pyproject.toml | 14 ++++++++++++++ setup.py | 7 ++----- 4 files changed, 18 insertions(+), 17 deletions(-) delete mode 100644 .coveragerc create mode 100644 pyproject.toml diff --git a/.coveragerc b/.coveragerc deleted file mode 100644 index 232c70dea..000000000 --- a/.coveragerc +++ /dev/null @@ -1,10 +0,0 @@ -[run] -source = gstools -omit = *docs*, *examples*, *tests*, */gstools/covmodel/plot.py, */gstools/field/plot.py - -[report] -exclude_lines = - pragma: no cover - if __name__ == '__main__': - def __repr__ - def __str__ diff --git a/examples/08_geo_coordinates/01_dwd_krige.py b/examples/08_geo_coordinates/01_dwd_krige.py index e1f789176..bac4b31cb 100755 --- a/examples/08_geo_coordinates/01_dwd_krige.py +++ b/examples/08_geo_coordinates/01_dwd_krige.py @@ -44,14 +44,14 @@ def get_dwd_temperature(date="2020-06-09 12:00:00"): sites = obs.DWDObservationStations( parameter_set=obs.DWDObservationParameterSet.TEMPERATURE_AIR, period=obs.DWDObservationPeriod.RECENT, - **settings + **settings, ) ids, lat, lon = sites.all().loc[:, ["STATION_ID", "LAT", "LON"]].values.T observations = obs.DWDObservationData( station_ids=ids, parameters=obs.DWDObservationParameter.HOURLY.TEMPERATURE_AIR_200, periods=obs.DWDObservationPeriod.RECENT, - **settings + **settings, ) temp = observations.all().VALUE.values sel = np.isfinite(temp) diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 000000000..e69ca0df7 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,14 @@ +[build-system] +requires = ["setuptools>=42", "wheel", "setuptools_scm[toml]>=3.5", "numpy>=1.14.5,<2.0", "Cython>=0.28.3,<3.0"] +build-backend = "setuptools.build_meta" + +[tool.coverage.run] +source = ["gstools"] +omit = ["*docs*", "*examples*", "*tests*", "*/gstools/covmodel/plot.py", "*/gstools/field/plot.py"] + +[tool.coverage.report] +exclude_lines = ["pragma: no cover", "def __repr__", "def __str__"] + +[tool.black] +line-length = 79 +target-version = ["py36", "py37", "py38"] diff --git a/setup.py b/setup.py index 9c0d6a769..331f2218c 100644 --- a/setup.py +++ b/setup.py @@ -194,8 +194,6 @@ class MPDistribution(Distribution): 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( @@ -203,7 +201,7 @@ class MPDistribution(Distribution): ) as f: REQ_DOC = f.read().splitlines() -REQ_DEV = REQ_SETUP + REQ_TEST + REQ_DOC +REQ_DEV = REQ_TEST + REQ_DOC DOCLINE = __doc__.split("\n")[0] CLASSIFIERS = [ @@ -227,6 +225,7 @@ class MPDistribution(Distribution): setup( name="gstools", + license_files=("LICENSE",), description=DOCLINE, long_description=README, long_description_content_type="text/markdown", @@ -238,7 +237,6 @@ class MPDistribution(Distribution): license="LGPLv3", classifiers=CLASSIFIERS, platforms=["Windows", "Linux", "Solaris", "Mac OS-X", "Unix"], - include_package_data=True, python_requires=">=3.6", use_scm_version={ "relative_to": __file__, @@ -247,7 +245,6 @@ class MPDistribution(Distribution): "local_scheme": "no-local-version", "fallback_version": "0.0.0.dev0", }, - setup_requires=REQ_SETUP, install_requires=REQ, extras_require={ "plotting": ["pyvista", "matplotlib"], From c6e744f33909c57e308e074cc057c0ced80142da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20M=C3=BCller?= Date: Tue, 6 Apr 2021 15:45:50 +0200 Subject: [PATCH 04/28] Setup: update manifest --- MANIFEST.in | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/MANIFEST.in b/MANIFEST.in index 2f67477f9..55cf454f8 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,9 +1,11 @@ include README.md -include MANIFEST.in include setup.py -include setup.cfg -recursive-include gstools *.py *.pyx *.c +recursive-include gstools *.py *.pyx +recursive-exclude gstools *.c *.cpp recursive-include tests *.py recursive-include docs/source * include docs/Makefile docs/requirements.txt include LICENSE +recursive-exclude .github * +exclude .gitignore +exclude .zenodo.json \ No newline at end of file From 1829d49ef4f0c0b72490d09ad74e2a094579077f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20M=C3=BCller?= Date: Tue, 6 Apr 2021 17:10:14 +0200 Subject: [PATCH 05/28] Setup: MANIFEST.in from scikit-hep.org --- MANIFEST.in | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/MANIFEST.in b/MANIFEST.in index 55cf454f8..8805ec4c7 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,11 +1,7 @@ -include README.md -include setup.py -recursive-include gstools *.py *.pyx +prune * +graft gstools +graft tests +graft docs recursive-exclude gstools *.c *.cpp -recursive-include tests *.py -recursive-include docs/source * -include docs/Makefile docs/requirements.txt -include LICENSE -recursive-exclude .github * -exclude .gitignore -exclude .zenodo.json \ No newline at end of file +include LICENSE README.md pyproject.toml setup.py +global-exclude __pycache__ *.py[cod] .* From 65a539d7bb34b4ed15ef2dad2689bf0a1384178f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20M=C3=BCller?= Date: Tue, 6 Apr 2021 17:11:01 +0200 Subject: [PATCH 06/28] Setup: specify rtd config and use pip there to install gstools --- .readthedocs.yml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 .readthedocs.yml diff --git a/.readthedocs.yml b/.readthedocs.yml new file mode 100644 index 000000000..ae9601d51 --- /dev/null +++ b/.readthedocs.yml @@ -0,0 +1,15 @@ +version: 2 + +formats: all + +sphinx: + builder: html + configuration: docs/source/conf.py +u +python: + version: 3.7 + install: + - method: pip + path: . + extra_requirements: + - doc From cac8c4ea0af6c8bdbfca993d1a0accae9417489a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20M=C3=BCller?= Date: Tue, 6 Apr 2021 17:11:58 +0200 Subject: [PATCH 07/28] Setup: reformat pyproject.toml --- pyproject.toml | 28 ++++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index e69ca0df7..e77e28142 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,14 +1,34 @@ [build-system] -requires = ["setuptools>=42", "wheel", "setuptools_scm[toml]>=3.5", "numpy>=1.14.5,<2.0", "Cython>=0.28.3,<3.0"] +requires = [ + "setuptools>=42", + "wheel", + "setuptools_scm[toml]>=3.5", + "numpy>=1.14.5,<2.0", + "Cython>=0.28.3,<3.0", +] build-backend = "setuptools.build_meta" [tool.coverage.run] source = ["gstools"] -omit = ["*docs*", "*examples*", "*tests*", "*/gstools/covmodel/plot.py", "*/gstools/field/plot.py"] +omit = [ + "*docs*", + "*examples*", + "*tests*", + "*/gstools/covmodel/plot.py", + "*/gstools/field/plot.py", +] [tool.coverage.report] -exclude_lines = ["pragma: no cover", "def __repr__", "def __str__"] +exclude_lines = [ + "pragma: no cover", + "def __repr__", + "def __str__", +] [tool.black] line-length = 79 -target-version = ["py36", "py37", "py38"] +target-version = [ + "py36", + "py37", + "py38", +] From 04fda382134d65ea9c71f42877aef7ca5c3becd2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20M=C3=BCller?= Date: Tue, 6 Apr 2021 17:12:21 +0200 Subject: [PATCH 08/28] Setup: rework usage of req. files --- .github/workflows/main.yml | 6 ++---- docs/requirements.txt | 10 +++++++--- docs/requirements_doc.txt | 7 ------- requirements_setup.txt | 4 ---- setup.py | 2 +- 5 files changed, 10 insertions(+), 19 deletions(-) delete mode 100755 docs/requirements_doc.txt delete mode 100755 requirements_setup.txt diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 65b8ab6f1..101accb75 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -63,15 +63,13 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - pip install -r requirements_setup.txt - pip install -r requirements.txt - pip install -r requirements_test.txt pip install coveralls>=3.0.0 + pip install .[test] + pip install -I --no-deps --global-option="--openmp" . - name: Build sdist run: | python setup.py sdist -d dist - python setup.py --openmp build_ext --inplace - name: Run tests env: diff --git a/docs/requirements.txt b/docs/requirements.txt index c5a6a232c..9bb751acc 100644 --- a/docs/requirements.txt +++ b/docs/requirements.txt @@ -1,3 +1,7 @@ --r requirements_doc.txt --r ../requirements_setup.txt --r ../requirements.txt +numpydoc +sphinx-gallery +matplotlib +pyvista +pykrige +meshzoo +m2r2 diff --git a/docs/requirements_doc.txt b/docs/requirements_doc.txt deleted file mode 100755 index 9bb751acc..000000000 --- a/docs/requirements_doc.txt +++ /dev/null @@ -1,7 +0,0 @@ -numpydoc -sphinx-gallery -matplotlib -pyvista -pykrige -meshzoo -m2r2 diff --git a/requirements_setup.txt b/requirements_setup.txt deleted file mode 100755 index 7f373eac5..000000000 --- a/requirements_setup.txt +++ /dev/null @@ -1,4 +0,0 @@ -setuptools>=41.0.1 -setuptools_scm>=3.5.0 -cython>=0.28.3 -numpy>=1.14.5 diff --git a/setup.py b/setup.py index 331f2218c..af78f36e8 100644 --- a/setup.py +++ b/setup.py @@ -197,7 +197,7 @@ class MPDistribution(Distribution): 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" + os.path.join(HERE, "docs", "requirements.txt"), encoding="utf-8" ) as f: REQ_DOC = f.read().splitlines() From 6170735ef1971b7618f14ac85501744cfd1c781c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20M=C3=BCller?= Date: Tue, 6 Apr 2021 17:45:16 +0200 Subject: [PATCH 09/28] Setup: remove the openmp arg hack and use an env-var --- .github/workflows/main.yml | 13 +++++++------ setup.py | 19 ++++--------------- 2 files changed, 11 insertions(+), 21 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 101accb75..bd1a0384e 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -61,15 +61,12 @@ jobs: python-version: ${{ matrix.python-version }} - name: Install dependencies + env: + GSTOOLS_BUILD_PARALLEL: 1 run: | python -m pip install --upgrade pip pip install coveralls>=3.0.0 - pip install .[test] - pip install -I --no-deps --global-option="--openmp" . - - - name: Build sdist - run: | - python setup.py sdist -d dist + pip install --verbose --no-build-isolation .[test] - name: Run tests env: @@ -78,6 +75,10 @@ jobs: python -m pytest --cov gstools --cov-report term-missing -v tests/ python -m coveralls --service=github + - name: Build sdist + run: | + python setup.py sdist -d dist + - uses: actions/upload-artifact@v2 if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.9' with: diff --git a/setup.py b/setup.py index af78f36e8..1606f226b 100644 --- a/setup.py +++ b/setup.py @@ -10,7 +10,7 @@ from distutils.ccompiler import new_compiler from distutils.sysconfig import customize_compiler -from setuptools import setup, find_packages, Distribution, Extension +from setuptools import setup, find_packages, Extension from Cython.Build import cythonize import numpy as np @@ -120,7 +120,9 @@ def check_openmp_support(): # openmp ###################################################################### -USE_OPENMP = bool("--openmp" in sys.argv) +# you can set GSTOOLS_BUILD_PARALLEL=0 or GSTOOLS_BUILD_PARALLEL=1 +GS_PARALLEL = os.getenv("GSTOOLS_BUILD_PARALLEL") +USE_OPENMP = bool(int(GS_PARALLEL)) if GS_PARALLEL else False if USE_OPENMP: # just check if wanted @@ -135,18 +137,6 @@ def check_openmp_support(): FLAGS = [] -# add the "--openmp" to the global options -# enables calles like: -# python3 setup.py --openmp build_ext --inplace -# pip install --global-option="--openmp" gstools -class MPDistribution(Distribution): - """Distribution with --openmp as global option.""" - - global_options = Distribution.global_options + [ - ("openmp", None, "Flag to use openmp in the build") - ] - - # cython extensions ########################################################### @@ -255,5 +245,4 @@ class MPDistribution(Distribution): packages=find_packages(exclude=["tests*", "docs*"]), ext_modules=EXT_MODULES, include_dirs=[np.get_include()], - distclass=MPDistribution, ) From dd880461fc58be37a870d967d223d0203a04830b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20M=C3=BCller?= Date: Tue, 6 Apr 2021 18:04:06 +0200 Subject: [PATCH 10/28] Setup: reuse req file for sdist creation for now --- .github/workflows/main.yml | 5 ++++- requirements_setup.txt | 5 +++++ 2 files changed, 9 insertions(+), 1 deletion(-) create mode 100644 requirements_setup.txt diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index bd1a0384e..2f2dfbe14 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -66,7 +66,10 @@ jobs: run: | python -m pip install --upgrade pip pip install coveralls>=3.0.0 - pip install --verbose --no-build-isolation .[test] + # needed for now, since sdist needs requirements defined in pyporject.toml + # pip uses isolated builds, where cython is not present afterwards + pip install -r requirements_setup.txt + pip install --verbose .[test] - name: Run tests env: diff --git a/requirements_setup.txt b/requirements_setup.txt new file mode 100644 index 000000000..c05032b77 --- /dev/null +++ b/requirements_setup.txt @@ -0,0 +1,5 @@ +setuptools>=42 +wheel +setuptools_scm[toml]>=3.5 +numpy>=1.14.5,<2.0 +Cython>=0.28.3,<3.0 From 37923268a35c9beccc1b5ff4a25036057edd4ee3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20M=C3=BCller?= Date: Tue, 6 Apr 2021 18:06:51 +0200 Subject: [PATCH 11/28] Setup: RTD config typo --- .readthedocs.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.readthedocs.yml b/.readthedocs.yml index ae9601d51..70bdd4733 100644 --- a/.readthedocs.yml +++ b/.readthedocs.yml @@ -5,7 +5,7 @@ formats: all sphinx: builder: html configuration: docs/source/conf.py -u + python: version: 3.7 install: From 09f66be164c42da7443485e63ec663db5175abba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20M=C3=BCller?= Date: Tue, 6 Apr 2021 18:21:09 +0200 Subject: [PATCH 12/28] Setup: editable build in CI to use local files for pytest --- .github/workflows/main.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 2f2dfbe14..5520a489a 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -68,8 +68,11 @@ jobs: pip install coveralls>=3.0.0 # needed for now, since sdist needs requirements defined in pyporject.toml # pip uses isolated builds, where cython is not present afterwards + # pep517 is not yet available: https://stackoverflow.com/a/63555237/6696397 pip install -r requirements_setup.txt - pip install --verbose .[test] + # no build isolation since requirements now installed + # editable to be compatible with pytest (inplace build) + pip install --verbose --no-build-isolation --editable .[test] - name: Run tests env: From 8afe4741d184de0552aed8176c59d51516e5f1da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20M=C3=BCller?= Date: Tue, 6 Apr 2021 22:01:07 +0200 Subject: [PATCH 13/28] Setup: pip in CI should be less verbose (dep-tree is spamming) --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 5520a489a..71923aa48 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -72,7 +72,7 @@ jobs: pip install -r requirements_setup.txt # no build isolation since requirements now installed # editable to be compatible with pytest (inplace build) - pip install --verbose --no-build-isolation --editable .[test] + pip install --no-build-isolation --editable .[test] - name: Run tests env: From 6d4bcbc27dfa926eee14b659f5133794a6e82ee6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20M=C3=BCller?= Date: Tue, 6 Apr 2021 22:01:53 +0200 Subject: [PATCH 14/28] Setup: RTD build added line-breaks (fix attempt) --- .readthedocs.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.readthedocs.yml b/.readthedocs.yml index 70bdd4733..f88c11ac0 100644 --- a/.readthedocs.yml +++ b/.readthedocs.yml @@ -1,11 +1,10 @@ version: 2 -formats: all - sphinx: - builder: html configuration: docs/source/conf.py +formats: all + python: version: 3.7 install: From b9b8e71a7a2ed318e4735bb62c78b7bf01e14e3f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20M=C3=BCller?= Date: Tue, 6 Apr 2021 22:02:22 +0200 Subject: [PATCH 15/28] Doc: add doc about new way to build parallel version --- docs/source/index.rst | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/docs/source/index.rst b/docs/source/index.rst index 763a01cea..bb06049af 100644 --- a/docs/source/index.rst +++ b/docs/source/index.rst @@ -61,24 +61,24 @@ To get the latest development version you can install it directly from GitHub: If something went wrong during installation, try the :code:`-I` `flag from pip `_. -To enable the OpenMP support, you have to provide a C compiler, Cython and OpenMP. -To get all other dependencies, it is recommended to first install gstools once -in the standard way just decribed. -Simply use the following commands: +To enable the OpenMP support, you have to provide a C compiler and OpenMP. +Parallel support is controlled by an environment variable ``GSTOOLS_BUILD_PARALLEL``, +that can be ``0`` or ``1`` (interpreted as ``0`` if not present). +GSTools then needs to be installed from source: .. code-block:: none - pip install gstools - pip install -I --no-deps --global-option="--openmp" gstools + export GSTOOLS_BUILD_PARALLEL=1 + pip install --no-binary=gstools gstools + +Note, that the ``--no-binary=gstools`` option forces pip to not use a wheel for GSTools. -Or for the development version: +For the development version, you can do almost the same: .. code-block:: none + export GSTOOLS_BUILD_PARALLEL=1 pip install git+git://github.com/GeoStat-Framework/GSTools.git@develop - pip install -I --no-deps --global-option="--openmp" git+git://github.com/GeoStat-Framework/GSTools.git@develop - -The flags :code:`-I --no-deps` force pip to reinstall gstools but not the dependencies. Citation From d9320e8a6eda4b88e6b3f4533f431ab255a2e9b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20M=C3=BCller?= Date: Tue, 6 Apr 2021 22:14:24 +0200 Subject: [PATCH 16/28] Setup: only include py and pyx files from gstools in sdist --- MANIFEST.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MANIFEST.in b/MANIFEST.in index 8805ec4c7..1d2bc731f 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,7 +1,7 @@ prune * -graft gstools graft tests graft docs +recursive-include gstools *.py *.pyx recursive-exclude gstools *.c *.cpp include LICENSE README.md pyproject.toml setup.py global-exclude __pycache__ *.py[cod] .* From 912efdea6186cdf561b0bafca88761139b9bbab9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20M=C3=BCller?= Date: Tue, 6 Apr 2021 22:20:26 +0200 Subject: [PATCH 17/28] Setup: RTD with system packages as before --- .readthedocs.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.readthedocs.yml b/.readthedocs.yml index f88c11ac0..434e25c7e 100644 --- a/.readthedocs.yml +++ b/.readthedocs.yml @@ -12,3 +12,4 @@ python: path: . extra_requirements: - doc + system_packages: true From 90c80e89a38e1008db8f045fa70f73397ae244e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20M=C3=BCller?= Date: Tue, 6 Apr 2021 22:58:48 +0200 Subject: [PATCH 18/28] Setup: RTD pin req versions --- .readthedocs.yml | 1 - docs/requirements.txt | 10 ++++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/.readthedocs.yml b/.readthedocs.yml index 434e25c7e..f88c11ac0 100644 --- a/.readthedocs.yml +++ b/.readthedocs.yml @@ -12,4 +12,3 @@ python: path: . extra_requirements: - doc - system_packages: true diff --git a/docs/requirements.txt b/docs/requirements.txt index 9bb751acc..6cdb19647 100644 --- a/docs/requirements.txt +++ b/docs/requirements.txt @@ -1,7 +1,9 @@ -numpydoc -sphinx-gallery -matplotlib +numpydoc>=1.1 +sphinx>=3 +sphinx-gallery>=0.8 +sphinx-rtd-theme>=0.5 +matplotlib>=3 +pykrige>=1.5 pyvista -pykrige meshzoo m2r2 From 1a20c1a464aab0cdf84d5d0588e30aa4498e87a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20M=C3=BCller?= Date: Tue, 6 Apr 2021 23:25:48 +0200 Subject: [PATCH 19/28] Setup: be more specific about req versions --- requirements.txt | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/requirements.txt b/requirements.txt index 0f47ca293..202f94dd4 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,6 +1,6 @@ -numpy>=1.14.5 -scipy>=1.1.0 -hankel>=1.0.2 -emcee>=3.0.0 -pyevtk>=1.1.1 -meshio>=4.0.3, <5.0 +numpy>=1.14.5,<2 +scipy>=1.1.0,<2 +hankel>=1.0.2,<2 +emcee>=3.0.0,<4 +pyevtk>=1.1.1,<2 +meshio>=4.0.3,<5.0 From dd541de064d29ec50224ecce599aaa37128d1a7c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20M=C3=BCller?= Date: Tue, 6 Apr 2021 23:26:23 +0200 Subject: [PATCH 20/28] Setup: explicitly install req for RTD --- .readthedocs.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.readthedocs.yml b/.readthedocs.yml index f88c11ac0..d89b03087 100644 --- a/.readthedocs.yml +++ b/.readthedocs.yml @@ -8,6 +8,7 @@ formats: all python: version: 3.7 install: + - requirements: docs/requirements.txt - method: pip path: . extra_requirements: From 165ec5379bdfca6dbecf0636f91b2adbdb946606 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20M=C3=BCller?= Date: Tue, 6 Apr 2021 23:26:52 +0200 Subject: [PATCH 21/28] Setup: use build req from pyproject.toml in CI with CIBW --- .github/workflows/main.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 71923aa48..acb737ce8 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -31,7 +31,6 @@ jobs: uses: joerick/cibuildwheel@v1.10.0 env: CIBW_BUILD: cp36-* cp37-* cp38-* cp39-* - CIBW_BEFORE_BUILD: pip install numpy==1.19.* cython==0.29.* setuptools CIBW_TEST_REQUIRES: pytest CIBW_TEST_COMMAND: pytest -v {project}/tests with: From c9baff5c41fec42e77f92074ded0ec46415b6660 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20M=C3=BCller?= Date: Tue, 6 Apr 2021 23:50:06 +0200 Subject: [PATCH 22/28] CI: test 'build' pypa package to build sdist --- .github/workflows/main.yml | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index acb737ce8..8553b463d 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -65,13 +65,16 @@ jobs: run: | python -m pip install --upgrade pip pip install coveralls>=3.0.0 + # PEP 517 package builder from pypa + pip install build # needed for now, since sdist needs requirements defined in pyporject.toml # pip uses isolated builds, where cython is not present afterwards # pep517 is not yet available: https://stackoverflow.com/a/63555237/6696397 - pip install -r requirements_setup.txt + # pip install -r requirements_setup.txt # no build isolation since requirements now installed # editable to be compatible with pytest (inplace build) - pip install --no-build-isolation --editable .[test] + # pip install --no-build-isolation --editable .[test] + pip install --editable .[test] - name: Run tests env: @@ -82,7 +85,8 @@ jobs: - name: Build sdist run: | - python setup.py sdist -d dist + # python setup.py sdist -d dist + python -m build --sdist --outdir dist . - uses: actions/upload-artifact@v2 if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.9' From f8b5b4a5197c0c4e7196ac96be8beb0b442a9f48 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20M=C3=BCller?= Date: Wed, 7 Apr 2021 00:08:42 +0200 Subject: [PATCH 23/28] Setup: yepp, use build for pep517 conform sdist builds --- .github/workflows/main.yml | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 8553b463d..cd56f9a71 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -64,16 +64,7 @@ jobs: GSTOOLS_BUILD_PARALLEL: 1 run: | python -m pip install --upgrade pip - pip install coveralls>=3.0.0 - # PEP 517 package builder from pypa - pip install build - # needed for now, since sdist needs requirements defined in pyporject.toml - # pip uses isolated builds, where cython is not present afterwards - # pep517 is not yet available: https://stackoverflow.com/a/63555237/6696397 - # pip install -r requirements_setup.txt - # no build isolation since requirements now installed - # editable to be compatible with pytest (inplace build) - # pip install --no-build-isolation --editable .[test] + pip install build coveralls>=3.0.0 pip install --editable .[test] - name: Run tests @@ -85,7 +76,7 @@ jobs: - name: Build sdist run: | - # python setup.py sdist -d dist + # PEP 517 package builder from pypa python -m build --sdist --outdir dist . - uses: actions/upload-artifact@v2 From f22695d85890bed782bdeea4327706490bd33658 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20M=C3=BCller?= Date: Wed, 7 Apr 2021 00:09:14 +0200 Subject: [PATCH 24/28] CI: add black format check stage --- .github/workflows/main.yml | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index cd56f9a71..fe407f936 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -14,6 +14,29 @@ on: workflow_dispatch: jobs: + format_check: + name: format 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 + + - name: black check + run: | + python -m black --check . + build_wheels: name: wheels on ${{ matrix.os }} runs-on: ${{ matrix.os }} From cfaa547a3f26a1166824e33df2f0e6e418648ec3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20M=C3=BCller?= Date: Wed, 7 Apr 2021 00:10:45 +0200 Subject: [PATCH 25/28] CI: use [test] options defined in setup.py for CIBW --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index fe407f936..34b0f1b82 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -54,7 +54,7 @@ jobs: uses: joerick/cibuildwheel@v1.10.0 env: CIBW_BUILD: cp36-* cp37-* cp38-* cp39-* - CIBW_TEST_REQUIRES: pytest + CIBW_TEST_EXTRAS: test CIBW_TEST_COMMAND: pytest -v {project}/tests with: output-dir: dist From 6a132adfeb21fe3ed7e762e449cd2ad8bffb7aa0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20M=C3=BCller?= Date: Wed, 7 Apr 2021 00:11:51 +0200 Subject: [PATCH 26/28] Setup: remove setup req file again, since sdist ist build pep517 conform now --- requirements_setup.txt | 5 ----- 1 file changed, 5 deletions(-) delete mode 100644 requirements_setup.txt diff --git a/requirements_setup.txt b/requirements_setup.txt deleted file mode 100644 index c05032b77..000000000 --- a/requirements_setup.txt +++ /dev/null @@ -1,5 +0,0 @@ -setuptools>=42 -wheel -setuptools_scm[toml]>=3.5 -numpy>=1.14.5,<2.0 -Cython>=0.28.3,<3.0 From 392fd4e980881cc43d513f440934b71a2fe45ca2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20M=C3=BCller?= Date: Wed, 7 Apr 2021 11:46:49 +0200 Subject: [PATCH 27/28] Setup: remove req files and use setup.cfg for all configs beside cython; add all md to MANIFEST --- .readthedocs.yml | 1 - MANIFEST.in | 3 +- docs/requirements.txt | 9 ---- pyproject.toml | 6 +++ requirements.txt | 6 --- requirements_test.txt | 3 -- setup.cfg | 72 ++++++++++++++++++++++++++++++++ setup.py | 96 ++++--------------------------------------- 8 files changed, 88 insertions(+), 108 deletions(-) delete mode 100644 docs/requirements.txt delete mode 100644 requirements.txt delete mode 100755 requirements_test.txt create mode 100644 setup.cfg diff --git a/.readthedocs.yml b/.readthedocs.yml index d89b03087..f88c11ac0 100644 --- a/.readthedocs.yml +++ b/.readthedocs.yml @@ -8,7 +8,6 @@ formats: all python: version: 3.7 install: - - requirements: docs/requirements.txt - method: pip path: . extra_requirements: diff --git a/MANIFEST.in b/MANIFEST.in index 1d2bc731f..12d5af66b 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -3,5 +3,6 @@ graft tests graft docs recursive-include gstools *.py *.pyx recursive-exclude gstools *.c *.cpp -include LICENSE README.md pyproject.toml setup.py +include LICENSE pyproject.toml setup.py setup.cfg +include *.md global-exclude __pycache__ *.py[cod] .* diff --git a/docs/requirements.txt b/docs/requirements.txt deleted file mode 100644 index 6cdb19647..000000000 --- a/docs/requirements.txt +++ /dev/null @@ -1,9 +0,0 @@ -numpydoc>=1.1 -sphinx>=3 -sphinx-gallery>=0.8 -sphinx-rtd-theme>=0.5 -matplotlib>=3 -pykrige>=1.5 -pyvista -meshzoo -m2r2 diff --git a/pyproject.toml b/pyproject.toml index e77e28142..b510e86ea 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -8,6 +8,12 @@ requires = [ ] build-backend = "setuptools.build_meta" +[tool.setuptools_scm] +write_to = "gstools/_version.py" +write_to_template = "__version__ = '{version}'" +local_scheme = "no-local-version" +fallback_version = "0.0.0.dev0" + [tool.coverage.run] source = ["gstools"] omit = [ diff --git a/requirements.txt b/requirements.txt deleted file mode 100644 index 202f94dd4..000000000 --- a/requirements.txt +++ /dev/null @@ -1,6 +0,0 @@ -numpy>=1.14.5,<2 -scipy>=1.1.0,<2 -hankel>=1.0.2,<2 -emcee>=3.0.0,<4 -pyevtk>=1.1.1,<2 -meshio>=4.0.3,<5.0 diff --git a/requirements_test.txt b/requirements_test.txt deleted file mode 100755 index f515e1cad..000000000 --- a/requirements_test.txt +++ /dev/null @@ -1,3 +0,0 @@ -pytest>=6.0 -coverage[toml]>=5.2.1 -pytest-cov>=2.11.0 \ No newline at end of file diff --git a/setup.cfg b/setup.cfg new file mode 100644 index 000000000..be2137524 --- /dev/null +++ b/setup.cfg @@ -0,0 +1,72 @@ +[metadata] +name = gstools +description = GSTools: A geostatistical toolbox. +long_description = file: README.md +long_description_content_type = text/markdown +url = https://github.com/GeoStat-Framework/GSTools +author = Sebastian Müller, Lennart Schüler +author_email = info@geostat-framework.org +maintainer = Sebastian Müller, Lennart Schüler +maintainer_email = info@geostat-framework.org +license = LGPL-3.0 +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 :: GNU Lesser General Public License v3 (LGPLv3) + Natural Language :: English + 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 :: Utilities +project_urls = + Documentation = https://gstools.readthedocs.io + Source = https://github.com/GeoStat-Framework/GSTools + Tracker = https://github.com/GeoStat-Framework/GSTools/issues + Changelog = https://github.com/GeoStat-Framework/GSTools/blob/develop/CHANGELOG.md + Conda-Forge = https://anaconda.org/conda-forge/gstools + +[options] +packages = find: +install_requires = + emcee>=3.0.0,<4 + hankel>=1.0.2,<2 + meshio>=4.0.3,<5.0 + numpy>=1.14.5,<2 + pyevtk>=1.1.1,<2 + scipy>=1.1.0,<2 +python_requires = >=3.6 +zip_safe = False + +[options.packages.find] +exclude = + tests + docs + +[options.extras_require] +doc = + m2r2 + matplotlib>=3 + meshzoo + numpydoc>=1.1 + pykrige>=1.5 + pyvista + sphinx>=3 + sphinx-gallery>=0.8 + sphinx-rtd-theme>=0.5 +plotting = + matplotlib + pyvista +test = + coverage[toml]>=5.2.1 + pytest>=6.0 + pytest-cov>=2.11.0 diff --git a/setup.py b/setup.py index 1606f226b..011fcd79a 100644 --- a/setup.py +++ b/setup.py @@ -10,18 +10,15 @@ from distutils.ccompiler import new_compiler from distutils.sysconfig import customize_compiler -from setuptools import setup, find_packages, Extension +from setuptools import setup, Extension from Cython.Build import cythonize import numpy as np -HERE = os.path.abspath(os.path.dirname(__file__)) - - # openmp finder ############################################################### -# This code is adapted for a large part from the scikit-learn openmp helpers, +# This code is adapted for a large part from the scikit-learn openmp_helpers.py # which can be found at: -# https://github.com/scikit-learn/scikit-learn/blob/master/sklearn/_build_utils/openmp_helpers.py +# https://github.com/scikit-learn/scikit-learn/blob/0.24.0/sklearn/_build_utils CCODE = """ @@ -49,17 +46,6 @@ def get_openmp_flag(compiler): if sys.platform == "darwin" and ("icc" in compiler or "icl" in compiler): return ["-openmp"] if sys.platform == "darwin" and "openmp" in os.getenv("CPPFLAGS", ""): - # -fopenmp can't be passed as compile flag when using Apple-clang. - # OpenMP support has to be enabled during preprocessing. - # - # For example, our macOS wheel build jobs use the following environment - # variables to build with Apple-clang and the brew installed "libomp": - # - # export CPPFLAGS="$CPPFLAGS -Xpreprocessor -fopenmp" - # export CFLAGS="$CFLAGS -I/usr/local/opt/libomp/include" - # export CXXFLAGS="$CXXFLAGS -I/usr/local/opt/libomp/include" - # export LDFLAGS="$LDFLAGS -L/usr/local/opt/libomp/lib -lomp" - # export DYLD_LIBRARY_PATH=/usr/local/opt/libomp/lib return [] # Default flag for GCC and clang: return ["-fopenmp"] @@ -113,7 +99,7 @@ def check_openmp_support(): openmp_supported = False openmp_flags = [] finally: - os.chdir(HERE) + os.chdir(os.path.abspath(os.path.dirname(__file__))) return openmp_supported, openmp_flags @@ -171,78 +157,12 @@ def check_openmp_support(): ) EXT_MODULES = cythonize(CY_MODULES) # annotate=True -# This is an important part. By setting this compiler directive, cython will -# embed signature information in docstrings. Sphinx then knows how to extract -# and use those signatures. -# python setup.py build_ext --inplace --> then sphinx build +# embed signatures for sphinx for ext_m in EXT_MODULES: ext_m.cython_directives = {"embedsignature": True} + # setup ####################################################################### -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_test.txt"), encoding="utf-8") as f: - REQ_TEST = f.read().splitlines() -with open( - os.path.join(HERE, "docs", "requirements.txt"), encoding="utf-8" -) as f: - REQ_DOC = f.read().splitlines() - -REQ_DEV = 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 :: GNU Lesser General Public License v3 (LGPLv3)", - "Natural Language :: English", - "Operating System :: Unix", - "Programming Language :: Python", - "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.6", - "Programming Language :: Python :: 3.7", - "Programming Language :: Python :: 3.8", - "Programming Language :: Python :: 3.9", - "Programming Language :: Python :: 3 :: Only", - "Topic :: Scientific/Engineering", - "Topic :: Utilities", -] - -setup( - name="gstools", - license_files=("LICENSE",), - description=DOCLINE, - long_description=README, - long_description_content_type="text/markdown", - maintainer="Sebastian Müller, Lennart Schüler", - maintainer_email="info@geostat-framework.org", - author="Sebastian Müller, Lennart Schüler", - author_email="info@geostat-framework.org", - url="https://github.com/GeoStat-Framework/GSTools", - license="LGPLv3", - classifiers=CLASSIFIERS, - platforms=["Windows", "Linux", "Solaris", "Mac OS-X", "Unix"], - python_requires=">=3.6", - use_scm_version={ - "relative_to": __file__, - "write_to": "gstools/_version.py", - "write_to_template": "__version__ = '{version}'", - "local_scheme": "no-local-version", - "fallback_version": "0.0.0.dev0", - }, - install_requires=REQ, - extras_require={ - "plotting": ["pyvista", "matplotlib"], - "doc": REQ_DOC, - "test": REQ_TEST, - "dev": REQ_DEV, - }, - packages=find_packages(exclude=["tests*", "docs*"]), - ext_modules=EXT_MODULES, - include_dirs=[np.get_include()], -) + +setup(ext_modules=EXT_MODULES, include_dirs=[np.get_include()]) From 46b085d75ecbf87effcbde2b71e596700e118f12 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20M=C3=BCller?= Date: Wed, 7 Apr 2021 12:22:26 +0200 Subject: [PATCH 28/28] Setup: minor fix for sdist check (attempt 1) --- setup.cfg | 4 ++-- setup.py | 5 ++++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/setup.cfg b/setup.cfg index be2137524..53e4bbf0b 100644 --- a/setup.cfg +++ b/setup.cfg @@ -49,8 +49,8 @@ zip_safe = False [options.packages.find] exclude = - tests - docs + tests* + docs* [options.extras_require] doc = diff --git a/setup.py b/setup.py index 011fcd79a..06149506a 100644 --- a/setup.py +++ b/setup.py @@ -15,6 +15,9 @@ import numpy as np +HERE = os.path.abspath(os.path.dirname(__file__)) + + # openmp finder ############################################################### # This code is adapted for a large part from the scikit-learn openmp_helpers.py # which can be found at: @@ -99,7 +102,7 @@ def check_openmp_support(): openmp_supported = False openmp_flags = [] finally: - os.chdir(os.path.abspath(os.path.dirname(__file__))) + os.chdir(HERE) return openmp_supported, openmp_flags