Skip to content
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

Drop support for Python3.8 #9215

Merged
merged 2 commits into from
Nov 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions .github/ISSUE_TEMPLATE/bug_report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@ body:
description: |
Please check of the environments where this behavior has been observed.
options:
- label: python 3.8
- label: python 3.9
- label: python 3.10
- label: python 3.11
- label: python 3.12
Expand Down
16 changes: 6 additions & 10 deletions .github/workflows/build_and_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: [ '3.8', '3.9', '3.10', '3.11', '3.12' ]
python-version: [ '3.10', '3.11', '3.12' ]

uses: ./.github/workflows/build-wheels.yml
with:
Expand All @@ -34,7 +34,7 @@ jobs:
fail-fast: false
matrix:
test-type: [ 'performance-tests', 'unit-tests', 'gui-tests', 'cli-tests' ]
python-version: [ '3.8', '3.11', '3.12' ]
python-version: [ '3.11', '3.12' ]
os: [ ubuntu-latest ]
uses: ./.github/workflows/test_ert.yml
with:
Expand All @@ -48,7 +48,7 @@ jobs:
fail-fast: false
matrix:
test-type: [ 'test', 'ui-test', 'integration-test', 'everest-models-test', 'doc', 'everest-docs-entry-test' ]
python-version: [ '3.8', '3.11', '3.12' ]
python-version: [ '3.11', '3.12' ]
os: [ ubuntu-latest ]
uses: ./.github/workflows/test_everest.yml
with:
Expand All @@ -62,7 +62,7 @@ jobs:
fail-fast: false
matrix:
os: [ ubuntu-latest ]
python-version: [ '3.8', '3.11', '3.12' ]
python-version: [ '3.11', '3.12' ]
uses: ./.github/workflows/test_ert_with_slurm.yml
with:
os: ${{ matrix.os }}
Expand Down Expand Up @@ -106,11 +106,9 @@ jobs:
fail-fast: false
matrix:
test-type: [ 'test', 'integration-test', 'everest-models-test' ]
python-version: [ '3.8', '3.12' ]
os: [ 'macos-13', 'macos-14', 'macos-14-large']
python-version: [ '3.12' ]
exclude:
- os: 'macos-14'
python-version: '3.8'
- os: 'macos-13'
python-version: '3.12'
uses: ./.github/workflows/test_everest.yml
Expand All @@ -126,11 +124,9 @@ jobs:
fail-fast: false
matrix:
test-type: [ 'performance-tests', 'unit-tests', 'gui-tests', 'cli-tests' ]
python-version: [ '3.8', '3.12' ]
python-version: [ '3.12' ]
os: [ 'macos-13', 'macos-14']
exclude:
- os: 'macos-14'
python-version: '3.8'
- os: 'macos-13'
python-version: '3.12'

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/run_ert_test_data_setups.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ['3.8', '3.11', '3.12']
python-version: ['3.11', '3.12']
os: [ubuntu-latest]

runs-on: ${{ matrix.os }}
Expand Down
4 changes: 0 additions & 4 deletions .github/workflows/test_ert.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,6 @@ jobs:
- name: Install uv
uses: astral-sh/setup-uv@v3

- name: Install HDF5 source files
if: ${{ runner.os == 'macOS' && (inputs.python-version == '3.8' || inputs.python-version == '3.9' )}}
run: brew install hdf5

- name: Install ert
run: |
uv pip install ".[dev, everest]"
Expand Down
4 changes: 0 additions & 4 deletions .github/workflows/test_everest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,6 @@ jobs:
- name: Install uv
uses: astral-sh/setup-uv@v3

- name: Install HDF5 source files on mac
if: ${{ runner.os == 'macOS' && (inputs.python-version == '3.8' || inputs.python-version == '3.9' )}}
run: brew install hdf5

- name: Install Everest and dependencies
run: |
uv pip install ".[dev,everest]"
Expand Down
10 changes: 3 additions & 7 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ authors = [
{ name = "Equinor ASA", email = "fg_sib-scout@equinor.com" },
]
description = "Ensemble based Reservoir Tool (ERT)"
requires-python = ">=3.8"
requires-python = ">=3.10"
readme = "README.md"
license = { text = "GPL-3.0" }
classifiers = [
Expand All @@ -21,8 +21,6 @@ classifiers = [
"License :: OSI Approved :: GNU General Public License v3 (GPLv3)",
"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",
"Programming Language :: Python :: 3.12",
Expand All @@ -41,7 +39,6 @@ dependencies = [
"filelock",
"httpx",
"humanize",
"importlib_resources; python_version <= '3.8'",
"iterative_ensemble_smoother>=0.2.6",
"jinja2 >= 2.10",
"lark",
Expand Down Expand Up @@ -70,8 +67,7 @@ dependencies = [
"resfo",
"scipy >= 1.10.1",
"seaborn",
"tables; python_version >= '3.9'", # extra dependency for pandas (hdf5)
"tables<3.9; python_version == '3.8'",
"tables", # extra dependency for pandas (hdf5)
"tabulate",
"tqdm>=4.62.0",
"typing_extensions>=4.5",
Expand Down Expand Up @@ -244,7 +240,7 @@ include = ["src"]
exclude = ["tests"]
reportMissingImports = "error"
typeCheckingMode = "standard"
pythonVersion = "3.8"
pythonVersion = "3.11"

[tool.pyright.defineConstant]
PYSIDE6 = false
Expand Down
16 changes: 10 additions & 6 deletions src/_ert/forward_model_runner/forward_model_step.py
Original file line number Diff line number Diff line change
Expand Up @@ -452,9 +452,12 @@ def _get_processtree_data(
oom_score = int(
Path(f"/proc/{process.pid}/oom_score").read_text(encoding="utf-8")
)
with contextlib.suppress(
ValueError, NoSuchProcess, AccessDenied, ZombieProcess, ProcessLookupError
), process.oneshot():
with (
contextlib.suppress(
ValueError, NoSuchProcess, AccessDenied, ZombieProcess, ProcessLookupError
),
process.oneshot(),
):
memory_rss = process.memory_info().rss
cpu_seconds = process.cpu_times().user

Expand All @@ -478,9 +481,10 @@ def _get_processtree_data(
if oom_score is not None
else oom_score_child
)
with contextlib.suppress(
NoSuchProcess, AccessDenied, ZombieProcess
), child.oneshot():
with (
contextlib.suppress(NoSuchProcess, AccessDenied, ZombieProcess),
child.oneshot(),
):
memory_rss += child.memory_info().rss
cpu_seconds += child.cpu_times().user
return (memory_rss, cpu_seconds, oom_score)
1 change: 1 addition & 0 deletions src/ert/analysis/_es_update.py
Original file line number Diff line number Diff line change
Expand Up @@ -376,6 +376,7 @@ def _load_observations_and_responses(
ens_mean_mask,
ens_std_mask,
indexes,
strict=False,
):
update_snapshot.append(
ObservationAndResponseSnapshot(
Expand Down
4 changes: 2 additions & 2 deletions src/ert/config/design_matrix.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ def _validate_design_matrix(design_matrix: pd.DataFrame) -> List[str]:
errors.append("Duplicate parameter names found in design sheet")
empties = [
f"Realization {design_matrix.index[i]}, column {design_matrix.columns[j]}"
for i, j in zip(*np.where(pd.isna(design_matrix)))
for i, j in zip(*np.where(pd.isna(design_matrix)), strict=False)
]
if len(empties) > 0:
errors.append(f"Design matrix contains empty cells {empties}")
Expand Down Expand Up @@ -223,7 +223,7 @@ def _read_defaultssheet(
raise ValueError("Defaults sheet must have at least two columns")
empty_cells = [
f"Row {default_df.index[i]}, column {default_df.columns[j]}"
for i, j in zip(*np.where(pd.isna(default_df)))
for i, j in zip(*np.where(pd.isna(default_df)), strict=False)
]
if len(empty_cells) > 0:
raise ValueError(f"Default sheet contains empty cells {empty_cells}")
Expand Down
6 changes: 4 additions & 2 deletions src/ert/config/gen_data_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,9 @@ def __post_init__(self) -> None:
@property
def expected_input_files(self) -> List[str]:
expected_files = []
for input_file, report_steps in zip(self.input_files, self.report_steps_list):
for input_file, report_steps in zip(
self.input_files, self.report_steps_list, strict=False
):
if report_steps is None:
expected_files.append(input_file)
else:
Expand Down Expand Up @@ -145,7 +147,7 @@ def _read_file(filename: Path, report_step: int) -> polars.DataFrame:
datasets_per_name = []

for name, input_file, report_steps in zip(
self.keys, self.input_files, self.report_steps_list
self.keys, self.input_files, self.report_steps_list, strict=False
):
datasets_per_report_step = []
if report_steps is None:
Expand Down
6 changes: 4 additions & 2 deletions src/ert/config/gen_kw_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,9 @@ def write_to_runpath(
f" is of size {len(self.transform_functions)}, expected {array.size}"
)

data = dict(zip(array["names"].values.tolist(), array.values.tolist()))
data = dict(
zip(array["names"].values.tolist(), array.values.tolist(), strict=False)
)

log10_data = {
tf.name: math.log(data[tf.name], 10)
Expand Down Expand Up @@ -477,7 +479,7 @@ def _parse_transform_function_definition(
f"Unable to convert float number: {p}"
) from e

params = dict(zip(param_names, param_floats))
params = dict(zip(param_names, param_floats, strict=False))

return TransformFunction(
name=t.name,
Expand Down
2 changes: 1 addition & 1 deletion src/ert/config/observations.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ def _handle_history_observation(
segment_instance,
)
data: Dict[Union[int, datetime], Union[GenObservation, SummaryObservation]] = {}
for date, error, value in zip(refcase.dates, std_dev, values):
for date, error, value in zip(refcase.dates, std_dev, values, strict=False):
data[date] = SummaryObservation(summary_key, summary_key, value, error)

return {
Expand Down
16 changes: 3 additions & 13 deletions src/ert/config/parsing/schema_dict.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import abc
from typing import TYPE_CHECKING, List, Set, no_type_check
from collections import UserDict
from typing import List, Set, no_type_check

from .config_dict import ConfigDict
from .config_errors import ConfigValidationError, ConfigWarning
Expand All @@ -8,19 +9,8 @@
from .deprecation_info import DeprecationInfo
from .error_info import ErrorInfo

# Python 3.8 does not implement UserDict as a MutableMapping, meaning it's not
# possible to specify the key and value types.
#
# Instead, we only set the types during type checking
if TYPE_CHECKING:
from collections import UserDict

_UserDict = UserDict[str, SchemaItem]
else:
from collections import UserDict as _UserDict


class SchemaItemDict(_UserDict):
class SchemaItemDict(UserDict[str, SchemaItem]):
def search_for_unset_required_keywords(
self, config_dict: ConfigDict, filename: str
) -> None:
Expand Down
2 changes: 1 addition & 1 deletion src/ert/dark_storage/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ def gen_data_display_keys(ensemble: Ensemble) -> Iterator[str]:
if gen_data_config:
assert isinstance(gen_data_config, GenDataConfig)
for key, report_steps in zip(
gen_data_config.keys, gen_data_config.report_steps_list
gen_data_config.keys, gen_data_config.report_steps_list, strict=False
):
if report_steps is None:
yield f"{key}@0"
Expand Down
17 changes: 10 additions & 7 deletions src/ert/ensemble_evaluator/_wait_for_evaluator.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,16 @@ async def attempt_connection(
) -> None:
timeout = aiohttp.ClientTimeout(connect=connection_timeout)
headers = {} if token is None else {"token": token}
async with aiohttp.ClientSession() as session, session.request(
method="get",
url=url,
ssl=get_ssl_context(cert),
headers=headers,
timeout=timeout,
) as resp:
async with (
aiohttp.ClientSession() as session,
session.request(
method="get",
url=url,
ssl=get_ssl_context(cert),
headers=headers,
timeout=timeout,
) as resp,
):
resp.raise_for_status()


Expand Down
2 changes: 1 addition & 1 deletion src/ert/gui/tools/plot/customize/style_chooser.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ def createLabelLayout(self, layout: Optional[QLayout] = None) -> QLayout:

titles = ["Line style", "Width", "Marker style", "Size"]
sizes = self.getItemSizes()
for title, size in zip(titles, sizes):
for title, size in zip(titles, sizes, strict=False):
label = QLabel(title)
label.setFixedWidth(size)
layout.addWidget(label)
Expand Down
2 changes: 1 addition & 1 deletion src/ert/resources/forward_models/res/script/ecl_run.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ def make_SLURM_machine_list(SLURM_JOB_NODELIST, SLURM_TASKS_PER_NODE):
task_count_list += _expand_SLURM_task_count(task_count_string)

host_list = []
for node, count in zip(nodelist, task_count_list):
for node, count in zip(nodelist, task_count_list, strict=False):
host_list += [node] * count

return host_list
Expand Down
2 changes: 1 addition & 1 deletion src/ert/run_arg.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def create_run_arguments(
job_names = runpaths.get_jobnames(range(len(active_realizations)), iteration)

for iens, (run_path, job_name, active) in enumerate(
zip(paths, job_names, active_realizations)
zip(paths, job_names, active_realizations, strict=False)
):
run_args.append(
RunArg(
Expand Down
4 changes: 3 additions & 1 deletion src/ert/run_models/base_run_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,9 @@ def _create_mask_from_failed_realizations(self) -> List[bool]:
return [
initial and not completed
for initial, completed in zip(
self._initial_realizations_mask, self._completed_realizations_mask
self._initial_realizations_mask,
self._completed_realizations_mask,
strict=False,
)
]
else:
Expand Down
4 changes: 3 additions & 1 deletion src/ert/simulator/forward_model_status.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,9 @@ def try_load(cls, path: str) -> "ForwardModelStatus":
end_time = _deserialize_date(status_data["end_time"])
status = cls(status_data["run_id"], start_time, end_time=end_time)

for fm_step, state in zip(fm_steps_data["jobList"], status_data["jobs"]):
for fm_step, state in zip(
fm_steps_data["jobList"], status_data["jobs"], strict=False
):
status.add_step(ForwardModelStepStatus.load(fm_step, state, path))

return status
Expand Down
15 changes: 3 additions & 12 deletions src/ert/substitutions.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,16 @@

import logging
import re
from typing import TYPE_CHECKING, Optional
from typing import Optional

logger = logging.getLogger(__name__)
_PATTERN = re.compile("<[^<>]+>")


# Python 3.8 does not implement UserDict as a MutableMapping, meaning it's not
# possible to specify the key and value types.
#
# Instead, we only set the types during type checking
if TYPE_CHECKING:
from collections import UserDict
from collections import UserDict

_UserDict = UserDict[str, str]
else:
from collections import UserDict as _UserDict


class Substitutions(_UserDict):
class Substitutions(UserDict[str, str]):
def substitute(
self,
to_substitute: str,
Expand Down
Loading
Loading