diff --git a/.flake8 b/.flake8 new file mode 100644 index 000000000..f44d282a4 --- /dev/null +++ b/.flake8 @@ -0,0 +1,4 @@ +[flake8] +max-line-length = 88 +ignore = E402, W503, E203, C901 +exclude = docs/conf.py, src/xtgeo/cxtgeo/*.py, .eggs, tests/**/snapshots, _theversion.py diff --git a/.github/actions/build-xtgeo/action.yml b/.github/actions/build-xtgeo/action.yml deleted file mode 100644 index c49928c7c..000000000 --- a/.github/actions/build-xtgeo/action.yml +++ /dev/null @@ -1,23 +0,0 @@ -name: Build -description: builds xtgeo - -inputs: - python-version: - required: true - - -runs: - using: "composite" - steps: - - name: Set up Python - uses: actions/setup-python@v2 - with: - python-version: ${{ inputs.python-version }} - - - name: Upgrade pip - run: python -m pip install pip -U - shell: bash - - - name: install xtgeo - run: pip install . - shell: bash diff --git a/.github/actions/setup_testdata/action.yml b/.github/actions/setup_testdata/action.yml new file mode 100644 index 000000000..557f9d54d --- /dev/null +++ b/.github/actions/setup_testdata/action.yml @@ -0,0 +1,9 @@ +name: Setup xtgeo testdata +description: Set up the xtgeo test environment + +runs: + using: "composite" + steps: + - name: Install test data + shell: bash + run: git clone --depth 1 https://github.com/equinor/xtgeo-testdata ../xtgeo-testdata diff --git a/.github/actions/setup_xtgeo/action.yml b/.github/actions/setup_xtgeo/action.yml new file mode 100644 index 000000000..22e67f670 --- /dev/null +++ b/.github/actions/setup_xtgeo/action.yml @@ -0,0 +1,21 @@ +name: Setup xtgeo +description: Set up the xtgeo test environment + +inputs: + python-version: + required: true + type: string + +runs: + using: "composite" + steps: + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: ${{ inputs.python-version }} + + - name: Build and install xtgeo + shell: bash + run: | + pip install -U pip + pip install ".[dev]" diff --git a/.github/actions/test_setup/action.yml b/.github/actions/test_setup/action.yml deleted file mode 100644 index 1b9d77389..000000000 --- a/.github/actions/test_setup/action.yml +++ /dev/null @@ -1,17 +0,0 @@ -name: "Set up for tests" -description: "Set up the xtgeo test environment" - -inputs: - python-version: - required: true - -runs: - using: "composite" - steps: - - uses: "./.github/actions/build-xtgeo" - with: - python-version: ${{ inputs.python-version }} - - run: git clone --depth 1 https://github.com/equinor/xtgeo-testdata ../xtgeo-testdata - shell: bash - - run: pip install -r requirements/requirements_test.txt - shell: bash diff --git a/.github/workflows/build_docs.yml b/.github/workflows/build_docs.yml index a8e0c64aa..70acc71dd 100644 --- a/.github/workflows/build_docs.yml +++ b/.github/workflows/build_docs.yml @@ -10,12 +10,14 @@ jobs: build_docs: name: Build docs runs-on: ubuntu-latest + steps: - - uses: actions/checkout@v3 - - uses: "./.github/actions/build-xtgeo" + - uses: actions/checkout@v4 with: - python-version: 3.9 - - name: Install doc requirements - run: pip install -r requirements/requirements_docs.txt + fetch-depth: 0 + + - name: Install xtgeo + run: pip install ".[docs]" + - name: Build docs run: sphinx-build -W docs tmp/docs diff --git a/.github/workflows/ci-test-xtgeo-cibuildwheel.yml b/.github/workflows/ci-test-xtgeo-cibuildwheel.yml index ba6296291..ebc8a775b 100644 --- a/.github/workflows/ci-test-xtgeo-cibuildwheel.yml +++ b/.github/workflows/ci-test-xtgeo-cibuildwheel.yml @@ -11,6 +11,7 @@ jobs: name: CIBW python ${{ matrix.cibw_python }} on ${{ matrix.os.runs_on }} runs-on: ${{ matrix.os.runs_on }} strategy: + fail-fast: false matrix: cibw_python: [cp38, cp39, cp310, cp311] os: @@ -22,32 +23,21 @@ jobs: cibw_image: macosx_x86_64 env: - CIBW_MANYLINUX_X86_64_IMAGE: manylinux2014 - # pillow < 8.4 required for CIBW build - CIBW_BEFORE_TEST: > - pushd {project} && - pip install -r requirements/requirements_test.txt && - git clone --depth 1 https://github.com/equinor/xtgeo-testdata ../xtgeo-testdata - # Ignore forking tests as they do not work well with CIBW - CIBW_TEST_COMMAND: > - pushd {project} && - pytest --disable-warnings -x -m "not hypothesis" --ignore tests/test_well --ignore-glob="*forks.py" CIBW_BUILD: ${{ matrix.cibw_python }}-${{ matrix.os.cibw_image }} - # CIBW_TEST_SKIP: "cp312*linux* cp312*macos*" - CIBW_BEFORE_BUILD: python -m pip install "pip<=22.0.4" steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: fetch-depth: 0 + - name: Set up Python uses: actions/setup-python@v2 - name: Install cibuildwheel - run: > - python -m pip install wheel && - python -m pip install cibuildwheel + run: pip install wheel cibuildwheel + - name: Run cibuildwheel - run: python -m cibuildwheel --output-dir wheelhouse + run: cibuildwheel --output-dir wheelhouse + - name: Publish if: ${{ github.event_name == 'release' }} env: diff --git a/.github/workflows/linting.yml b/.github/workflows/linting.yml index 1bac276b1..1c5af2afc 100644 --- a/.github/workflows/linting.yml +++ b/.github/workflows/linting.yml @@ -1,4 +1,4 @@ -name: linting +name: Linting on: [push, pull_request] @@ -6,14 +6,26 @@ jobs: linting: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - - uses: actions/setup-python@v4 + - uses: actions/checkout@v4 with: - python-version: "3.10" - - name: Check black style and linting - run: | - pip install black - pip freeze - black --check *.py src tests --extend-exclude tests/**/snapshots --extend-exclude src/xtgeo/grid3d/grid_properties.py - pip install flake8 - flake8 src tests + fetch-depth: 0 + + - name: Setup xtgeo + uses: "./.github/actions/setup_xtgeo" + with: + python-version: 3.11 + + - name: List dependencies + run: pip freeze + + - name: Lint with isort + if: ${{ always() }} + run: isort --check-only src tests + + - name: Lint with black + if: ${{ always() }} + run: black src tests + + - name: Lint with flake8 + if: ${{ always() }} + run: flake8 src tests diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 25a245ac4..e2cc57f7c 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -23,49 +23,76 @@ jobs: python-version: 3.11 runs-on: ${{ matrix.os }} steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: fetch-depth: 0 - - uses: "./.github/actions/test_setup" + + - name: Setup xtgeo + uses: "./.github/actions/setup_xtgeo" with: python-version: ${{ matrix.python-version }} - - name: Run test - run: python -m pytest --disable-warnings -x --hypothesis-profile ci-fast + + - name: Setup testdata + uses: "./.github/actions/setup_testdata" + + - name: Run fast tests + run: pytest --disable-warnings -x --hypothesis-profile ci-fast + hypothesis: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: fetch-depth: 0 - - uses: "./.github/actions/test_setup" + + - name: Setup xtgeo + uses: "./.github/actions/setup_xtgeo" with: python-version: 3.9 + + - name: Setup testdata + uses: "./.github/actions/setup_testdata" + - name: Run just hypothesis tests with more examples run: python -m pytest --disable-warnings -x -m hypothesis --hypothesis-profile ci --generate-plots + big: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: fetch-depth: 0 - - uses: "./.github/actions/test_setup" + + - name: Setup xtgeo + uses: "./.github/actions/setup_xtgeo" with: python-version: 3.9 + + - name: Setup testdata + uses: "./.github/actions/setup_testdata" + - name: Run just tests marked big run: XTG_BIGTEST=1 python -m pytest --disable-warnings -x -m bigtest --hypothesis-profile ci --generate-plots + codecov: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: fetch-depth: 0 - - uses: "./.github/actions/test_setup" + + - name: Setup xtgeo + uses: "./.github/actions/setup_xtgeo" with: python-version: 3.9 - - name: "Install codecov" - run: pip install pytest-cov + + - name: Setup testdata + uses: "./.github/actions/setup_testdata" + + - name: Generate coverage report run: pytest tests --doctest-modules --generate-plots --disable-warnings --cov=xtgeo --hypothesis-profile ci-fast --cov-report=xml:xtgeocoverage.xml; + - name: Upload coverage to Codecov uses: codecov/codecov-action@v2 with: diff --git a/.gitignore b/.gitignore index 960674f96..8d75d7692 100644 --- a/.gitignore +++ b/.gitignore @@ -82,3 +82,4 @@ pip-wheel-metadata/ .vscode/ .venv*/ .nfs* +tmp/ diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml deleted file mode 100644 index f3c10a261..000000000 --- a/.pre-commit-config.yaml +++ /dev/null @@ -1,36 +0,0 @@ -# to disable hooks: SKIP=pylint git commit ... -repos: - - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v3.2.0 - hooks: - - id: trailing-whitespace - exclude: "snapshots/" - - id: mixed-line-ending - exclude: "snapshots/" - - - repo: https://github.com/psf/black - rev: 20.8b1 - hooks: - - id: black - - - repo: https://gitlab.com/pycqa/flake8 - rev: 3.8.3 - hooks: - - id: flake8 - - repo: https://github.com/pycqa/pydocstyle - rev: 5.1.1 - hooks: - - id: pydocstyle - files: ^src/xtgeo/plot - exclude: _.*\.py - - repo: https://github.com/pycqa/pylint - rev: pylint-2.6.0 - hooks: - - id: pylint - files: ^src/xtgeo/plot - # - repo: https://github.com/PyCQA/bandit - # rev: 1.7.0 - # hooks: - # - id: bandit - # args: [--skip, "B311", --recursive, --quiet] - # files: src/xtgeo diff --git a/CMakeLists.txt b/CMakeLists.txt index 6f7993666..3d9b22a3c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,20 +1,11 @@ -# Main CMakeLists.txt file. Most of the work is inside -# the CMakeLists file under add_subdirectory() - -cmake_minimum_required(VERSION 2.8.12 FATAL_ERROR) -if (CMAKE_VERSION VERSION_LESS 3) - project(clib C) -else() - project(clib LANGUAGES C) -endif() - - -set(CMAKE_VERBOSE_MAKEFILE ON) - -if(SKBUILD) - message(STATUS "The project is built using scikit-build") +cmake_minimum_required(VERSION 3.15.3) +project(${SKBUILD_PROJECT_NAME} LANGUAGES C) + +if(NOT SKBUILD) + message( + WARNING + "This CMakeLists.txt file should not be used directly.\n" + "Use 'pip install ${CMAKE_SOURCE_DIR}' to install this as a Python package.") endif() -find_package(PythonExtensions REQUIRED) - add_subdirectory(src/clib) diff --git a/ci/testkomodo.sh b/ci/testkomodo.sh index 88da02744..5c4b96272 100644 --- a/ci/testkomodo.sh +++ b/ci/testkomodo.sh @@ -11,11 +11,7 @@ copy_test_files () { } install_package () { - pip install . -} - -install_test_dependencies () { - pip install -r requirements/requirements_test.txt + pip install ".[dev]" } start_tests () { @@ -31,12 +27,7 @@ cleanup () { run_tests() { copy_test_files - if [ ! -z "${CI_PR_RUN:-}" ] - then - install_package - fi - - install_test_dependencies + install_package pushd $CI_TEST_ROOT start_tests diff --git a/docs/contributing.rst b/docs/contributing.rst index 50deaad96..e728f3335 100644 --- a/docs/contributing.rst +++ b/docs/contributing.rst @@ -83,9 +83,7 @@ up your fork for local development (first time): $ source bin/activate $ cd /your_path_to_git_clone/xtgeo/ $ pip install pip -U - $ pip install -r requirements/requirements_dev.txt - $ python setup.py clean - $ python setup.py develop + $ pip install ".[dev,docs]" $ pytest # to check that stuff works 4. Create a branch for local development: @@ -100,13 +98,12 @@ Now you can make your changes locally. .. code-block:: bash - $ flake8 - $ pylint - $ Use `pytest` for running tests - $ Run `black` on your python code, then there is no discussions on formatting - -To get ``flake8``, ``pylint`` and ``black`` and just pip install them into -your virtualenv. + $ black src tests + $ flake8 src tests + $ isort src tests + $ mypy src + $ pylint src tests + $ pytest tests 6. If you want to edit C code, take contact with the author for detailed instructions. @@ -137,9 +134,7 @@ and it is targeted to Equinor usage using bash shell in Linux: $ source ~/venv/py36_rms12.0.2/bin/activate $ cd path_to_xtgeo/ $ python -m pip install pip -U - $ pip install requirements/requirements_dev.txt - $ python setup.py clean - $ python setup.py develop + $ pip install ".[dev]" $ pytest Now you have an editable install in your virtual environment that can be ran diff --git a/docs/installation.rst b/docs/installation.rst index e60c71b04..4bff1c726 100644 --- a/docs/installation.rst +++ b/docs/installation.rst @@ -66,8 +66,7 @@ Hence folder structure may look like /some/path/to/xtgeo /some/path/to/xtgeo-testdata -For required python packages, see the requirements*.txt files and the -pyproject.toml file in the root folder. +For required python packages, see the pyproject.toml file in the root folder. Once you have a copy of the source, and you have a `virtual environment`_, then always run tests (run first compile and install with ``pip install .``): diff --git a/pyproject.toml b/pyproject.toml index efc95c0ca..eddc1d771 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,8 +1,102 @@ -# NOTE: you have to use single-quoted strings in TOML for regular expressions. +[build-system] +requires = [ + "scikit-build-core[pyproject]", + "swig", + "numpy==1.19.2; python_version == '3.8'", + "numpy==1.19.5; python_version == '3.9'", + "numpy==1.21.6; python_version == '3.10'", + "numpy==1.23.5; python_version == '3.11'", +] +build-backend = "scikit_build_core.build" + +[tool.scikit-build] +cmake.verbose = true +logging.level = "INFO" +metadata.version.provider = "scikit_build_core.metadata.setuptools_scm" +sdist.include = ["src/xtgeo/_theversion.py"] +wheel.install-dir = "xtgeo" + +[project] +name = "xtgeo" +description = "XTGeo is a Python library for 3D grids, surfaces, wells, etc" +readme = "README.md" +requires-python = ">=3.8" +license = { text = "LGPL-3.0" } +authors = [ + { name = "Equinor", email = "jriv@equinor.com" }, +] +keywords = ["grids", "surfaces", "wells", "cubes"] +classifiers = [ + "Development Status :: 5 - Production/Stable", + "Intended Audience :: Developers", + "Intended Audience :: Science/Research", + "License :: OSI Approved :: GNU Lesser General Public", + "License v3 or later (LGPLv3+)", + "Operating System :: POSIX :: Linux", + "Natural Language :: English", + "Programming Language :: Python", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Topic :: Scientific/Engineering", + "Topic :: Scientific/Engineering :: Physics", + "Topic :: Software Development :: Libraries", + "Topic :: Utilities", +] +dynamic = ["version"] +dependencies = [ + "deprecation", + "ecl-data-io>=2.1", + "h5py>=3", + "hdf5plugin>=2.3", + "matplotlib>=3.3", + "numpy>=1.19", + "pandas>=1.1", + "roffio>=0.0.2", + "scipy>=1.5", + "segyio>1.8.0", + "shapely>=1.6.2", + "tables;platform_system != 'Darwin'", # TODO: update when fixed for mac + "typing-extensions", +] + +[project.urls] +Homepage = "https://github.com/equinor/xtgeo" +Repository = "https://github.com/equinor/xtgeo" +Issues = "https://github.com/equinor/xtgeo/issues" +Documentation = "https://xtgeo.readthedocs.io" + +[project.optional-dependencies] +dev = [ + "black", + "coverage>=4.1", + "flake8", + "isort", + "hypothesis", + "mypy", + "pylint", + "pytest", + "pytest-benchmark", + "pytest-cov", + "pydocstyle", + "pytest-runner", + "pytest-mock", + "pytest-snapshot", + "pytest-xdist", +] +docs = [ + "pydocstyle", + "Sphinx<4.0", + "sphinx-rtd-theme", + "sphinx-toolbox", + "autoclasstoc", + "myst-parser", +] [tool.black] line-length = 88 -target-version = ['py38', 'py39', 'py310', 'py311'] +target-version = ["py38", "py39", "py310", "py311"] include = '\.pyi?$' exclude = ''' /( @@ -16,6 +110,7 @@ exclude = ''' | buck-out | build | dist + | _theversion.py # The following are specific to Black, you probably don't want those. | blib2to3 | tests/data @@ -23,28 +118,43 @@ exclude = ''' )/ ''' -# numpy version scheme to fulfill Roxar API compatibility: -# RMS 12.1.* --> numpy == 1.19.2 with python 3.8 +[tool.cibuildwheel] +manylinux-x86_64-image = "manylinux2014" +test-extras = ["dev"] +before-build = 'python -m pip install "pip<=22.0.4"' +before-test = [ + "pushd {package}", + "git clone --depth 1 https://github.com/equinor/xtgeo-testdata ../xtgeo-testdata", +] +test-command = [ + "pushd {package}", + # Ignore forking tests as they do not work well with CIBW + 'pytest --disable-warnings -x -m "not hypothesis" --ignore tests/test_well --ignore-glob="*forks.py"', +] -[build-system] -requires = [ - "setuptools>=43", - "scikit-build<0.17", - 'cmake==3.15.3; python_version >= "3.8" and platform_system == "Linux"', - 'cmake==3.18.0; platform_system != "Linux"', - "ninja", - 'swig', - "setuptools_scm>=3.2.0", - 'numpy==1.19.2; python_version == "3.8"', - 'numpy==1.19.5; python_version == "3.9"', - 'numpy==1.21.6; python_version == "3.10"', - 'numpy==1.23.5; python_version == "3.11"', - 'Sphinx<4.0', - 'sphinx-rtd-theme', - 'sphinx-toolbox', - 'autoclasstoc', - 'myst-parser', +[tool.isort] +profile = "black" + +[tool.mypy] +ignore_missing_imports = true + +[tool.pydocstyle] +convention = "google" +match = '(?!(test_|_)).*\.py' + +[tool.pytest.ini_options] +minversion = "6.0" +addopts = "--verbose" +log_cli = "False" +log_cli_format = "%(levelname)8s (%(relativeCreated)6.0fms) %(filename)44s [%(funcName)40s()] %(lineno)4d >> %(message)s" +log_cli_level = "INFO" +testpaths = "tests" +markers = [ + "bigtest: A big test not executed by default", + "requires_opm: A test requiring opm in the environment", + "requires_roxar: Test requires to run in RMS python", ] +doctest_optionflags = "ELLIPSIS" [tool.setuptools_scm] write_to = "src/xtgeo/_theversion.py" diff --git a/pytest.ini b/pytest.ini deleted file mode 100644 index 9c5a40285..000000000 --- a/pytest.ini +++ /dev/null @@ -1,15 +0,0 @@ -#pytest tests/test_grid3d/test_grid.py::test_roffbin_import_v2_emerald -o log_cli=true -s - -[pytest] -minversion = 6.0 -addopts = --verbose -log_cli = False -log_cli_format = %(levelname)8s (%(relativeCreated)6.0fms) %(filename)44s [%(funcName)40s()] %(lineno)4d >> %(message)s -log_cli_level = INFO -testpaths = - tests -markers = - bigtest: A big test not executed by default - requires_opm: A test requiring opm in the environment - requires_roxar: Test requires to run in RMS python -doctest_optionflags = ELLIPSIS diff --git a/requirements/pyproject.toml.komodo b/requirements/pyproject.toml.komodo deleted file mode 100644 index 60400194e..000000000 --- a/requirements/pyproject.toml.komodo +++ /dev/null @@ -1,15 +0,0 @@ -# version to be runnable by older pips in Komodo bleeding (Equinor) -[build-system] -requires = [ - "pip>=19.1.1", - "setuptools>=30.3.0", - "scikit-build<0.17", - "cmake>=3.6.0", - "ninja", - "setuptools_scm>=3.2.0", - "numpy>=1.19", - "Sphinx<4.0", # Due to sphinx-toolbox - "sphinx-rtd-theme", - "sphinxcontrib-apidoc", - "sphinx-autodoc-typehints", - ] diff --git a/requirements/requirements.txt b/requirements/requirements.txt deleted file mode 100644 index 252e1c41d..000000000 --- a/requirements/requirements.txt +++ /dev/null @@ -1,13 +0,0 @@ -deprecation -numpy>=1.19 -shapely>=1.6.2 -matplotlib>=3.3 -scipy>=1.5 -segyio>1.8.0 -pandas>=1.1 -h5py>=3 -hdf5plugin>=2.3 -tables>=3.5.1 -roffio>=0.0.2 -ecl-data-io>=2.1 -typing-extensions diff --git a/requirements/requirements_dev.txt b/requirements/requirements_dev.txt deleted file mode 100644 index 335703ca7..000000000 --- a/requirements/requirements_dev.txt +++ /dev/null @@ -1,34 +0,0 @@ -setuptools>=43 -setuptools_scm>=3.2.0 -scikit-build<0.17 -ninja>=1.9.0.post1 -cmake>3.13.3 -pip>=20 -wheel>=0.38 -flake8 -pydocstyle -coverage>=4.1 -pytest-runner>=2.11.1 -pre-commit -coverage>=4.1 -Sphinx<4.0 # Due to sphinx-toolbox -sphinx-rtd-theme -sphinx-toolbox -autoclasstoc -myst-parser -bandit -numpy>1.19 -pandas>=1.1 -segyio>=1.8.6 -matplotlib>=3.3 -scipy>=1.5 -shapely>=1.6.2 -black>=23.1 -autopep8 -pylint -pytest>=6 -pytest-cov -h5py>=3 -hdf5plugin>=2.3 -tables>=3.5 -swig diff --git a/requirements/requirements_dev_rms.txt b/requirements/requirements_dev_rms.txt deleted file mode 100644 index 855019d63..000000000 --- a/requirements/requirements_dev_rms.txt +++ /dev/null @@ -1,30 +0,0 @@ -# requirements when used in RMS python venv's -pip>=20.3.3 -setuptools>=30.3.0 -setuptools_scm>=3.2.0 -scikit-build -ninja>=1.9.0.post1 -cmake==3.15.3 -wheel>=0.38 -flake8 -pydocstyle -coverage>=4.1 -pre-commit -coverage>=4.1 -Sphinx<4.0 # Due to sphinx-toolbox -sphinx-rtd-theme -sphinx-toolbox -autoclasstoc -myst-parser -bandit -segyio>=1.8.6 -shapely>=1.6.2 -black>=23.1 -autopep8 -pylint -pytest>=2.9.2 -pytest-cov -pytest-runner>=2.11.1 -h5py>=3 -hdf5plugin>=2.3 -tables>=3.5.1 diff --git a/requirements/requirements_docs.txt b/requirements/requirements_docs.txt deleted file mode 100644 index 3355768af..000000000 --- a/requirements/requirements_docs.txt +++ /dev/null @@ -1,12 +0,0 @@ -setuptools>=43 -cmake>=3.13.3 -scikit-build -ninja - -setuptools_scm -pydocstyle -Sphinx<4.0 -sphinx-rtd-theme -sphinx-toolbox -autoclasstoc -myst-parser diff --git a/requirements/requirements_komodo.txt b/requirements/requirements_komodo.txt deleted file mode 100644 index f8c5bc9b6..000000000 --- a/requirements/requirements_komodo.txt +++ /dev/null @@ -1,4 +0,0 @@ -numpy>=1.13 -cmake>=3.13.1 -setuptools_scm>=3.2.0 -scikit-build==0.10.0 diff --git a/requirements/requirements_setup.txt b/requirements/requirements_setup.txt deleted file mode 100644 index 77a487bb7..000000000 --- a/requirements/requirements_setup.txt +++ /dev/null @@ -1,11 +0,0 @@ -# requirements for setup on localhost -# see also ...setup_ci.txt and pyproject.toml -setuptools>=43 -wheel>=0.38 -numpy -cmake -setuptools_scm -scikit-build -ninja -pytest-runner -swig diff --git a/requirements/requirements_setup_extras.txt b/requirements/requirements_setup_extras.txt deleted file mode 100644 index 3c099d592..000000000 --- a/requirements/requirements_setup_extras.txt +++ /dev/null @@ -1,9 +0,0 @@ -flake8 -pydocstyle -coverage>=4.1 -pre-commit -coverage>=4.1 -bandit -autopep8 -pylint -pytest-cov diff --git a/requirements/requirements_test.txt b/requirements/requirements_test.txt deleted file mode 100644 index 512ea3780..000000000 --- a/requirements/requirements_test.txt +++ /dev/null @@ -1,6 +0,0 @@ -pytest -hypothesis<=6.83.0;python_version=='3.8' # ipython pinned to 8.12.2 for python 3.8 support -hypothesis;python_version>='3.9' -pytest-benchmark -pytest-mock -pytest-snapshot diff --git a/scripts/setup_utilities.py b/scripts/setup_utilities.py deleted file mode 100644 index 72c178a42..000000000 --- a/scripts/setup_utilities.py +++ /dev/null @@ -1,155 +0,0 @@ -"""Functions/classes for use in setup.py in order to make the latter clean and lean.""" -import fnmatch -import os -import sys -from distutils.command.clean import clean as _clean -from glob import glob -from os.path import dirname, exists -from shutil import rmtree - -from setuptools_scm import get_version -from skbuild.command import set_build_base_mixin -from skbuild.constants import CMAKE_BUILD_DIR, CMAKE_INSTALL_DIR, SKBUILD_DIR - -CMD = sys.argv[1] - - -def new_style(klass): - """This function is stolen from scikit-build <= 0.15, as it is gone in >= 0.16. - - The distutils/setuptools command classes are old-style classes, which won't work - with mixins. To work around this limitation, we dynamically convert them to new - style classes by creating a new class that inherits from them and also . - This ensures that is always at the end of the MRO, even after being mixed - in with other classes. - """ - return type(f"NewStyleClass<{klass.__name__}>", (klass, object), {}) - - -# ====================================================================================== -# Overriding and extending setup commands -# ====================================================================================== -class CleanUp(set_build_base_mixin, new_style(_clean)): - """Custom implementation of ``clean`` setuptools command. - - Overriding clean in order to get rid if "dist" folder and etc - """ - - skroot = dirname(SKBUILD_DIR()) - - CLEANFOLDERS = ( - CMAKE_INSTALL_DIR(), - CMAKE_BUILD_DIR(), - SKBUILD_DIR(), - skroot, - "__pycache__", - "pip-wheel-metadata", - ".eggs", - "dist", - "sdist", - "wheel", - ".pytest_cache", - "docs/_apiref", - "docs/_build", - "htmlcov", - ) - - CLEANFOLDERSRECURSIVE = ["__pycache__", "_tmp_*", "xtgeo.egg-info"] - CLEANFILESRECURSIVE = ["*.pyc", "*.pyo", ".coverage", "coverage.xml"] - - CLEANFILES = glob("src/xtgeo/cxtgeo/cxtgeo*") - CLEANFILES.extend(glob("src/xtgeo/cxtgeo/_cxtgeo*")) - - @staticmethod - def ffind(pattern, path): - """Find files.""" - result = [] - for root, _, files in os.walk(path): - for name in files: - if fnmatch.fnmatch(name, pattern): - result.append(os.path.join(root, name)) - return result - - @staticmethod - def dfind(pattern, path): - """Find folders.""" - result = [] - for root, dirs, _ in os.walk(path): - for name in dirs: - if fnmatch.fnmatch(name, pattern): - result.append(os.path.join(root, name)) - return result - - def run(self): - """Execute run. - - After calling the super class implementation, this function removes - the directories specific to scikit-build ++. - """ - # super().run() - - for dir_ in CleanUp.CLEANFOLDERS: - if exists(dir_): - print(f"Removing: {dir_}") - if exists(dir_): - rmtree(dir_) - - for dir_ in CleanUp.CLEANFOLDERSRECURSIVE: - for pd in self.dfind(dir_, "."): - print(f"Remove folder {pd}") - rmtree(pd) - - for fil_ in CleanUp.CLEANFILESRECURSIVE: - for pf in self.ffind(fil_, "."): - print(f"Remove file {pf}") - os.unlink(pf) - - for fil_ in CleanUp.CLEANFILES: - if exists(fil_): - print(f"Removing: {fil_}") - if exists(fil_): - os.remove(fil_) - - -# ====================================================================================== -# Sphinx -# ====================================================================================== - -CMDSPHINX = { - "build_sphinx": { - "project": ("setup.py", "xtgeo"), - "version": ("setup.py", get_version()), - "release": ("setup.py", ""), - "source_dir": ("setup.py", "docs"), - } -} - - -# ====================================================================================== -# README stuff and Sphinx -# ====================================================================================== - - -def readmestuff(filename): - """For README, HISTORY etc.""" - response = "See " + filename - try: - with open(filename, encoding="utf-8") as some_file: - response = some_file.read() - except OSError: - pass - return response - - -# ====================================================================================== -# Other helpers -# ====================================================================================== - - -def parse_requirements(filename): - """Load requirements from a pip requirements file.""" - try: - lineiter = (line.strip() for line in open(filename, encoding="utf-8")) - return [line for line in lineiter if line and not line.startswith("#")] - except OSError: - return [] diff --git a/scripts/swig_manylinux.sh b/scripts/swig_manylinux.sh deleted file mode 100755 index cdd20ab66..000000000 --- a/scripts/swig_manylinux.sh +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/sh -# For manylinux docker installs in CI - -echo "Download swig..." -SWIGURL="https://ftp.osuosl.org/pub/blfs/conglomeration/swig" -SWIG="swig-4.0.1" -curl -O ${SWIGURL}/${SWIG}.tar.gz -tar xzf ${SWIG}.tar.gz -cd $SWIG -echo "Download swig... done" - -echo "Download pcre..." -curl -O "https://ftp.pcre.org/pub/pcre/pcre-8.38.tar.gz" -sh Tools/pcre-build.sh > /dev/null -echo "PCRE is built locally" - -sh ./configure \ - --with-python \ - --with-python3 \ - --without-perl5 \ - --without-ruby \ - --without-tcl \ - --without-maximum-compile-warnings \ - > /dev/null -make > /dev/null -make install > /dev/null -echo "SWIG installed" diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index 9465f6cb4..000000000 --- a/setup.cfg +++ /dev/null @@ -1,11 +0,0 @@ -[flake8] -exclude = docs/conf.py, src/xtgeo/cxtgeo/*.py, .eggs, _skbuild, tests/**/snapshots -max-line-length = 88 -ignore = E402, W503, E203, C901 - -[pydocstyle] -convention = google -match = (?!(test_|_)).*\.py - -[aliases] -test = pytest diff --git a/setup.py b/setup.py deleted file mode 100644 index be90a84f4..000000000 --- a/setup.py +++ /dev/null @@ -1,107 +0,0 @@ -#!/usr/bin/env python3 -"""Setup for XTGeo - subsurface reservoir tool for maps, 3D grids etc.""" -import sys - -try: - import setuptools - from setuptools import setup as setuptools_setup -except ImportError: - print("\n*** Some requirements are missing, please run:") - print("\n*** pip install -r requirements/requirements_setup.txt\n\n") - raise - -try: - import skbuild -except ImportError: - print("\n*** Some requirements are missing, please run:") - print("\n*** pip install -r requirements/requirements_setup.txt\n") - raise - -from scripts import setup_utilities as setuputils - -CMD = sys.argv[1] - -README = setuputils.readmestuff("README.md") -HISTORY = setuputils.readmestuff("HISTORY.md") - -REQUIREMENTS = setuputils.parse_requirements("requirements/requirements.txt") - -TEST_REQUIREMENTS = setuputils.parse_requirements("requirements/requirements_test.txt") -SETUP_REQUIREMENTS = setuputils.parse_requirements( - "requirements/requirements_setup.txt" -) -DOCS_REQUIREMENTS = setuputils.parse_requirements("requirements/requirements_docs.txt") -EXTRAS_REQUIRE = {"tests": TEST_REQUIREMENTS, "docs": DOCS_REQUIREMENTS} - -CMDCLASS = {"clean": setuputils.CleanUp} - - -skbuild.setup( - name="xtgeo", - description="XTGeo is a Python library for 3D grids, surfaces, wells, etc", - long_description=README + "\n\n" + HISTORY, - long_description_content_type="text/markdown", - author="Equinor R&T", - url="https://github.com/equinor/xtgeo", - project_urls={ - "Documentation": "https://xtgeo.readthedocs.io/", - "Issue Tracker": "https://github.com/equinor/xtgeo/issues", - }, - license="LGPL-3.0", - cmake_args=["-DCMAKE_VERBOSE_MAKEFILE:BOOL=ON"], - packages=setuptools.find_packages(where="src"), - package_dir={"": "src"}, - cmdclass=CMDCLASS, - zip_safe=False, - keywords="xtgeo", - command_options=setuputils.CMDSPHINX, - classifiers=[ - "Development Status :: 5 - Production/Stable", - "Intended Audience :: Developers", - "Intended Audience :: Science/Research", - "License :: OSI Approved :: GNU Lesser General Public " - "License v3 or later (LGPLv3+)", - "Operating System :: POSIX :: Linux", - "Natural Language :: English", - "Programming Language :: Python", - "Programming Language :: Python :: 3.8", - "Programming Language :: Python :: 3.9", - "Programming Language :: Python :: 3.10", - "Programming Language :: Python :: 3.11", - "Topic :: Scientific/Engineering", - "Topic :: Scientific/Engineering :: Physics", - "Topic :: Software Development :: Libraries", - "Topic :: Utilities", - ], - test_suite="tests", - install_requires=REQUIREMENTS, - setup_requires=SETUP_REQUIREMENTS, - tests_require=TEST_REQUIREMENTS, - extras_require=EXTRAS_REQUIRE, -) - -# Below is a hack to make "python setup.py develop" or "pip install -e ." to work. -# Without this, the xtgeo.egg-link file will be wrong, e.g.: -# /home/jan/work/git/xtg/xtgeo -# . -# -# instead of the correct: -# /home/jan/work/git/xtg/xtgeo/src -# ../ -# -# The wrong egg-link comes when find_packages(where="src") finds a list of packages in -# scikit-build version of setup(). No clue why... - -if CMD == "develop": - print("Run in DEVELOP mode") - setuptools_setup( # use setuptools version of setup - name="xtgeo", - packages=setuptools.find_packages(where="src"), - package_dir={"": "src"}, - zip_safe=False, - test_suite="tests", - install_requires=REQUIREMENTS, - setup_requires=SETUP_REQUIREMENTS, - tests_require=TEST_REQUIREMENTS, - extras_require=EXTRAS_REQUIRE, - ) diff --git a/src/clib/CMakeLists.txt b/src/clib/CMakeLists.txt index 5552d9b1b..e51f19216 100644 --- a/src/clib/CMakeLists.txt +++ b/src/clib/CMakeLists.txt @@ -1,64 +1,21 @@ -message(STATUS "XTGeo library...") - include_directories(${CMAKE_CURRENT_LIST_DIR}/xtg) +set(SRC "${CMAKE_CURRENT_LIST_DIR}/xtg") -find_package(Threads) - - -if (MSVC) - set(XTGFLAGS /Ox /wd4996 /wd4267 /wd4244 /wd4305) - set(CXTGEOFLAGS /Ox /wd4996 /wd4267 /wd4244 /wd4305) -else() - set(XTGFLAGS -Wall -Wno-unused-but-set-variable -fPIC) - set(CXTGEOFLAGS -Wl,--no-undefined) -endif() - -set (SRC "${CMAKE_CURRENT_LIST_DIR}/xtg") - -# todo: replace globbing with unique list, as globbing is bad practice +# TODO: replace globbing with unique list, as globbing is bad practice FILE(GLOB SOURCES ${SRC}/*.c) +add_library(xtg STATIC ${SOURCES}) -add_library(xtg - STATIC - ${SOURCES} - ) - -target_compile_options(xtg PRIVATE ${XTGFLAGS}) +find_package(Python COMPONENTS Interpreter Development.Module NumPy REQUIRED) +find_package(SWIG 3.0.1 COMPONENTS REQUIRED) +include(UseSWIG) -# ====================================================================================== -# Find Python and SWIG -# ====================================================================================== - -# in case required SWIG is missing or too old and we are within Equinor, need a path to -# a SWIG version that works (RHEL7 have SWIG 2 by default which is too old) -if("$ENV{HOSTNAME}" MATCHES "statoil" AND CMAKE_SYSTEM_NAME MATCHES "Linux") - LIST(APPEND CMAKE_PROGRAM_PATH "/prog/res/opt/rhel7/swig_4.0.2/bin") - message(STATUS "Using Swig from /prog/res") -endif() - -# These policies are related to SWIG python libraries naming -if (CMAKE_VERSION VERSION_GREATER 3.12) - cmake_policy(SET CMP0074 NEW) - if (POLICY CMP0078) - cmake_policy(SET CMP0078 OLD) - endif() - - if (POLICY CMP0086) - cmake_policy(SET CMP0086 OLD) - endif() -else() - set(UseSWIG_TARGET_NAME_PREFERENCE LEGACY) +# CMP0053: Simplify variable reference and escape sequence evaluation. +# The OLD behavior for this policy is to honor the legacy behavior for +# variable references and escape sequences. +if (POLICY CMP0053) + cmake_policy(SET CMP0053 OLD) endif() -find_package(SWIG 3.0.1 REQUIRED) -include(${SWIG_USE_FILE}) - -find_package(PythonLibs REQUIRED) - -message(STATUS "XTGeo Python include path: ${PYTHON_INCLUDE_PATH}") -message(STATUS "XTGeo Python include dirs: ${PYTHON_INCLUDE_DIRS}") -message(STATUS "XTGeo Python executable ok: ${PYTHON_EXECUTABLE}") - # ====================================================================================== # Looking for numpy; need to avoid that weird old system numpy is used (aka RHEL6) # THIS WAS A PAIN TO DEBUG @@ -67,11 +24,7 @@ message(STATUS "XTGeo Python executable ok: ${PYTHON_EXECUTABLE}") # via https://github.com/DeepLearnPhysics/larcv3/blob/src/CMakeLists.txt # ====================================================================================== -if (POLICY CMP0053) - cmake_policy(SET CMP0053 OLD) -endif() - -if(NOT PYTHON_EXECUTABLE) +if(NOT Python_EXECUTABLE) if(NumPy_FIND_QUIETLY) find_package(PythonInterp QUIET) else() @@ -80,7 +33,7 @@ if(NOT PYTHON_EXECUTABLE) endif() endif() -if (PYTHON_EXECUTABLE) +if (Python_EXECUTABLE) # Find out the include path execute_process( COMMAND @PYTHON_EXECUTABLE@ -c @@ -94,7 +47,7 @@ if (PYTHON_EXECUTABLE) message(STATUS "Detected NumPy: ${__numpy_path}; version ${__numpy_version}") elseif(__numpy_out) message(ERROR "Python executable not found.") -endif(PYTHON_EXECUTABLE) +endif(Python_EXECUTABLE) find_path(PYTHON_NUMPY_INCLUDE_DIR numpy/arrayobject.h HINTS "${__numpy_path}" "${PYTHON_INCLUDE_PATH}" NO_DEFAULT_PATH) @@ -103,34 +56,92 @@ if(PYTHON_NUMPY_INCLUDE_DIR) set(PYTHON_NUMPY_FOUND 1 CACHE INTERNAL "Python numpy found") endif(PYTHON_NUMPY_INCLUDE_DIR) -message(STATUS "XTGeo Numpy include path: ${PYTHON_NUMPY_INCLUDE_DIR}") +message(STATUS "XTGeo Python include path: ${PYTHON_INCLUDE_PATH}") +message(STATUS "XTGeo Python include dirs: ${PYTHON_INCLUDE_DIRS}") +message(STATUS "XTGeo Python executable : ${PYTHON_EXECUTABLE}") +message(STATUS "XTGeo numpy include path : ${PYTHON_NUMPY_INCLUDE_DIR}") # ====================================================================================== -# Swigging and linking, with backward compatibility to older cmake versions +# Find swig # ====================================================================================== -message(STATUS "Swigging") -set(LIBRARYNAME cxtgeo) +# in case required SWIG is missing or too old and we are within Equinor, need a path to +# a SWIG version that works (RHEL7 have SWIG 2 by default which is too old) +if("$ENV{HOSTNAME}" MATCHES "statoil" AND CMAKE_SYSTEM_NAME MATCHES "Linux") + LIST(APPEND CMAKE_PROGRAM_PATH "/prog/res/opt/rhel7/swig_4.0.2/bin") + message(STATUS "Using Swig from /prog/res") +endif() -if (CMAKE_VERSION VERSION_GREATER 3.7) - swig_add_library(${LIBRARYNAME} LANGUAGE python SOURCES cxtgeo.i) -else() - swig_add_module(${LIBRARYNAME} python cxtgeo.i) +# ====================================================================================== +# Adjust policies +# ====================================================================================== + +# CMP0074: find_package() uses _ROOT variables. +# The OLD behavior for this policy is to ignore _ROOT variables. +# The NEW behavior for this policy is to use _ROOT variables. +cmake_policy(SET CMP0074 NEW) + +# CMP0078: UseSWIG generates standard target names. +# The OLD behavior for this policy relies on UseSWIG_TARGET_NAME_PREFERENCE +# variable that can be used to specify an explicit preference. +# The value may be one of: +# LEGACY: legacy strategy is applied. Variable SWIG_MODULE__REAL_NAME +# must be used to get real target name. This is the default if not specified. +# STANDARD: target name matches specified name. +if (POLICY CMP0078) + cmake_policy(SET CMP0078 OLD) +endif() + +# CMP0086: UseSWIG honors SWIG_MODULE_NAME via -module flag. +# The OLD behavior for this policy is to never pass -module option. +# The NEW behavior is to pass -module option to SWIG compiler if +# SWIG_MODULE_NAME is specified. +if (POLICY CMP0086) + cmake_policy(SET CMP0086 OLD) endif() -set(SWIGTARGET ${SWIG_MODULE_${LIBRARYNAME}_REAL_NAME}) +# ====================================================================================== +# Compile swig bindings +# ====================================================================================== -target_include_directories(${SWIGTARGET} PUBLIC - ${PYTHON_INCLUDE_DIRS} - ${PYTHON_NUMPY_INCLUDE_DIR} - ${CMAKE_CURRENT_LIST_DIR} - ) -target_compile_options(${SWIGTARGET} PUBLIC ${CXTGEOFLAGS}) +message(STATUS "Compiling swig bindings") -swig_link_libraries(${LIBRARYNAME} xtg ${PTHREAD_LIBRARY}) +if (MSVC) + set(XTGFLAGS /Ox /wd4996 /wd4267 /wd4244 /wd4305) + set(CXTGEOFLAGS /Ox /wd4996 /wd4267 /wd4244 /wd4305) +else() + set(XTGFLAGS -Wall -Wno-unused-but-set-variable -fPIC) + set(CXTGEOFLAGS -Wl,--no-undefined) +endif() +target_compile_options(xtg PRIVATE ${XTGFLAGS}) -python_extension_module(${SWIGTARGET}) +set(PYTHON_MODULE cxtgeo) +swig_add_library( + ${PYTHON_MODULE} + LANGUAGE python + OUTPUT_DIR "${SKBUILD_PLATLIB_DIR}" + SOURCES cxtgeo.i +) +set(SWIG_MODULE ${SWIG_MODULE_${PYTHON_MODULE}_REAL_NAME}) + +target_include_directories( + ${SWIG_MODULE} PUBLIC + ${PYTHON_INCLUDE_DIRS} + ${PYTHON_NUMPY_INCLUDE_DIR} + ${CMAKE_CURRENT_LIST_DIR}) +target_compile_options(${SWIG_MODULE} PUBLIC ${CXTGEOFLAGS}) +target_link_libraries(${SWIG_MODULE} xtg Python::Module) -set(CXTGEO src/xtgeo/cxtgeo) +# scikit-build-core docs recommend this +if(WIN32) + set_property(TARGET ${SWIG_MODULE} PROPERTY SUFFIX ".${Python_SOABI}.pyd") +else() + set_property( + TARGET ${SWIG_MODULE} + PROPERTY SUFFIX ".${Python_SOABI}${CMAKE_SHARED_MODULE_SUFFIX}") +endif() -install(TARGETS ${SWIGTARGET} LIBRARY DESTINATION ${CXTGEO}) +# Root installation directory is set in pyproject.toml +# SWIG_MODULE == _cxtgeo, so this installs to +# xtgeo.cxtgeo._cxtgeo +install(TARGETS ${SWIG_MODULE} LIBRARY DESTINATION ${PYTHON_MODULE}) diff --git a/src/xtgeo/common/__init__.py b/src/xtgeo/common/__init__.py index 377fdc73d..049094384 100644 --- a/src/xtgeo/common/__init__.py +++ b/src/xtgeo/common/__init__.py @@ -2,12 +2,8 @@ """The XTGeo common package""" -# flake8: noqa -from xtgeo.common.xtgeo_dialog import XTGeoDialog -from xtgeo.common.xtgeo_dialog import XTGDescription -from xtgeo.common.xtgeo_dialog import XTGShowProgress - -from xtgeo.common.sys import _XTGeoFile -from xtgeo.common.sys import inherit_docstring - from xtgeo.common.exceptions import WellNotFoundError +from xtgeo.common.sys import _XTGeoFile, inherit_docstring + +# flake8: noqa +from xtgeo.common.xtgeo_dialog import XTGDescription, XTGeoDialog, XTGShowProgress diff --git a/src/xtgeo/cube/__init__.py b/src/xtgeo/cube/__init__.py index 97282e5f7..65e839891 100644 --- a/src/xtgeo/cube/__init__.py +++ b/src/xtgeo/cube/__init__.py @@ -1,4 +1,6 @@ # -*- coding: utf-8 -*- """The XTGeo cube package.""" -from xtgeo.cube.cube1 import Cube # type: ignore # noqa # pylint: disable=undefined-variable +from xtgeo.cube.cube1 import ( # type: ignore # noqa # pylint: disable=undefined-variable + Cube, +) diff --git a/src/xtgeo/cube/_cube_export.py b/src/xtgeo/cube/_cube_export.py index 93c8db608..d258e8ebd 100644 --- a/src/xtgeo/cube/_cube_export.py +++ b/src/xtgeo/cube/_cube_export.py @@ -1,15 +1,15 @@ """Export Cube data via SegyIO library or XTGeo CLIB.""" +import json import shutil import struct -import json -import numpy as np +import numpy as np import segyio import xtgeo import xtgeo.cxtgeo._cxtgeo as _cxtgeo -from xtgeo.common import XTGeoDialog from xtgeo import XTGeoCLibError +from xtgeo.common import XTGeoDialog xtg = XTGeoDialog() diff --git a/src/xtgeo/grid3d/__init__.py b/src/xtgeo/grid3d/__init__.py index ca4e7325f..0bee383ca 100644 --- a/src/xtgeo/grid3d/__init__.py +++ b/src/xtgeo/grid3d/__init__.py @@ -11,5 +11,5 @@ from ._ecl_grid import GridRelative, Units from .grid import Grid -from .grid_property import GridProperty from .grid_properties import GridProperties +from .grid_property import GridProperty diff --git a/src/xtgeo/grid3d/_grid3d_fence.py b/src/xtgeo/grid3d/_grid3d_fence.py index 9e945ed75..426b93203 100644 --- a/src/xtgeo/grid3d/_grid3d_fence.py +++ b/src/xtgeo/grid3d/_grid3d_fence.py @@ -4,9 +4,9 @@ import numpy as np import xtgeo +import xtgeo.cxtgeo._cxtgeo as _cxtgeo from xtgeo.grid3d import _gridprop_lowlevel as gl from xtgeo.surface import _regsurf_lowlevel as rl -import xtgeo.cxtgeo._cxtgeo as _cxtgeo xtg = xtgeo.common.XTGeoDialog() logger = xtg.functionlogger(__name__) diff --git a/src/xtgeo/grid3d/_grid_etc1.py b/src/xtgeo/grid3d/_grid_etc1.py index 000a98e5d..ec6ade8a7 100644 --- a/src/xtgeo/grid3d/_grid_etc1.py +++ b/src/xtgeo/grid3d/_grid_etc1.py @@ -2,13 +2,14 @@ from collections import OrderedDict from copy import deepcopy -from packaging.version import parse as versionparse from math import atan2, degrees from typing import Tuple import numpy as np import numpy.ma as ma import pandas as pd +from packaging.version import parse as versionparse + import xtgeo import xtgeo.cxtgeo._cxtgeo as _cxtgeo from xtgeo.common import XTGeoDialog diff --git a/src/xtgeo/grid3d/_grid_refine.py b/src/xtgeo/grid3d/_grid_refine.py index 0c82cebdc..39d221239 100644 --- a/src/xtgeo/grid3d/_grid_refine.py +++ b/src/xtgeo/grid3d/_grid_refine.py @@ -1,10 +1,11 @@ # -*- coding: utf-8 -*- """Private module for refinement of a grid.""" from collections import OrderedDict + import numpy as np -from xtgeo.common import XTGeoDialog import xtgeo.cxtgeo._cxtgeo as _cxtgeo +from xtgeo.common import XTGeoDialog xtg = XTGeoDialog() diff --git a/src/xtgeo/grid3d/_grid_wellzone.py b/src/xtgeo/grid3d/_grid_wellzone.py index a346ba1f6..fa9c45ce4 100644 --- a/src/xtgeo/grid3d/_grid_wellzone.py +++ b/src/xtgeo/grid3d/_grid_wellzone.py @@ -1,6 +1,7 @@ """Private module for grid vs well zonelog checks.""" import numpy as np + import xtgeo xtg = xtgeo.common.XTGeoDialog() diff --git a/src/xtgeo/grid3d/_gridprop_import_roff.py b/src/xtgeo/grid3d/_gridprop_import_roff.py index 550e2e620..30f009eba 100644 --- a/src/xtgeo/grid3d/_gridprop_import_roff.py +++ b/src/xtgeo/grid3d/_gridprop_import_roff.py @@ -4,6 +4,7 @@ import warnings import numpy as np + import xtgeo from ._roff_parameter import RoffParameter diff --git a/src/xtgeo/grid3d/_gridprop_op1.py b/src/xtgeo/grid3d/_gridprop_op1.py index 6c81d0cba..c768532f2 100644 --- a/src/xtgeo/grid3d/_gridprop_op1.py +++ b/src/xtgeo/grid3d/_gridprop_op1.py @@ -4,9 +4,9 @@ import numpy as np import xtgeo +import xtgeo.cxtgeo._cxtgeo as _cxtgeo from xtgeo.common import XTGeoDialog from xtgeo.grid3d import _gridprop_lowlevel as gl -import xtgeo.cxtgeo._cxtgeo as _cxtgeo xtg = XTGeoDialog() diff --git a/src/xtgeo/grid3d/_gridprops_import_eclrun.py b/src/xtgeo/grid3d/_gridprops_import_eclrun.py index 3a5843760..f3daf3bd5 100644 --- a/src/xtgeo/grid3d/_gridprops_import_eclrun.py +++ b/src/xtgeo/grid3d/_gridprops_import_eclrun.py @@ -1,8 +1,9 @@ from copy import deepcopy from typing import List, Tuple, Union -import xtgeo from typing_extensions import Literal + +import xtgeo from xtgeo.common.constants import MAXKEYWORDS from . import _grid3d_utils as utils diff --git a/src/xtgeo/metadata/__init__.py b/src/xtgeo/metadata/__init__.py index 99529fffa..ffd35178b 100644 --- a/src/xtgeo/metadata/__init__.py +++ b/src/xtgeo/metadata/__init__.py @@ -2,5 +2,4 @@ # flake8: noqa """XTGeo metadata package.""" -from xtgeo.metadata.metadata import MetaDataRegularSurface -from xtgeo.metadata.metadata import MetaDataRegularCube +from xtgeo.metadata.metadata import MetaDataRegularCube, MetaDataRegularSurface diff --git a/src/xtgeo/plot/__init__.py b/src/xtgeo/plot/__init__.py index c27f7bbd4..b967ebbef 100644 --- a/src/xtgeo/plot/__init__.py +++ b/src/xtgeo/plot/__init__.py @@ -2,9 +2,10 @@ """The XTGeo plot package""" +from xtgeo.plot.grid3d_slice import Grid3DSlice + # flake8: noqa from xtgeo.plot.xsection import XSection from xtgeo.plot.xtmap import Map -from xtgeo.plot.grid3d_slice import Grid3DSlice # from ._colortables import random, random40, xtgeocolors, colorsfromfile diff --git a/src/xtgeo/plot/xtmap.py b/src/xtgeo/plot/xtmap.py index 7a170071c..778db6a9b 100644 --- a/src/xtgeo/plot/xtmap.py +++ b/src/xtgeo/plot/xtmap.py @@ -1,13 +1,14 @@ """Module for map plots of surfaces, using matplotlib.""" -import matplotlib.pyplot as plt import matplotlib.patches as mplp -from matplotlib import ticker +import matplotlib.pyplot as plt import numpy as np import numpy.ma as ma +from matplotlib import ticker from xtgeo.common import XTGeoDialog + from .baseplot import BasePlot xtg = XTGeoDialog() diff --git a/src/xtgeo/surface/_regsurf_cube_window_v2.py b/src/xtgeo/surface/_regsurf_cube_window_v2.py index 987fc8b39..b189ad00f 100644 --- a/src/xtgeo/surface/_regsurf_cube_window_v2.py +++ b/src/xtgeo/surface/_regsurf_cube_window_v2.py @@ -3,6 +3,7 @@ import numpy as np + import xtgeo import xtgeo.cxtgeo._cxtgeo as _cxtgeo from xtgeo.common import XTGeoDialog diff --git a/src/xtgeo/surface/_regsurf_import.py b/src/xtgeo/surface/_regsurf_import.py index 813336541..a05f472b8 100644 --- a/src/xtgeo/surface/_regsurf_import.py +++ b/src/xtgeo/surface/_regsurf_import.py @@ -8,6 +8,7 @@ import h5py import numpy as np import numpy.ma as ma + import xtgeo import xtgeo.common.sys as xsys import xtgeo.cxtgeo._cxtgeo as _cxtgeo # pylint: disable=no-name-in-module diff --git a/src/xtgeo/well/__init__.py b/src/xtgeo/well/__init__.py index 1ad210128..c1c2affd8 100644 --- a/src/xtgeo/well/__init__.py +++ b/src/xtgeo/well/__init__.py @@ -2,9 +2,9 @@ """The XTGeo well package""" +from .blocked_well import BlockedWell +from .blocked_wells import BlockedWells + # flake8: noqa from .well1 import Well from .wells import Wells - -from .blocked_well import BlockedWell -from .blocked_wells import BlockedWells diff --git a/src/xtgeo/well/_blockedwell_roxapi.py b/src/xtgeo/well/_blockedwell_roxapi.py index d86c56dc2..f824d7ccd 100644 --- a/src/xtgeo/well/_blockedwell_roxapi.py +++ b/src/xtgeo/well/_blockedwell_roxapi.py @@ -9,8 +9,8 @@ import pandas as pd from xtgeo.common import XTGeoDialog -from xtgeo.roxutils import RoxUtils from xtgeo.common.exceptions import WellNotFoundError +from xtgeo.roxutils import RoxUtils try: import roxar diff --git a/src/xtgeo/well/_blockedwells_roxapi.py b/src/xtgeo/well/_blockedwells_roxapi.py index a6a76ba0a..b50863c06 100644 --- a/src/xtgeo/well/_blockedwells_roxapi.py +++ b/src/xtgeo/well/_blockedwells_roxapi.py @@ -4,6 +4,7 @@ from xtgeo.common import XTGeoDialog from xtgeo.roxutils import RoxUtils + from .blocked_well import BlockedWell xtg = XTGeoDialog() diff --git a/src/xtgeo/well/_wellmarkers.py b/src/xtgeo/well/_wellmarkers.py index 43924a827..dbd069789 100644 --- a/src/xtgeo/well/_wellmarkers.py +++ b/src/xtgeo/well/_wellmarkers.py @@ -3,13 +3,14 @@ from collections import OrderedDict + import numpy as np import pandas as pd import xtgeo +import xtgeo.common.constants as const import xtgeo.cxtgeo._cxtgeo as _cxtgeo from xtgeo.common import XTGeoDialog -import xtgeo.common.constants as const xtg = XTGeoDialog() logger = xtg.functionlogger(__name__) diff --git a/src/xtgeo/well/_wells_utils.py b/src/xtgeo/well/_wells_utils.py index 8b60887dc..b82c2f153 100644 --- a/src/xtgeo/well/_wells_utils.py +++ b/src/xtgeo/well/_wells_utils.py @@ -3,12 +3,12 @@ import logging + import numpy as np import pandas as pd import shapely.geometry as sg -from xtgeo.common import XTGeoDialog -from xtgeo.common import XTGShowProgress +from xtgeo.common import XTGeoDialog, XTGShowProgress logger = logging.getLogger(__name__) logger.addHandler(logging.NullHandler()) diff --git a/src/xtgeo/xyz/_xyz_lowlevel.py b/src/xtgeo/xyz/_xyz_lowlevel.py index 8b90b9e1d..d646c5cb1 100644 --- a/src/xtgeo/xyz/_xyz_lowlevel.py +++ b/src/xtgeo/xyz/_xyz_lowlevel.py @@ -3,8 +3,9 @@ import numpy as np -from xtgeo.common import XTGeoDialog + import xtgeo.cxtgeo._cxtgeo as _cxtgeo +from xtgeo.common import XTGeoDialog xtg = XTGeoDialog() diff --git a/tests/conftest.py b/tests/conftest.py index 2e1243ab1..4630b01e7 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -1,9 +1,8 @@ # -*- coding: utf-8 -*- """Conftest functions""" -from packaging.version import parse as versionparse - import pandas as pd import pytest +from packaging.version import parse as versionparse class Helpers: diff --git a/tests/test_common/test_calc.py b/tests/test_common/test_calc.py index e651f1ec7..7afd4e8a8 100644 --- a/tests/test_common/test_calc.py +++ b/tests/test_common/test_calc.py @@ -4,6 +4,7 @@ import numpy as np import pytest + import xtgeo import xtgeo.common.calc as xcalc import xtgeo.cxtgeo._cxtgeo as _cxtgeo diff --git a/tests/test_cube/test_cube.py b/tests/test_cube/test_cube.py index b2fdb16c7..9ba5c25ce 100644 --- a/tests/test_cube/test_cube.py +++ b/tests/test_cube/test_cube.py @@ -5,8 +5,9 @@ import numpy as np import pytest import segyio -import xtgeo from hypothesis import HealthCheck, given, settings + +import xtgeo from xtgeo.common import XTGeoDialog from xtgeo.cube import Cube from xtgeo.cube._cube_import import ( diff --git a/tests/test_cube/test_cube_deprecations.py b/tests/test_cube/test_cube_deprecations.py index 6caa48da4..3b1b15605 100644 --- a/tests/test_cube/test_cube_deprecations.py +++ b/tests/test_cube/test_cube_deprecations.py @@ -1,4 +1,5 @@ import pytest + import xtgeo diff --git a/tests/test_etc/test_etc_make_avg_maps.py b/tests/test_etc/test_etc_make_avg_maps.py index c26a18764..2337f1153 100644 --- a/tests/test_etc/test_etc_make_avg_maps.py +++ b/tests/test_etc/test_etc_make_avg_maps.py @@ -2,6 +2,7 @@ import numpy as np import pytest + import xtgeo from xtgeo.common import XTGeoDialog from xtgeo.surface import RegularSurface diff --git a/tests/test_grid3d/eclrun_fixtures.py b/tests/test_grid3d/eclrun_fixtures.py index 0846af879..5bca994ef 100644 --- a/tests/test_grid3d/eclrun_fixtures.py +++ b/tests/test_grid3d/eclrun_fixtures.py @@ -1,6 +1,7 @@ from os.path import join import pytest + import xtgeo diff --git a/tests/test_grid3d/test_ecl_inte_head.py b/tests/test_grid3d/test_ecl_inte_head.py index 2415e895b..210866ebb 100644 --- a/tests/test_grid3d/test_ecl_inte_head.py +++ b/tests/test_grid3d/test_ecl_inte_head.py @@ -1,5 +1,6 @@ import numpy as np import pytest + from xtgeo.grid3d._ecl_inte_head import InteHead, Phases from xtgeo.grid3d._ecl_output_file import Simulator, TypeOfGrid, UnitSystem diff --git a/tests/test_grid3d/test_eclrun.py b/tests/test_grid3d/test_eclrun.py index 9d968f7fe..1dc000df1 100644 --- a/tests/test_grid3d/test_eclrun.py +++ b/tests/test_grid3d/test_eclrun.py @@ -3,6 +3,7 @@ import numpy as np import pytest + import xtgeo # pylint: disable=wildcard-import, unused-wildcard-import diff --git a/tests/test_grid3d/test_grid.py b/tests/test_grid3d/test_grid.py index 904219c3c..002d14fea 100644 --- a/tests/test_grid3d/test_grid.py +++ b/tests/test_grid3d/test_grid.py @@ -6,8 +6,9 @@ import numpy as np import pytest -import xtgeo from hypothesis import given + +import xtgeo from xtgeo.common import XTGeoDialog from xtgeo.grid3d import Grid diff --git a/tests/test_grid3d/test_grid_bytesio.py b/tests/test_grid3d/test_grid_bytesio.py index bc52012d6..f3c22b1be 100644 --- a/tests/test_grid3d/test_grid_bytesio.py +++ b/tests/test_grid3d/test_grid_bytesio.py @@ -6,6 +6,7 @@ import io import numpy as np + import xtgeo from xtgeo.common import XTGeoDialog diff --git a/tests/test_grid3d/test_grid_ecl_grid.py b/tests/test_grid3d/test_grid_ecl_grid.py index 64e121a5b..02c78748e 100644 --- a/tests/test_grid3d/test_grid_ecl_grid.py +++ b/tests/test_grid3d/test_grid_ecl_grid.py @@ -1,11 +1,12 @@ import hypothesis.strategies as st import numpy as np import pytest +from hypothesis import HealthCheck, assume, given, settings +from numpy.testing import assert_allclose + import xtgeo import xtgeo.grid3d._egrid as xtg_egrid import xtgeo.grid3d._grdecl_grid as ggrid -from hypothesis import HealthCheck, assume, given, settings -from numpy.testing import assert_allclose from xtgeo.grid3d._ecl_grid import ( inverse_transform_xtgeo_coord_by_mapaxes, transform_xtgeo_coord_by_mapaxes, diff --git a/tests/test_grid3d/test_grid_egrid.py b/tests/test_grid3d/test_grid_egrid.py index adcb309a8..531ed86b0 100644 --- a/tests/test_grid3d/test_grid_egrid.py +++ b/tests/test_grid3d/test_grid_egrid.py @@ -5,9 +5,10 @@ import hypothesis.strategies as st import numpy as np import pytest +from hypothesis import HealthCheck, assume, given, settings + import xtgeo as xtg import xtgeo.grid3d._egrid as xtge -from hypothesis import HealthCheck, assume, given, settings from .egrid_generator import ( egrids, diff --git a/tests/test_grid3d/test_grid_grdecl.py b/tests/test_grid3d/test_grid_grdecl.py index 45cc118ca..6fa87c181 100644 --- a/tests/test_grid3d/test_grid_grdecl.py +++ b/tests/test_grid3d/test_grid_grdecl.py @@ -5,10 +5,11 @@ import hypothesis.strategies as st import numpy as np import pytest +from hypothesis import HealthCheck, assume, given, settings + import xtgeo import xtgeo.grid3d._ecl_grid as ecl_grid import xtgeo.grid3d._grdecl_grid as ggrid -from hypothesis import HealthCheck, assume, given, settings from xtgeo.grid3d import Grid from xtgeo.grid3d._grdecl_format import open_grdecl from xtgeo.grid3d._grid_import_ecl import grid_from_ecl_grid diff --git a/tests/test_grid3d/test_grid_property_grdecl.py b/tests/test_grid3d/test_grid_property_grdecl.py index d6d686951..4725f27e5 100644 --- a/tests/test_grid3d/test_grid_property_grdecl.py +++ b/tests/test_grid3d/test_grid_property_grdecl.py @@ -4,9 +4,10 @@ import hypothesis.strategies as st import numpy as np import pytest -import xtgeo from hypothesis import HealthCheck, assume, given, settings from numpy.testing import assert_allclose + +import xtgeo from xtgeo.grid3d._gridprop_import_grdecl import read_grdecl_3d_property from .grid_generator import xtgeo_grids as grids diff --git a/tests/test_grid3d/test_grid_vs_points.py b/tests/test_grid3d/test_grid_vs_points.py index dcbd8786f..d4a9f2d17 100644 --- a/tests/test_grid3d/test_grid_vs_points.py +++ b/tests/test_grid3d/test_grid_vs_points.py @@ -2,6 +2,7 @@ import pandas as pd import pytest + import xtgeo xtg = xtgeo.common.XTGeoDialog() diff --git a/tests/test_grid3d/test_grid_xtgformats_io.py b/tests/test_grid3d/test_grid_xtgformats_io.py index ebebbd547..e3a1e3b40 100644 --- a/tests/test_grid3d/test_grid_xtgformats_io.py +++ b/tests/test_grid3d/test_grid_xtgformats_io.py @@ -6,9 +6,10 @@ import hypothesis.strategies as st import numpy as np import pytest -import xtgeo from hypothesis import HealthCheck, given, settings from numpy.testing import assert_allclose + +import xtgeo from xtgeo.common import XTGeoDialog xtg = XTGeoDialog() diff --git a/tests/test_grid3d/test_gridprop_import_eclrun.py b/tests/test_grid3d/test_gridprop_import_eclrun.py index e84056111..a4b07382c 100644 --- a/tests/test_grid3d/test_gridprop_import_eclrun.py +++ b/tests/test_grid3d/test_gridprop_import_eclrun.py @@ -8,9 +8,10 @@ import hypothesis.strategies as st import numpy as np import pytest +from hypothesis import HealthCheck, assume, given, settings + import xtgeo import xtgeo.grid3d._find_gridprop_in_eclrun as xtg_im_ecl -from hypothesis import HealthCheck, assume, given, settings from xtgeo.grid3d._ecl_inte_head import InteHead from xtgeo.grid3d._ecl_logi_head import LogiHead from xtgeo.grid3d._ecl_output_file import Phases diff --git a/tests/test_plot/test_colortables.py b/tests/test_plot/test_colortables.py index 26818afcc..87dfe4be1 100644 --- a/tests/test_plot/test_colortables.py +++ b/tests/test_plot/test_colortables.py @@ -1,5 +1,6 @@ # -*- coding: utf-8 -*- import sys + import xtgeo.plot._colortables as ct from xtgeo.common import XTGeoDialog diff --git a/tests/test_surface/test_forks.py b/tests/test_surface/test_forks.py index 624422d34..6ccbc56dd 100644 --- a/tests/test_surface/test_forks.py +++ b/tests/test_surface/test_forks.py @@ -1,6 +1,7 @@ # coding: utf-8 import subprocess + import xtgeo xtg = xtgeo.common.XTGeoDialog() diff --git a/tests/test_surface/test_regular_surface_vs_points.py b/tests/test_surface/test_regular_surface_vs_points.py index 576345e37..1c607467c 100644 --- a/tests/test_surface/test_regular_surface_vs_points.py +++ b/tests/test_surface/test_regular_surface_vs_points.py @@ -1,6 +1,7 @@ from os.path import join import pytest + import xtgeo from xtgeo.common import XTGeoDialog from xtgeo.surface import RegularSurface diff --git a/tests/test_surface/test_surf_xyz_from_ij.py b/tests/test_surface/test_surf_xyz_from_ij.py index d3f170061..87183f708 100644 --- a/tests/test_surface/test_surf_xyz_from_ij.py +++ b/tests/test_surface/test_surf_xyz_from_ij.py @@ -1,7 +1,8 @@ +import numpy as np import pytest -import xtgeo.cxtgeo._cxtgeo as _cxtgeo # type: ignore + import xtgeo -import numpy as np +import xtgeo.cxtgeo._cxtgeo as _cxtgeo # type: ignore class Surface: diff --git a/tests/test_surface/test_zmap_spec.py b/tests/test_surface/test_zmap_spec.py index 52df5457e..225286bc1 100644 --- a/tests/test_surface/test_zmap_spec.py +++ b/tests/test_surface/test_zmap_spec.py @@ -2,6 +2,7 @@ from pathlib import Path import pytest + import xtgeo from xtgeo.surface._zmap_parser import ZMAPFormatException, ZMAPSurface, parse_zmap diff --git a/tests/test_well/conftest.py b/tests/test_well/conftest.py index c9f374bc6..800df50b5 100644 --- a/tests/test_well/conftest.py +++ b/tests/test_well/conftest.py @@ -1,4 +1,5 @@ import pytest + import xtgeo diff --git a/tests/test_well/test_blockedwell.py b/tests/test_well/test_blockedwell.py index 3fe3a0ad2..629dd4035 100644 --- a/tests/test_well/test_blockedwell.py +++ b/tests/test_well/test_blockedwell.py @@ -4,6 +4,7 @@ from os.path import join import pytest + import xtgeo from xtgeo.common import XTGeoDialog diff --git a/tests/test_well/test_blockedwells.py b/tests/test_well/test_blockedwells.py index 024b6db0a..cf0340ebb 100644 --- a/tests/test_well/test_blockedwells.py +++ b/tests/test_well/test_blockedwells.py @@ -4,6 +4,7 @@ from os.path import join import pytest + import xtgeo from xtgeo.common import XTGeoDialog from xtgeo.well import BlockedWells diff --git a/tests/test_well/test_well.py b/tests/test_well/test_well.py index 2a991114a..69ec0c205 100644 --- a/tests/test_well/test_well.py +++ b/tests/test_well/test_well.py @@ -260,6 +260,7 @@ def test_shortwellname(create_well): assert short == "A-142H" +@pytest.mark.skipif(sys.platform.startswith("darwin"), reason="No pytables on macOS") def test_hdf_io_single(tmp_path): """Test HDF io, single well.""" mywell = xtgeo.well_from_file(WELL1) @@ -270,6 +271,7 @@ def test_hdf_io_single(tmp_path): assert mywell2.nrow == mywell.nrow +@pytest.mark.skipif(sys.platform.startswith("darwin"), reason="No pytables on macOS") def test_import_as_rms_export_as_hdf_many(tmp_path, simple_well): """Import RMS and export as HDF5 and RMS asc, many, and compare timings.""" t0 = xtg.timer() diff --git a/tests/test_well/test_well_deprecations.py b/tests/test_well/test_well_deprecations.py index eecde0c4e..3dc47c783 100644 --- a/tests/test_well/test_well_deprecations.py +++ b/tests/test_well/test_well_deprecations.py @@ -1,6 +1,7 @@ import pytest -import xtgeo from packaging import version + +import xtgeo from xtgeo import Well from xtgeo import version as xtgeo_version diff --git a/tests/test_well/test_well_to_points.py b/tests/test_well/test_well_to_points.py index 7568c4aed..3fa4f3460 100644 --- a/tests/test_well/test_well_to_points.py +++ b/tests/test_well/test_well_to_points.py @@ -1,4 +1,5 @@ import pytest + import xtgeo from xtgeo.common import XTGeoDialog diff --git a/tests/test_well/test_well_vs_grid.py b/tests/test_well/test_well_vs_grid.py index 5265c88ab..f9b2c83bc 100644 --- a/tests/test_well/test_well_vs_grid.py +++ b/tests/test_well/test_well_vs_grid.py @@ -4,6 +4,7 @@ from os.path import join import pytest + import xtgeo from xtgeo.common import XTGeoDialog diff --git a/tests/test_well/test_well_vs_surface.py b/tests/test_well/test_well_vs_surface.py index 98405673b..6d749d690 100644 --- a/tests/test_well/test_well_vs_surface.py +++ b/tests/test_well/test_well_vs_surface.py @@ -4,6 +4,7 @@ from os.path import join import pytest + import xtgeo xtg = xtgeo.common.XTGeoDialog() diff --git a/tests/test_well/test_wells.py b/tests/test_well/test_wells.py index 169a60e37..e9ed8e151 100644 --- a/tests/test_well/test_wells.py +++ b/tests/test_well/test_wells.py @@ -4,6 +4,7 @@ from os.path import join import pytest + import xtgeo from xtgeo.common import XTGeoDialog from xtgeo.well import Wells diff --git a/tests/test_xyz/test_points.py b/tests/test_xyz/test_points.py index 680c7884e..5070ff69f 100644 --- a/tests/test_xyz/test_points.py +++ b/tests/test_xyz/test_points.py @@ -4,9 +4,10 @@ import numpy as np import pandas as pd import pytest -import xtgeo from hypothesis import given, settings from hypothesis import strategies as st + +import xtgeo from xtgeo.xyz import Points PFILE = pathlib.Path("points/eme/1/emerald_10_random.poi") diff --git a/tests/test_xyz/test_points_from_surface.py b/tests/test_xyz/test_points_from_surface.py index 8775e5d03..7a1a27a21 100644 --- a/tests/test_xyz/test_points_from_surface.py +++ b/tests/test_xyz/test_points_from_surface.py @@ -1,6 +1,7 @@ import pathlib import pandas as pd + import xtgeo SURFACE = pathlib.Path("surfaces/reek/1/topreek_rota.gri") diff --git a/tests/test_xyz/test_points_from_wells.py b/tests/test_xyz/test_points_from_wells.py index a4f8025eb..7433bd206 100644 --- a/tests/test_xyz/test_points_from_wells.py +++ b/tests/test_xyz/test_points_from_wells.py @@ -2,6 +2,7 @@ import pathlib import pytest + import xtgeo from xtgeo.xyz import Points diff --git a/tests/test_xyz/test_points_vs_other.py b/tests/test_xyz/test_points_vs_other.py index e8db32aea..8d5d67211 100644 --- a/tests/test_xyz/test_points_vs_other.py +++ b/tests/test_xyz/test_points_vs_other.py @@ -1,6 +1,7 @@ import pathlib import pytest + import xtgeo SFILE1A = pathlib.Path("surfaces/reek/1/topupperreek.gri") diff --git a/tests/test_xyz/test_xyz_deprecated.py b/tests/test_xyz/test_xyz_deprecated.py index c5bd9e9e0..800e5f2bf 100644 --- a/tests/test_xyz/test_xyz_deprecated.py +++ b/tests/test_xyz/test_xyz_deprecated.py @@ -4,8 +4,9 @@ import pandas as pd import pytest -import xtgeo from packaging import version + +import xtgeo from xtgeo import version as xtgeo_version PFILE1A = pathlib.Path("polygons/reek/1/top_upper_reek_faultpoly.zmap") diff --git a/tests/test_xyz/test_xyz_roxapi_mock.py b/tests/test_xyz/test_xyz_roxapi_mock.py index 40339793a..fc3882c2b 100644 --- a/tests/test_xyz/test_xyz_roxapi_mock.py +++ b/tests/test_xyz/test_xyz_roxapi_mock.py @@ -5,9 +5,10 @@ import numpy as np import pandas as pd import pytest -import xtgeo from pandas.testing import assert_frame_equal +import xtgeo + @pytest.fixture def point_set():