Skip to content

Commit

Permalink
Merge pull request #190 from altheaden/drop-python-3.8
Browse files Browse the repository at this point in the history
Drop python 3.8 from supported versions
  • Loading branch information
xylar authored Sep 3, 2024
2 parents 9d678c2 + dd8fd64 commit d302bfa
Show file tree
Hide file tree
Showing 6 changed files with 57 additions and 57 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build_workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ jobs:
shell: bash -l {0}
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
python-version: ["3.9", "3.10", "3.11", "3.12"]
steps:
- id: skip_check
uses: fkirc/skip-duplicate-actions@master
Expand Down
4 changes: 2 additions & 2 deletions conda/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ build:

requirements:
host:
- python >=3.8
- python >=3.9
- pip
- setuptools >=60
run:
- python >=3.8
- python >=3.9
- importlib_resources
- jinja2
- lxml
Expand Down
74 changes: 39 additions & 35 deletions mache/machine_info.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,10 @@
import configparser
import os
import pwd
import sys
from typing import TYPE_CHECKING
from importlib import resources as importlib_resources

from lxml import etree

if TYPE_CHECKING or sys.version_info >= (3, 9, 0):
from importlib import resources as importlib_resources
else:
# python <= 3.8
import importlib_resources


from mache.discover import discover_machine


Expand Down Expand Up @@ -122,57 +114,69 @@ def __str__(self):
The contents as a string for printing to the terminal
"""

info = f'Machine: {self.machine}\n' \
f' E3SM Supported Machine: {self.e3sm_supported}'
info = \
f'Machine: {self.machine}\n' \
f' E3SM Supported Machine: {self.e3sm_supported}'

if self.e3sm_supported and self.compilers is not None and \
self.mpilibs is not None and self.os is not None:
info = f'{info}\n' \
f' Compilers: {", ".join(self.compilers)}\n' \
f' MPI libraries: {", ".join(self.mpilibs)}\n' \
f' OS: {self.os}'
info = \
f'{info}\n' \
f' Compilers: {", ".join(self.compilers)}\n' \
f' MPI libraries: {", ".join(self.mpilibs)}\n' \
f' OS: {self.os}'

info = f'{info}\n'

print_unified = (self.e3sm_unified_activation is not None or
self.e3sm_unified_base is not None or
self.e3sm_unified_mpi is not None)
if print_unified:
info = f'{info}\n' \
f'E3SM-Unified:'
info = \
f'{info}\n' \
f'E3SM-Unified: '

if self.e3sm_unified_activation is None:
info = f'{info}\n' \
f' E3SM-Unified is not currently loaded'
info = \
f'{info}\n' \
f' E3SM-Unified is not currently loaded'
else:
info = f'{info}\n' \
f' Activation: {self.e3sm_unified_activation}'
info = \
f'{info}\n' \
f' Activation: {self.e3sm_unified_activation}'
if self.e3sm_unified_base is not None:
info = f'{info}\n' \
f' Base path: {self.e3sm_unified_base}'
info = \
f'{info}\n' \
f' Base path: {self.e3sm_unified_base}'
if self.e3sm_unified_mpi is not None:
info = f'{info}\n' \
f' MPI type: {self.e3sm_unified_mpi}'
info = \
f'{info}\n' \
f' MPI type: {self.e3sm_unified_mpi}'
info = f'{info}\n'

print_diags = self.diagnostics_base is not None
if print_diags:
info = f'{info}\n' \
f'Diagnostics:'
info = \
f'{info}\n' \
f'Diagnostics: '

if self.diagnostics_base is not None:
info = f'{info}\n' \
f' Base path: {self.diagnostics_base}'
info = \
f'{info}\n' \
f' Base path: {self.diagnostics_base}'
info = f'{info}\n'

info = f'{info}\n' \
f'Config options:'
info = \
f'{info}\n' \
f'Config options: '
for section in self.config.sections():
info = f'{info}\n' \
f' [{section}]'
info = \
f'{info}\n' \
f' [{section}]'
for key, value in self.config.items(section):
info = f'{info}\n' \
f' {key} = {value}'
info = \
f'{info}\n' \
f' {key} = {value}'
info = f'{info}\n'
return info

Expand Down
29 changes: 13 additions & 16 deletions mache/spack/__init__.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,11 @@
import os
import subprocess
import sys
from importlib import resources as importlib_resources
from typing import TYPE_CHECKING

from jinja2 import Template

if TYPE_CHECKING or sys.version_info >= (3, 9, 0):
from importlib import resources as importlib_resources
else:
# python <= 3.8
import importlib_resources

import yaml
from jinja2 import Template

from mache.machine_info import MachineInfo, discover_machine
from mache.version import __version__
Expand Down Expand Up @@ -98,7 +92,7 @@ def make_spack_env(spack_path, env_name, spack_specs, compiler, mpi,
section.getboolean('modules_after'))

# add the package specs to the appropriate template
specs = ''.join([f' - {spec}\n' for spec in spack_specs])
specs = ''.join([f' - {spec}\n' for spec in spack_specs]) # noqa: E221

yaml_data = _get_yaml_data(machine, compiler, mpi, include_e3sm_lapack,
include_e3sm_hdf5_netcdf,
Expand All @@ -111,8 +105,9 @@ def make_spack_env(spack_path, env_name, spack_specs, compiler, mpi,

if with_modules:
mods = _get_modules(yaml_data)
modules = f'module purge\n' \
f'{mods}'
modules = \
f'module purge\n' \
f'{mods}'
else:
modules = ''

Expand All @@ -139,8 +134,9 @@ def make_spack_env(spack_path, env_name, spack_specs, compiler, mpi,
with open(str(path)) as fp:
template = Template(fp.read())
if tmpdir is not None:
modules = f'{modules}\n' \
f'export TMPDIR={tmpdir}'
modules = \
f'{modules}\n' \
f'export TMPDIR={tmpdir}'

template_args = dict(modules=modules, version=__version__,
spack_path=spack_path, env_name=env_name,
Expand Down Expand Up @@ -245,9 +241,10 @@ def get_spack_script(spack_path, env_name, compiler, mpi, shell, machine=None,
else:
load_script = ''

load_script = f'{load_script}' \
f'source {spack_path}/share/spack/setup-env.{shell}\n' \
f'spack env activate {env_name}'
load_script = \
f'{load_script}' \
f'source {spack_path}/share/spack/setup-env.{shell}\n' \
f'spack env activate {env_name}'

for shell_filename in [f'{machine}.{shell}',
f'{machine}_{compiler}_{mpi}.{shell}']:
Expand Down
3 changes: 1 addition & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,9 @@ authors = [
description = "A package for providing configuration data related to E3SM supported machines."
license = {file = "LICENSE"}
readme = "README.md"
requires-python = ">=3.8"
requires-python = ">=3.9"
classifiers = [
# these are only for searching/browsing projects on PyPI
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
Expand Down
2 changes: 1 addition & 1 deletion spec-file.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
python >=3.8
python >=3.9
importlib_resources
jinja2
lxml
Expand Down

0 comments on commit d302bfa

Please sign in to comment.