-
Notifications
You must be signed in to change notification settings - Fork 58
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DEP: Drop Python 3.8 support #1282
Open
mferrera
wants to merge
1
commit into
equinor:main
Choose a base branch
from
mferrera:dep-python-3-8
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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'", | ||
|
@@ -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"] | ||
|
@@ -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", | ||
|
@@ -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" | ||
|
@@ -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 | ||
Comment on lines
+143
to
+148
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. A few extra linting jobs that would be nice to add, with labels of what these are |
||
"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] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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", | ||
Comment on lines
+25
to
+26
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ruff wanted to do this now, idk |
||
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"])] | ||
|
||
|
||
|
@@ -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"])] | ||
|
||
|
||
|
@@ -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"]), | ||
|
@@ -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"]), | ||
] | ||
|
@@ -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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just to reduce the 1500 line terminal flood when running the tests down to a grid of dots