Skip to content

Commit

Permalink
Drop support for Python 3.6 and 3.7
Browse files Browse the repository at this point in the history
  • Loading branch information
berland authored and sondreso committed Jun 27, 2022
1 parent ebc4796 commit d2d48e3
Show file tree
Hide file tree
Showing 14 changed files with 47 additions and 76 deletions.
34 changes: 17 additions & 17 deletions .github/workflows/publish_to_pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,26 @@ name: Publish Python 🐍 distributions 📦 to PyPI
on:
push:
tags:
- '*'
- "*"

jobs:
build-n-publish:
name: Build and publish Python 🐍 distributions 📦 to PyPI
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set up Python 3.7
uses: actions/setup-python@v1
with:
python-version: 3.7
- name: Install dependencies
run: pip install --upgrade setuptools setuptools_scm wheel twine
- name: Build package
run: python setup.py sdist bdist_wheel
- name: Upload deploy
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_SECRET }}
run: python -m twine upload dist/*
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set up Python 3.8
uses: actions/setup-python@v1
with:
python-version: 3.8
- name: Install dependencies
run: pip install --upgrade setuptools setuptools_scm wheel twine
- name: Build package
run: python setup.py sdist bdist_wheel
- name: Upload deploy
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_SECRET }}
run: python -m twine upload dist/*
4 changes: 2 additions & 2 deletions .github/workflows/testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
python-version: ["3.6", "3.7", "3.8", "3.9", "3.10"]
python-version: ["3.8", "3.9", "3.10"]
os: [ubuntu-latest]
include:
- python-version: 3.6
- python-version: 3.8
os: macos-latest

steps:
Expand Down
9 changes: 0 additions & 9 deletions semeio/jobs/design2params/design2params.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

import numpy as np
import pandas as pd
from xlrd.biffh import XLRDError

from semeio._exceptions.exceptions import ValidationError

Expand Down Expand Up @@ -193,14 +192,6 @@ def _read_excel(file_name, sheet_name, header=0, usecols=None, engine=None):
usecols=usecols,
engine=engine,
)
except XLRDError:
# pandas above 1.3.0 handles evaluating the proper reader, but lower has xlrd
# as default.
# pandas 1.1.5 is highest for python 3.6 - hence we handle the exception
# for as long as we support python 3.6
return _read_excel(
file_name, sheet_name, header=header, usecols=usecols, engine="openpyxl"
)
except IOError as err:
raise SystemExit(f"File {file_name} not found") from err
except Exception as err:
Expand Down
3 changes: 1 addition & 2 deletions semeio/workflows/localisation/localisation_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
import itertools
import pathlib

from typing import List, Optional, Union, Dict
from typing_extensions import Literal
from typing import List, Literal, Optional, Union, Dict
from pydantic import BaseModel as PydanticBaseModel
from pydantic import validator, confloat, conint, conlist, root_validator, Extra

Expand Down
8 changes: 1 addition & 7 deletions semeio/workflows/misfit_preprocessor/hierarchical_config.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
try:
from typing import Literal
except ImportError:
from typing_extensions import Literal

import collections

# pylint: disable=ungrouped-imports
from typing import Union
from typing import Literal, Union

from pydantic import (
BaseModel,
Expand Down
12 changes: 4 additions & 8 deletions semeio/workflows/misfit_preprocessor/kmeans_config.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
try:
from typing import Literal
except ImportError:
from typing_extensions import Literal
from pydantic import conint, Field, PyObject, PrivateAttr
from typing import Literal

from pydantic import Field, PrivateAttr, PyObject, conint

from semeio.workflows.misfit_preprocessor.hierarchical_config import (
AbstractClusteringConfig,
)
from semeio.workflows.spearman_correlation_job.cluster_analysis import (
kmeans_analysis,
)
from semeio.workflows.spearman_correlation_job.cluster_analysis import kmeans_analysis


class LimitedKmeansClustering(AbstractClusteringConfig):
Expand Down
11 changes: 3 additions & 8 deletions semeio/workflows/misfit_preprocessor/workflow_config.py
Original file line number Diff line number Diff line change
@@ -1,22 +1,17 @@
from typing import Union, List, Optional
from typing import List, Literal, Optional, Union

try:
from typing import Literal
except ImportError:
from typing_extensions import Literal
from pydantic import confloat, validator, BaseModel, Field
from pydantic import BaseModel, Field, confloat, validator

from semeio.workflows.misfit_preprocessor.hierarchical_config import (
BaseMisfitPreprocessorConfig,
HierarchicalConfig,
LimitedHierarchicalConfig,
BaseMisfitPreprocessorConfig,
)
from semeio.workflows.misfit_preprocessor.kmeans_config import (
KmeansClustering,
LimitedKmeansClustering,
)


# pylint: disable=too-few-public-methods,no-self-argument


Expand Down
5 changes: 1 addition & 4 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,6 @@
"License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)",
"Natural Language :: English",
"Programming Language :: Python",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
Expand All @@ -57,7 +55,7 @@
"ert >= 2.36.0b0",
"configsuite>=0.6",
"numpy",
"pandas>0.24",
"pandas>1.3.0",
"pydantic",
"scikit-learn",
"scipy",
Expand All @@ -66,7 +64,6 @@
"pyscal>=0.4.0",
"fmu-ensemble",
"segyio",
"typing_extensions; python_version < '3.8'",
"xtgeo>=2.15",
],
include_package_data=True,
Expand Down
6 changes: 3 additions & 3 deletions tests/jobs/design2params/test_design2params.py
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
import filecmp
import logging
import os
from distutils.dir_util import copy_tree
import shutil

import pandas as pd
import pytest

from semeio._exceptions.exceptions import ValidationError
from semeio.jobs.design2params import design2params
from semeio.jobs.design_kw.design_kw import extract_key_value
from semeio._exceptions.exceptions import ValidationError


@pytest.fixture
def input_data(tmpdir):
data_dir = os.path.join(os.path.dirname(os.path.abspath(__file__)), "data")
copy_tree(data_dir, tmpdir.strpath)
shutil.copytree(data_dir, tmpdir.strpath, dirs_exist_ok=True)

cwd = os.getcwd()
tmpdir.chdir()
Expand Down
4 changes: 2 additions & 2 deletions tests/jobs/design2params/test_design2params_entry.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import sys
import logging
import os
from distutils.dir_util import copy_tree
import shutil

import pytest

Expand All @@ -11,7 +11,7 @@
@pytest.fixture
def input_data(tmpdir):
data_dir = os.path.join(os.path.dirname(os.path.abspath(__file__)), "data")
copy_tree(data_dir, tmpdir.strpath)
shutil.copytree(data_dir, tmpdir.strpath, dirs_exist_ok=True)

cwd = os.getcwd()
tmpdir.chdir()
Expand Down
4 changes: 2 additions & 2 deletions tests/jobs/design_kw/test_design_kw.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import logging
import os
from distutils.dir_util import copy_tree
import shutil

import pytest

Expand All @@ -10,7 +10,7 @@
@pytest.fixture
def input_data(tmpdir):
data_dir = os.path.join(os.path.dirname(os.path.abspath(__file__)), "data")
copy_tree(data_dir, tmpdir.strpath)
shutil.copytree(data_dir, tmpdir.strpath, dirs_exist_ok=True)

cwd = os.getcwd()
tmpdir.chdir()
Expand Down
7 changes: 3 additions & 4 deletions tests/jobs/design_kw/test_design_kw_entry.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
import logging
import os
import shutil
import sys
from distutils.dir_util import copy_tree

import pytest

if sys.version_info.major >= 3:
from semeio.jobs.scripts import design_kw
from semeio.jobs.scripts import design_kw


@pytest.fixture
def input_data(tmpdir):
data_dir = os.path.join(os.path.dirname(os.path.abspath(__file__)), "data")
copy_tree(data_dir, tmpdir.strpath)
shutil.copytree(data_dir, tmpdir.strpath, dirs_exist_ok=True)

cwd = os.getcwd()
tmpdir.chdir()
Expand Down
12 changes: 7 additions & 5 deletions tests/jobs/rft/conftest.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import os
import copy
from distutils.dir_util import copy_tree
import os
import shutil

import pytest

Expand Down Expand Up @@ -51,15 +51,17 @@ def norne_data(tmpdir):
data_dir = os.path.join(
os.path.dirname(os.path.abspath(__file__)), "data/norne/gendata_rft_input_files"
)
copy_tree(data_dir, tmpdir.strpath)
shutil.copytree(data_dir, tmpdir.strpath, dirs_exist_ok=True)

cwd = os.getcwd()
tmpdir.chdir()

expected_results_dir = os.path.join(tmpdir.strpath, "expected_results")
os.mkdir(expected_results_dir)

copy_tree(EXPECTED_RESULTS_PATH_NORNE, expected_results_dir)
shutil.copytree(
EXPECTED_RESULTS_PATH_NORNE, expected_results_dir, dirs_exist_ok=True
)
_generate_mock_data_norne(expected_results_dir)

try:
Expand All @@ -74,7 +76,7 @@ def reek_data(tmpdir):
data_dir = os.path.join(
os.path.dirname(os.path.abspath(__file__)), "data/reek/gendata_rft_input_files"
)
copy_tree(data_dir, tmpdir.strpath)
shutil.copytree(data_dir, tmpdir.strpath, dirs_exist_ok=True)
cwd = os.getcwd()
tmpdir.chdir()

Expand Down
4 changes: 1 addition & 3 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tox]
envlist =
py{36,37,38,39,310}
py{38,39,310}
style

[testenv]
Expand Down Expand Up @@ -33,8 +33,6 @@ per-file-ignores =

[gh-actions]
python =
3.6: py36
3.7: py37
3.8: py38
3.9: py39
3.10: py310

0 comments on commit d2d48e3

Please sign in to comment.