Skip to content

Commit

Permalink
DEP: Drop Python 3.8 support
Browse files Browse the repository at this point in the history
  • Loading branch information
mferrera committed Dec 12, 2024
1 parent 1af8dbb commit 8394dac
Show file tree
Hide file tree
Showing 9 changed files with 136 additions and 118 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.11", "3.12"]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand Down
3 changes: 0 additions & 3 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ jobs:
fail-fast: false
matrix:
python:
- ['3.8', cp38]
- ['3.9', cp39]
- ['3.10', cp310]
- ['3.11', cp311]
Expand All @@ -26,8 +25,6 @@ jobs:
- [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 Down
16 changes: 1 addition & 15 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,13 @@ 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
- os: windows-latest
python-version: 3.12

Expand Down Expand Up @@ -86,18 +84,6 @@ jobs:
fail-fast: false
matrix:
config:
- {
name: "RMS 12.1.4, 13.0.3, 13.1.0, 14.1.1",
os: ubuntu-20.04,
python: 3.8.6,
pip: 23.2.1,
wheel: 0.37.1,
setuptools: 63.4.3,
matplotlib: 3.3.2,
numpy: 1.19.2,
pandas: 1.1.3,
scipy: 1.5.3,
}
- {
name: "RMS 14.2",
os: ubuntu-latest,
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
32 changes: 16 additions & 16 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ requires = [
"pybind11",
"scikit-build-core[pyproject]>=0.10",
"swig<4.3.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'",
Expand All @@ -22,7 +21,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 @@ -36,7 +35,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 Expand Up @@ -120,7 +118,6 @@ 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"
Expand All @@ -143,18 +140,21 @@ ignore = [
"C901",
]
select = [
"C",
"E",
"F",
"I",
"PIE",
"Q",
"RET",
"RSE",
"SIM",
"TCH",
"TID",
"W",
# "B", # flake-8-bugbear
"C", # pylint-convention
"E", # pycodestyle-error
"F", # pyflakes
"I", # isort
# "NPY", # numpy
"PIE", # flake8-pie
"Q", # flake8-quotes
"RET", # flake8-return
"RSE", # flake8-raise
"SIM", # flake8-simplify
"TC", # flake8-type-checking
"TID", # flake8-tidy-imports
# "UP", # pyupgrade
"W", # pylint-warnings
]

[tool.ruff.lint.isort]
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
Loading

0 comments on commit 8394dac

Please sign in to comment.