From 95aa079c762bf587c1ac17be30150523f552e4e4 Mon Sep 17 00:00:00 2001 From: Paul Romano Date: Mon, 19 Jul 2021 16:13:10 -0500 Subject: [PATCH 1/2] Update minimum Python version to 3.6 --- docs/source/usersguide/install.rst | 2 +- setup.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/source/usersguide/install.rst b/docs/source/usersguide/install.rst index 695240406a..5fc1fe639f 100644 --- a/docs/source/usersguide/install.rst +++ b/docs/source/usersguide/install.rst @@ -484,7 +484,7 @@ to install the Python package in :ref:`"editable" mode `. Prerequisites ------------- -The Python API works with Python 3.5+. In addition to Python itself, the API +The Python API works with Python 3.6+. In addition to Python itself, the API relies on a number of third-party packages. All prerequisites can be installed using Conda_ (recommended), pip_, or through the package manager in most Linux distributions. diff --git a/setup.py b/setup.py index 6afac4df1b..ecc046109e 100755 --- a/setup.py +++ b/setup.py @@ -57,14 +57,14 @@ kwargs = { 'Topic :: Scientific/Engineering' 'Programming Language :: C++', 'Programming Language :: Python :: 3', - 'Programming Language :: Python :: 3.5', 'Programming Language :: Python :: 3.6', 'Programming Language :: Python :: 3.7', 'Programming Language :: Python :: 3.8', + 'Programming Language :: Python :: 3.9', ], # Dependencies - 'python_requires': '>=3.5', + 'python_requires': '>=3.6', 'install_requires': [ 'numpy>=1.9', 'h5py', 'scipy', 'ipython', 'matplotlib', 'pandas', 'lxml', 'uncertainties' From 0d83672544db0aa4849685d29c83f1c27a8752a3 Mon Sep 17 00:00:00 2001 From: Paul Romano Date: Mon, 19 Jul 2021 16:14:30 -0500 Subject: [PATCH 2/2] Resolve a few TODOs related to Python 3.6 --- openmc/data/library.py | 4 ---- openmc/deplete/abc.py | 7 ++----- tests/regression_tests/mgxs_library_distribcell/test.py | 2 -- tests/unit_tests/test_deplete_fission_yields.py | 5 ++--- 4 files changed, 4 insertions(+), 14 deletions(-) diff --git a/openmc/data/library.py b/openmc/data/library.py index cd0fe0895b..bf937e57ad 100644 --- a/openmc/data/library.py +++ b/openmc/data/library.py @@ -146,10 +146,6 @@ class DataLibrary(EqualityMixin): raise ValueError("Either path or OPENMC_CROSS_SECTIONS " "environmental variable must be set") - # Convert to string to support pathlib - # TODO: Remove when support is Python 3.6+ only - path = str(path) - tree = ET.parse(path) root = tree.getroot() if root.find('directory') is not None: diff --git a/openmc/deplete/abc.py b/openmc/deplete/abc.py index 7dca301f7e..ca16926eaf 100644 --- a/openmc/deplete/abc.py +++ b/openmc/deplete/abc.py @@ -158,11 +158,8 @@ class TransportOperator(ABC): def __enter__(self): # Save current directory and move to specific output directory self._orig_dir = os.getcwd() - if not self.output_dir.exists(): - self.output_dir.mkdir() # exist_ok parameter is 3.5+ - - # In Python 3.6+, chdir accepts a Path directly - os.chdir(str(self.output_dir)) + self.output_dir.mkdir(exist_ok=True) + os.chdir(self.output_dir) return self.initial_condition() diff --git a/tests/regression_tests/mgxs_library_distribcell/test.py b/tests/regression_tests/mgxs_library_distribcell/test.py index 3b601161af..fd6c8e9386 100644 --- a/tests/regression_tests/mgxs_library_distribcell/test.py +++ b/tests/regression_tests/mgxs_library_distribcell/test.py @@ -68,8 +68,6 @@ class MGXSTestHarness(PyAPITestHarness): return outstr -@pytest.mark.xfail(sys.version_info < (3, 6), - reason="Pandas 1.0 API changed and requires Python 3.6+") def test_mgxs_library_distribcell(): model = pwr_assembly() harness = MGXSTestHarness('statepoint.10.h5', model) diff --git a/tests/unit_tests/test_deplete_fission_yields.py b/tests/unit_tests/test_deplete_fission_yields.py index 8839b42b3d..b603710f34 100644 --- a/tests/unit_tests/test_deplete_fission_yields.py +++ b/tests/unit_tests/test_deplete_fission_yields.py @@ -43,12 +43,11 @@ def materials(tmpdir_factory): with lib.run_in_memory(): yield [lib.Material(), lib.Material()] finally: - # Convert to strings as os.remove in py 3.5 doesn't support Paths for file_path in ("settings.xml", "geometry.xml", "materials.xml", "summary.h5"): - os.remove(str(tmpdir / file_path)) + os.remove(tmpdir / file_path) orig.chdir() - os.rmdir(str(tmpdir)) + os.rmdir(tmpdir) def proxy_tally_data(tally, fill=None):