Skip to content

Commit

Permalink
BLD: skip support for python 3.8
Browse files Browse the repository at this point in the history
  • Loading branch information
jcrivenaes committed Jan 8, 2025
1 parent 19a0443 commit ffb9cbc
Show file tree
Hide file tree
Showing 8 changed files with 126 additions and 94 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/mypy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
mypy:
strategy:
matrix:
python-version: ["3.8", "3.11"]
python-version: ["3.9", "3.12"]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand Down
9 changes: 3 additions & 6 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,17 @@ jobs:
strategy:
fail-fast: false
matrix:
python:
- ['3.8', cp38]
python:
- ['3.9', cp39]
- ['3.10', cp310]
- ['3.11', cp311]
- ['3.12', cp312]
os_arch:
os_arch:
- [ubuntu-latest, manylinux_x86_64]
- [windows-latest, win_amd64]
- [macos-13, macosx_x86_64] # macos-13 is the last x86-64 runner
- [macos-latest, macosx_arm64] # macos-latest is always arm64 going forward
exclude:
- os_arch: [macos-latest, macosx_arm64]
python: ['3.8', cp38]
- os_arch: [macos-latest, macosx_arm64]
python: ['3.9', cp39]
env:
Expand All @@ -38,7 +35,7 @@ jobs:
with:
fetch-depth: 0

- name: Set up Python
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python[0] }}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@ jobs:
timeout-minutes: 15
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
python-version: ["3.9", "3.10", "3.11", "3.12"]
os: [ubuntu-latest]
include:
- os: macos-latest
python-version: "3.10"
- os: macos-latest
python-version: 3.12
- os: windows-latest
python-version: 3.8
python-version: 3.9
- os: windows-latest
python-version: 3.12

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Detailed documentation for [XTGeo at Read _the_ Docs](https://xtgeo.readthedocs.

## Feature summary

- Python 3.8+ support
- Python 3.9+ support
- Focus on high speed, using numpy and pandas with C backend
- Regular surfaces, i.e. 2D maps with regular sampling and rotation
- 3D grids (corner-point), supporting several formats such as
Expand Down
6 changes: 2 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ requires = [
"pybind11",
"scikit-build-core[pyproject]>=0.10",
"swig<4.3.0",
"numpy==1.19.2; python_version == '3.8'",
"numpy>=2.0.0; python_version > '3.8'",
"numpy>=2.0.0; python_version >= '3.9'",
]

build-backend = "scikit_build_core.build"
Expand All @@ -20,7 +19,7 @@ wheel.install-dir = "xtgeo"
name = "xtgeo"
description = "XTGeo is a Python library for 3D grids, surfaces, wells, etc"
readme = "README.md"
requires-python = ">=3.8"
requires-python = ">=3.9"
license = { text = "LGPL-3.0" }
authors = [{ name = "Equinor", email = "[email protected]" }]
keywords = ["grids", "surfaces", "wells", "cubes"]
Expand All @@ -34,7 +33,6 @@ classifiers = [
"Operating System :: MacOS",
"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",
Expand Down
114 changes: 68 additions & 46 deletions tests/test_grid3d/test_grdecl_format.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,16 @@
],
)
def test_read_simple_property(file_data):
with patch(
"builtins.open",
mock_open(read_data=file_data),
) as mock_file, open_grdecl(
mock_file,
keywords=["PROP"],
) as kw:
with (
patch(
"builtins.open",
mock_open(read_data=file_data),
) as mock_file,
open_grdecl(
mock_file,
keywords=["PROP"],
) as kw,
):
assert list(kw) == [("PROP", ["1", "2", "3", "4"])]


Expand All @@ -37,34 +40,43 @@ def test_read_simple_property(file_data):
)
def test_read_repeated_property(repeats, value):
inp_str = f"PROP\n {repeats}*{value} /\n"
with patch(
"builtins.open",
mock_open(read_data=inp_str),
) as mock_file, open_grdecl(mock_file, keywords=["PROP"]) as kw:
with (
patch(
"builtins.open",
mock_open(read_data=inp_str),
) as mock_file,
open_grdecl(mock_file, keywords=["PROP"]) as kw,
):
assert list(kw) == [("PROP", [str(value)] * repeats)]


def test_read_repeated_string_literal():
inp_str = "PROP\n 3*'INP ' /\n"
with patch(
"builtins.open",
mock_open(read_data=inp_str),
) as mock_file, open_grdecl(
mock_file,
keywords=["PROP"],
) as kw:
with (
patch(
"builtins.open",
mock_open(read_data=inp_str),
) as mock_file,
open_grdecl(
mock_file,
keywords=["PROP"],
) as kw,
):
assert list(kw) == [("PROP", ["INP "] * 3)]


def test_read_string():
inp_str = "PROP\n 'FOO BAR' FOO /\n"
with patch(
"builtins.open",
mock_open(read_data=inp_str),
) as mock_file, open_grdecl(
mock_file,
keywords=["PROP"],
) as kw:
with (
patch(
"builtins.open",
mock_open(read_data=inp_str),
) as mock_file,
open_grdecl(
mock_file,
keywords=["PROP"],
) as kw,
):
assert list(kw) == [("PROP", ["FOO BAR", "FOO"])]


Expand All @@ -73,13 +85,16 @@ def test_read_extra_keyword_characters():
"LONGPROP Eclipse comment\n"
"1 2 3 4 / More Eclipse comment\nOTHERPROP\n 5 6 7 8 /\n"
)
with patch(
"builtins.open",
mock_open(read_data=file_data),
) as mock_file, open_grdecl(
mock_file,
keywords=["LONGPROP", "OTHERPROP"],
) as kw:
with (
patch(
"builtins.open",
mock_open(read_data=file_data),
) as mock_file,
open_grdecl(
mock_file,
keywords=["LONGPROP", "OTHERPROP"],
) as kw,
):
assert list(kw) == [
("LONGPROP", ["1", "2", "3", "4"]),
("OTHERPROP", ["5", "6", "7", "8"]),
Expand All @@ -89,13 +104,16 @@ def test_read_extra_keyword_characters():
def test_read_long_keyword():
very_long_keyword = "a" * 200
file_data = f"{very_long_keyword} Eclipse comment\n" "1 2 3 4 /"
with patch(
"builtins.open",
mock_open(read_data=file_data),
) as mock_file, open_grdecl(
mock_file,
keywords=[very_long_keyword],
) as kw:
with (
patch(
"builtins.open",
mock_open(read_data=file_data),
) as mock_file,
open_grdecl(
mock_file,
keywords=[very_long_keyword],
) as kw,
):
assert list(kw) == [
(very_long_keyword, ["1", "2", "3", "4"]),
]
Expand All @@ -112,11 +130,15 @@ def test_read_long_keyword():
],
)
def test_read_prop_raises_error_when_no_forwardslash(undelimited_file_data):
with patch(
"builtins.open",
mock_open(read_data=undelimited_file_data),
) as mock_file, open_grdecl(
mock_file,
keywords=["PROP"],
) as kw, pytest.raises(ValueError):
with (
patch(
"builtins.open",
mock_open(read_data=undelimited_file_data),
) as mock_file,
open_grdecl(
mock_file,
keywords=["PROP"],
) as kw,
pytest.raises(ValueError),
):
list(kw)
68 changes: 40 additions & 28 deletions tests/test_grid3d/test_grid_grdecl.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,16 @@ def test_grid_relative():
],
)
def test_mapaxes(inp_str, values):
with patch(
"builtins.open",
mock_open(read_data=inp_str),
) as mock_file, open_grdecl(
mock_file,
keywords=["MAPAXES"],
) as kw:
with (
patch(
"builtins.open",
mock_open(read_data=inp_str),
) as mock_file,
open_grdecl(
mock_file,
keywords=["MAPAXES"],
) as kw,
):
keyword, values = next(kw)
assert keyword == "MAPAXES"
mapaxes = ggrid.MapAxes.from_grdecl(values)
Expand All @@ -59,13 +62,16 @@ def test_mapaxes(inp_str, values):

def test_gdorient():
inp_str = "GDORIENT\n INC INC INC DOWN LEFT /"
with patch(
"builtins.open",
mock_open(read_data=inp_str),
) as mock_file, open_grdecl(
mock_file,
keywords=["GDORIENT"],
) as kw:
with (
patch(
"builtins.open",
mock_open(read_data=inp_str),
) as mock_file,
open_grdecl(
mock_file,
keywords=["GDORIENT"],
) as kw,
):
keyword, values = next(kw)
assert keyword == "GDORIENT"
gdorient = ecl_grid.GdOrient.from_grdecl(values)
Expand All @@ -81,13 +87,16 @@ def test_gdorient():

def test_specgrid():
inp_str = "SPECGRID\n 64 118 263 1 F /"
with patch(
"builtins.open",
mock_open(read_data=inp_str),
) as mock_file, open_grdecl(
mock_file,
keywords=["SPECGRID"],
) as kw:
with (
patch(
"builtins.open",
mock_open(read_data=inp_str),
) as mock_file,
open_grdecl(
mock_file,
keywords=["SPECGRID"],
) as kw,
):
keyword, values = next(kw)
assert keyword == "SPECGRID"
specgrid = ggrid.SpecGrid.from_grdecl(values)
Expand All @@ -113,13 +122,16 @@ def test_specgrid():
],
)
def test_gridunit(inp_str, expected_unit, expected_relative):
with patch(
"builtins.open",
mock_open(read_data=inp_str),
) as mock_file, open_grdecl(
mock_file,
keywords=["GRIDUNIT"],
) as kw:
with (
patch(
"builtins.open",
mock_open(read_data=inp_str),
) as mock_file,
open_grdecl(
mock_file,
keywords=["GRIDUNIT"],
) as kw,
):
keyword, values = next(kw)
assert keyword == "GRIDUNIT"
gridunit = ggrid.GridUnit.from_grdecl(values)
Expand Down
15 changes: 9 additions & 6 deletions tests/test_grid3d/test_grid_roff.py
Original file line number Diff line number Diff line change
Expand Up @@ -337,12 +337,15 @@ def test_deprecated_fileread(roff_grid):
)
)

with pytest.warns(
UserWarning,
match="nonstandard but harmless roff",
), handle_deprecated_xtgeo_roff_file(
new_buff,
) as converted_buff:
with (
pytest.warns(
UserWarning,
match="nonstandard but harmless roff",
),
handle_deprecated_xtgeo_roff_file(
new_buff,
) as converted_buff,
):
new_grid = RoffGrid.from_file(converted_buff)

assert new_grid == roff_grid

0 comments on commit ffb9cbc

Please sign in to comment.