Skip to content

Commit

Permalink
CLN: Install _cxtgeo in the root module
Browse files Browse the repository at this point in the history
Previously the C module was installed in a public module of the same
name due the difficulty of adjusting the installation location in the
now previous scikit-build package. This makes it properly private.
  • Loading branch information
mferrera committed Nov 20, 2023
1 parent 9e24f9b commit d789b58
Show file tree
Hide file tree
Showing 36 changed files with 37 additions and 45 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ cmake.minimum-version = "3.15.3"
cmake.verbose = true
metadata.version.provider = "scikit_build_core.metadata.setuptools_scm"
sdist.include = ["src/xtgeo/_theversion.py"]
wheel.install-dir = "xtgeo/cxtgeo"
wheel.install-dir = "xtgeo"

[project]
name = "xtgeo"
Expand Down
2 changes: 1 addition & 1 deletion src/xtgeo/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ def _xprint(msg):
#
_xprint("Import matplotlib etc...DONE")

from xtgeo._cxtgeo import XTGeoCLibError
from xtgeo.common import XTGeoDialog
from xtgeo.common.constants import UNDEF, UNDEF_INT, UNDEF_INT_LIMIT, UNDEF_LIMIT
from xtgeo.common.exceptions import (
Expand All @@ -90,7 +91,6 @@ def _xprint(msg):
WellNotFoundError,
)
from xtgeo.common.sys import _XTGeoFile
from xtgeo.cxtgeo._cxtgeo import XTGeoCLibError

_xprint("Import common... done")

Expand Down
3 changes: 1 addition & 2 deletions src/xtgeo/common/calc.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,8 @@

import numpy as np

from xtgeo import XTGeoCLibError
from xtgeo import XTGeoCLibError, _cxtgeo
from xtgeo.common import XTGeoDialog, null_logger
from xtgeo.cxtgeo import _cxtgeo

xtg = XTGeoDialog()
logger = null_logger(__name__)
Expand Down
6 changes: 3 additions & 3 deletions src/xtgeo/common/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"""Module for basic XTGeo constants"""

# align with cxtgeo libxtg.h!
import xtgeo.cxtgeo._cxtgeo as cx
from xtgeo import _cxtgeo

M_PI = 3.14159265358979323846
PI = M_PI
Expand All @@ -19,8 +19,8 @@
UNDEF_MAP_IRAPB = 1e30
UNDEF_MAP_IRAPA = 9999900.0000

MAXKEYWORDS = cx.MAXKEYWORDS # maximum keywords for ECL and ROFF scanning
MAXDATES = cx.MAXDATES # maximum keywords for ECL scanning
MAXKEYWORDS = _cxtgeo.MAXKEYWORDS # maximum keywords for ECL and ROFF scanning
MAXDATES = _cxtgeo.MAXDATES # maximum keywords for ECL scanning

# for XYZ data, restricted to float32 and int32
UNDEF_CONT = UNDEF
Expand Down
2 changes: 1 addition & 1 deletion src/xtgeo/common/sys.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
import h5py
import numpy as np

from xtgeo.cxtgeo import _cxtgeo
from xtgeo import _cxtgeo

from . import null_logger
from ._xyz_enum import _AttrType
Expand Down
3 changes: 1 addition & 2 deletions src/xtgeo/cube/_cube_export.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@
import segyio

import xtgeo
import xtgeo.cxtgeo._cxtgeo as _cxtgeo
from xtgeo import XTGeoCLibError
from xtgeo import XTGeoCLibError, _cxtgeo
from xtgeo.common import XTGeoDialog, null_logger

logger = null_logger(__name__)
Expand Down
2 changes: 1 addition & 1 deletion src/xtgeo/cube/_cube_import.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
import xtgeo
import xtgeo.common.calc as xcalc
import xtgeo.common.sys as xsys
import xtgeo.cxtgeo._cxtgeo as _cxtgeo
from xtgeo import _cxtgeo
from xtgeo.common import XTGeoDialog, null_logger

xtg = XTGeoDialog()
Expand Down
3 changes: 1 addition & 2 deletions src/xtgeo/cube/_cube_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
import numpy as np

import xtgeo
import xtgeo.cxtgeo._cxtgeo as _cxtgeo
from xtgeo import XTGeoCLibError
from xtgeo import XTGeoCLibError, _cxtgeo
from xtgeo.common import null_logger
from xtgeo.common.calc import _swap_axes

Expand Down
1 change: 0 additions & 1 deletion src/xtgeo/cxtgeo/__init__.py

This file was deleted.

2 changes: 1 addition & 1 deletion src/xtgeo/grid3d/_grid3d_fence.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import numpy as np

import xtgeo
import xtgeo.cxtgeo._cxtgeo as _cxtgeo
from xtgeo import _cxtgeo
from xtgeo.common import null_logger
from xtgeo.grid3d import _gridprop_lowlevel as gl
from xtgeo.surface import _regsurf_lowlevel as rl
Expand Down
3 changes: 1 addition & 2 deletions src/xtgeo/grid3d/_grid3d_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@

import pandas as pd

import xtgeo.cxtgeo._cxtgeo as _cxtgeo
from xtgeo import XTGeoCLibError
from xtgeo import XTGeoCLibError, _cxtgeo
from xtgeo.common import null_logger
from xtgeo.common.constants import MAXDATES, MAXKEYWORDS

Expand Down
2 changes: 1 addition & 1 deletion src/xtgeo/grid3d/_grid_etc1.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
from packaging.version import parse as versionparse

import xtgeo
import xtgeo.cxtgeo._cxtgeo as _cxtgeo
from xtgeo import _cxtgeo
from xtgeo.common import null_logger
from xtgeo.common.calc import find_flip
from xtgeo.xyz.polygons import Polygons
Expand Down
2 changes: 1 addition & 1 deletion src/xtgeo/grid3d/_grid_hybrid.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import numpy as np

import xtgeo
import xtgeo.cxtgeo._cxtgeo as _cxtgeo
from xtgeo import _cxtgeo
from xtgeo.common import null_logger

logger = null_logger(__name__)
Expand Down
2 changes: 1 addition & 1 deletion src/xtgeo/grid3d/_grid_refine.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

import numpy as np

import xtgeo.cxtgeo._cxtgeo as _cxtgeo
from xtgeo import _cxtgeo
from xtgeo.common import XTGeoDialog, null_logger

xtg = XTGeoDialog()
Expand Down
3 changes: 1 addition & 2 deletions src/xtgeo/grid3d/_grid_roxapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@
import numpy as np

import xtgeo
import xtgeo.cxtgeo._cxtgeo as _cxtgeo
from xtgeo import RoxUtils
from xtgeo import RoxUtils, _cxtgeo
from xtgeo.common import XTGeoDialog, null_logger

xtg = XTGeoDialog()
Expand Down
2 changes: 1 addition & 1 deletion src/xtgeo/grid3d/_gridprop_lowlevel.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import numpy.ma as ma

import xtgeo
import xtgeo.cxtgeo._cxtgeo as _cxtgeo
from xtgeo import _cxtgeo
from xtgeo.common import null_logger

logger = null_logger(__name__)
Expand Down
2 changes: 1 addition & 1 deletion src/xtgeo/grid3d/_gridprop_op1.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import numpy as np

import xtgeo
import xtgeo.cxtgeo._cxtgeo as _cxtgeo
from xtgeo import _cxtgeo
from xtgeo.common import XTGeoDialog, null_logger
from xtgeo.grid3d import _gridprop_lowlevel as gl

Expand Down
2 changes: 1 addition & 1 deletion src/xtgeo/grid3d/_roff_grid.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import numpy as np
import roffio

import xtgeo.cxtgeo._cxtgeo as _cxtgeo
from xtgeo import _cxtgeo

if TYPE_CHECKING:
from xtgeo.grid3d import Grid
Expand Down
2 changes: 1 addition & 1 deletion src/xtgeo/surface/_regsurf_cube.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import numpy as np

import xtgeo
import xtgeo.cxtgeo._cxtgeo as _cxtgeo
from xtgeo import _cxtgeo
from xtgeo.common import null_logger

logger = null_logger(__name__)
Expand Down
2 changes: 1 addition & 1 deletion src/xtgeo/surface/_regsurf_cube_window_v2.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import numpy as np

import xtgeo
import xtgeo.cxtgeo._cxtgeo as _cxtgeo
from xtgeo import _cxtgeo
from xtgeo.common import null_logger

logger = null_logger(__name__)
Expand Down
2 changes: 1 addition & 1 deletion src/xtgeo/surface/_regsurf_export.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import numpy as np

import xtgeo
import xtgeo.cxtgeo._cxtgeo as _cxtgeo # pylint: disable=import-error
from xtgeo import _cxtgeo
from xtgeo.common import null_logger
from xtgeo.common.constants import UNDEF_MAP_IRAPA, UNDEF_MAP_IRAPB

Expand Down
2 changes: 1 addition & 1 deletion src/xtgeo/surface/_regsurf_grid3d.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import numpy.ma as ma

import xtgeo
import xtgeo.cxtgeo._cxtgeo as _cxtgeo
from xtgeo import _cxtgeo
from xtgeo.common import null_logger
from xtgeo.grid3d import _gridprop_lowlevel

Expand Down
2 changes: 1 addition & 1 deletion src/xtgeo/surface/_regsurf_import.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

import xtgeo
import xtgeo.common.sys as xsys
import xtgeo.cxtgeo._cxtgeo as _cxtgeo # pylint: disable=no-name-in-module
from xtgeo import _cxtgeo
from xtgeo.common import XTGeoDialog, null_logger
from xtgeo.common.constants import UNDEF_MAP_IRAPA, UNDEF_MAP_IRAPB
from xtgeo.surface._zmap_parser import parse_zmap
Expand Down
2 changes: 1 addition & 1 deletion src/xtgeo/surface/_regsurf_lowlevel.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""RegularSurface utilities (low level)"""

import xtgeo.cxtgeo._cxtgeo as _cxtgeo
from xtgeo import _cxtgeo
from xtgeo.common import XTGeoDialog

xtg = XTGeoDialog()
Expand Down
3 changes: 1 addition & 2 deletions src/xtgeo/surface/_regsurf_oper.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@
from matplotlib.path import Path as MPath

import xtgeo
import xtgeo.cxtgeo._cxtgeo as _cxtgeo # type: ignore
from xtgeo import XTGeoCLibError
from xtgeo import XTGeoCLibError, _cxtgeo
from xtgeo.common import XTGeoDialog, null_logger
from xtgeo.xyz import Polygons

Expand Down
2 changes: 1 addition & 1 deletion src/xtgeo/well/_well_oper.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import pandas as pd

import xtgeo
import xtgeo.cxtgeo._cxtgeo as _cxtgeo # type: ignore
from xtgeo import _cxtgeo
from xtgeo.common import constants as const
from xtgeo.common import null_logger
from xtgeo.common._xyz_enum import _AttrType
Expand Down
2 changes: 1 addition & 1 deletion src/xtgeo/well/_wellmarkers.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

import xtgeo
import xtgeo.common.constants as const
import xtgeo.cxtgeo._cxtgeo as _cxtgeo # type: ignore
from xtgeo import _cxtgeo
from xtgeo.common import null_logger

logger = null_logger(__name__)
Expand Down
2 changes: 1 addition & 1 deletion src/xtgeo/well/well1.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

import xtgeo
import xtgeo.common.constants as const
import xtgeo.cxtgeo._cxtgeo as _cxtgeo # type: ignore
from xtgeo import _cxtgeo # type: ignore
from xtgeo.common import _AttrType, null_logger
from xtgeo.xyz import _xyz_data # type: ignore[attr-defined]

Expand Down
3 changes: 1 addition & 2 deletions src/xtgeo/xyz/_xyz_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,9 @@
from joblib import hash as jhash

import xtgeo.common.constants as const
from xtgeo import XTGeoCLibError, _cxtgeo
from xtgeo.common import null_logger
from xtgeo.common.sys import _convert_carr_double_np, _get_carray
from xtgeo.cxtgeo import _cxtgeo
from xtgeo.cxtgeo._cxtgeo import XTGeoCLibError # type: ignore[attr-defined]

from ..common._xyz_enum import _AttrName, _AttrType, _XYZType

Expand Down
2 changes: 1 addition & 1 deletion src/xtgeo/xyz/_xyz_lowlevel.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

import numpy as np

import xtgeo.cxtgeo._cxtgeo as _cxtgeo
from xtgeo import _cxtgeo
from xtgeo.common import null_logger

logger = null_logger(__name__)
Expand Down
2 changes: 1 addition & 1 deletion src/xtgeo/xyz/_xyz_oper.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from scipy.interpolate import UnivariateSpline, interp1d

import xtgeo
import xtgeo.cxtgeo._cxtgeo as _cxtgeo
from xtgeo import _cxtgeo
from xtgeo.common import XTGeoDialog, null_logger

xtg = XTGeoDialog()
Expand Down
2 changes: 1 addition & 1 deletion tests/test_common/test_calc.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import xtgeo
import xtgeo.common.calc as xcalc
import xtgeo.cxtgeo._cxtgeo as _cxtgeo
from xtgeo import _cxtgeo

xtg = xtgeo.XTGeoDialog()
logger = xtg.basiclogger(__name__)
Expand Down
2 changes: 1 addition & 1 deletion tests/test_common/test_cxtgeo_lowlevel.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import pytest

import xtgeo
import xtgeo.cxtgeo._cxtgeo as _cxtgeo
from xtgeo import _cxtgeo

xtg = xtgeo.XTGeoDialog()
logger = xtg.basiclogger(__name__)
Expand Down
2 changes: 1 addition & 1 deletion tests/test_etc/test_clib_errors.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import pytest

import xtgeo
from xtgeo.cxtgeo import _cxtgeo
from xtgeo import _cxtgeo


@pytest.fixture()
Expand Down
2 changes: 1 addition & 1 deletion tests/test_grid3d/test_grid_roff.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from hypothesis.extra.numpy import arrays
from numpy.testing import assert_allclose

import xtgeo.cxtgeo._cxtgeo as _cxtgeo
from xtgeo import _cxtgeo
from xtgeo.grid3d import Grid
from xtgeo.grid3d._grid_import_roff import handle_deprecated_xtgeo_roff_file
from xtgeo.grid3d._roff_grid import RoffGrid
Expand Down
2 changes: 1 addition & 1 deletion tests/test_surface/test_surf_xyz_from_ij.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import pytest

import xtgeo
import xtgeo.cxtgeo._cxtgeo as _cxtgeo # type: ignore
from xtgeo import _cxtgeo


class Surface:
Expand Down

0 comments on commit d789b58

Please sign in to comment.