Skip to content

Commit a84e540

Browse files
committed
Bump min python to 3.12
1 parent 9f1ec48 commit a84e540

File tree

14 files changed

+28
-70
lines changed

14 files changed

+28
-70
lines changed

.github/workflows/build.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,10 @@ jobs:
3232
fail-fast: false
3333
matrix:
3434
os: ['ubuntu-latest', 'macos-latest']
35-
python: ['3.7', '3.8', '3.9', '3']
35+
python: ['3.12', '3']
3636
exclude:
3737
- os: 'macos-latest'
38-
python: '3.7'
38+
python: '3.12'
3939
steps:
4040
- name: Checkout
4141
uses: actions/checkout@v4

.github/workflows/test-conda-builds.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ jobs:
2727
strategy:
2828
fail-fast: false
2929
matrix:
30-
python-version: ['3.8', '3']
30+
python-version: ['3.12', '3']
3131
env:
3232
ENV_FILE: conda-environment.yml
3333
steps:

.github/workflows/test.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ jobs:
4848
lint:
4949
strategy:
5050
matrix:
51-
python-version: ['3.9']
51+
python-version: ['3.12']
5252
runs-on: ubuntu-latest
5353
timeout-minutes: 3
5454
steps:
@@ -96,10 +96,10 @@ jobs:
9696
fail-fast: false
9797
matrix:
9898
os: ['ubuntu-latest']
99-
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11', '3.12', '3']
99+
python-version: ['3.12', '3']
100100
include:
101101
- os: 'macos-latest'
102-
python-version: '3.8' # oldest arm64 build on conda-forge
102+
python-version: '3.12'
103103

104104
steps:
105105
- name: Checkout
@@ -233,7 +233,7 @@ jobs:
233233
timeout-minutes: 5
234234
strategy:
235235
matrix:
236-
python-version: ['3.9']
236+
python-version: ['3']
237237
steps:
238238
- name: Checkout
239239
uses: actions/checkout@v4

.github/workflows/test_rsync_test_script.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ jobs:
2222
os: ['ubuntu-latest']
2323
python-version: [
2424
'2.7',
25-
'3.5', '3.6',
26-
'3.7', '3.8', '3.9', '3.12'
25+
'3.5', '3.6', '3.7', '3.8', '3.9',
26+
'3.12', '3'
2727
]
2828

2929
steps:

changes.d/2922.break.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Dropped support for Python 3.7-3.11. The minimum supported version is now 3.12.

conda-environment.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ channels:
44
dependencies:
55
# outut: metomi-rose-base
66
- __unix
7-
- python >= 3.7.0
7+
- python >= 3.12.0
88
- aiofiles
99
- jinja2 >=2.10.1
1010
- keyring >=23
@@ -13,8 +13,6 @@ dependencies:
1313
- psutil >=5.6.0
1414
- requests
1515
- sqlalchemy >=1,<2
16-
- importlib_metadata >=5.0 # py<3.12 TODO: selectors don't work for noarch packages
17-
- importlib_resources >=2.0 # py<3.9 TODO: selectors don't work for noarch packages
1816
# - tornado (rosie disco is temporally disabled)
1917

2018
# output: metomi-rose

metomi/rose/host_select.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,7 @@ def _bash_login_cmd(cmd: List[str]) -> List[str]:
292292
>>> HostSelector._bash_login_cmd(["echo", "-n", "Multiple words"])
293293
['bash', '-l', '-c', "echo -n 'Multiple words'"]
294294
"""
295-
return ['bash', '-l', '-c', RosePopener.shlex_join(cmd)]
295+
return ['bash', '-l', '-c', shlex.join(cmd)]
296296

297297
def select(
298298
self,
@@ -442,7 +442,7 @@ def select(
442442
if not self.is_local_host(host_name):
443443
command = [
444444
*self.popen.get_cmd('ssh', host_name),
445-
RosePopener.shlex_join(command)
445+
shlex.join(command)
446446
]
447447
# fire off host-select-client processes
448448
proc = self.popen.run_bg(

metomi/rose/popen.py

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ def __str__(self):
7979
if isinstance(command, str):
8080
ret = command
8181
else:
82-
ret = RosePopener.shlex_join(self.command)
82+
ret = shlex.join(self.command)
8383

8484
try:
8585
# real file or real stream
@@ -140,25 +140,6 @@ class RosePopener:
140140
}
141141
ENVS_OF_CMDS = {"editor": ["VISUAL", "EDITOR"]}
142142

143-
@staticmethod
144-
def shlex_join(args: Iterable[str]) -> str:
145-
"""Convert a list of strings into a shell command, safely quoting
146-
when the strings contain whitespace and special chars.
147-
148-
Basically a back-port of shlex.join(), needed for py 3.7.
149-
150-
Examples:
151-
>>> RosePopener.shlex_join([])
152-
''
153-
>>> RosePopener.shlex_join(["echo", "-n", "Multiple words"])
154-
"echo -n 'Multiple words'"
155-
>>> RosePopener.shlex_join(["ls", "my_dir;foiled_injection"])
156-
"ls 'my_dir;foiled_injection'"
157-
>>> RosePopener.shlex_join(["what", "about", "globs*"])
158-
"what about 'globs*'"
159-
"""
160-
return " ".join(shlex.quote(arg) for arg in args)
161-
162143
@staticmethod
163144
def list_to_shell_str(args: Iterable[str]) -> str:
164145
"""Convert a list of strings into a shell command, escaping whitespace

metomi/rose/rose.py

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -61,24 +61,12 @@ def pythonpath_manip():
6161
)
6262

6363
if TYPE_CHECKING:
64-
try:
65-
from importlib_metadata import EntryPoint
66-
except ImportError:
67-
from importlib.metadata import EntryPoint # type: ignore
64+
from importlib.metadata import EntryPoint
6865

6966

7067
def iter_entry_points(name: str):
7168
"""Iterate over all entry points for a given group name"""
72-
if sys.version_info[:2] >= (3, 12):
73-
from importlib.metadata import entry_points
74-
else:
75-
# BACK_COMPAT: importlib_metadata
76-
# importlib.metadata was added in Python 3.8. The required interfaces
77-
# were completed by 3.12. For lower versions we must use the
78-
# importlib_metadata backport.
79-
# FROM: Python 3.7
80-
# TO: Python: 3.12
81-
from importlib_metadata import entry_points
69+
from importlib.metadata import entry_points
8270
yield from entry_points().select(group=name)
8371

8472

metomi/rose/run_source_vc.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
"""Write version control information of sources used in run time."""
1818

1919
import os
20+
import shlex
2021
import sys
2122

2223
from metomi.rose.popen import RosePopener
@@ -67,7 +68,7 @@ def write_source_vc_info(run_source_dir, output=None, popen=None):
6768
if out:
6869
write_safely(("#" * 80 + "\n"), handle)
6970
write_safely(
70-
("# %s\n" % popen.shlex_join(cmd)), handle
71+
("# %s\n" % shlex.join(cmd)), handle
7172
)
7273
write_safely(("#" * 80 + "\n"), handle)
7374
write_safely(out, handle)

0 commit comments

Comments
 (0)