Skip to content

Commit 24215b5

Browse files
authored
Merge pull request #66 from mrc-ide/python-pi
Update Python version
2 parents bed0226 + 7b206e6 commit 24215b5

File tree

18 files changed

+57
-71
lines changed

18 files changed

+57
-71
lines changed

.github/workflows/test.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,13 @@ jobs:
1616
fail-fast: false
1717
matrix:
1818
config:
19-
- {os: ubuntu-latest, py: '3.9'}
2019
- {os: ubuntu-latest, py: '3.10'}
2120
- {os: ubuntu-latest, py: '3.11'}
2221
- {os: ubuntu-latest, py: '3.12'}
2322
- {os: ubuntu-latest, py: '3.13'}
24-
- {os: macos-latest, py: '3.13'}
25-
- {os: windows-latest, py: '3.13'}
23+
- {os: ubuntu-latest, py: '3.14'}
24+
- {os: macos-latest, py: '3.14'}
25+
- {os: windows-latest, py: '3.14'}
2626

2727
steps:
2828
- uses: actions/checkout@v3

pyproject.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,11 @@ authors = [
1616
classifiers = [
1717
"Development Status :: 4 - Beta",
1818
"Programming Language :: Python",
19-
"Programming Language :: Python :: 3.8",
20-
"Programming Language :: Python :: 3.9",
2119
"Programming Language :: Python :: 3.10",
2220
"Programming Language :: Python :: 3.11",
2321
"Programming Language :: Python :: 3.12",
2422
"Programming Language :: Python :: 3.13",
23+
"Programming Language :: Python :: 3.14",
2524
"Programming Language :: Python :: Implementation :: CPython",
2625
"Programming Language :: Python :: Implementation :: PyPy",
2726
]
@@ -79,7 +78,7 @@ generate-docs = [
7978
]
8079

8180
[[tool.hatch.envs.all.matrix]]
82-
python = ["3.9", "3.10", "3.11", "3.12", "3.13"]
81+
python = ["3.10", "3.11", "3.12", "3.13", "3.14"]
8382

8483
[tool.hatch.envs.lint]
8584
extra-dependencies = [
@@ -109,6 +108,7 @@ skip-string-normalization = true
109108

110109
[tool.ruff]
111110
line-length = 120
111+
target-version = "py310"
112112

113113
[tool.ruff.lint]
114114
select = [

src/pyorderly/core.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
from dataclasses import dataclass
44
from pathlib import Path
55
from types import SimpleNamespace
6-
from typing import Union
76

87
from dataclasses_json import dataclass_json
98

@@ -26,7 +25,7 @@ class Artefact:
2625
class Description:
2726
display: str
2827
long: str
29-
custom: dict[str, Union[str, int, bool]]
28+
custom: dict[str, str | int | bool]
3029

3130
@staticmethod
3231
def empty():
@@ -112,7 +111,7 @@ def resource(files):
112111

113112

114113
def shared_resource(
115-
files: Union[str, list[str], dict[str, str]],
114+
files: str | list[str] | dict[str, str],
116115
) -> dict[str, str]:
117116
"""Copy shared resources into a packet directory.
118117

src/pyorderly/current.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import os
22
from dataclasses import dataclass
33
from pathlib import Path
4-
from typing import Optional
54

65
from pyorderly.outpack.packet import Packet
76
from pyorderly.outpack.root import OutpackRoot, root_open
@@ -19,7 +18,7 @@ def __init__(self):
1918
@dataclass
2019
class OrderlyContext:
2120
# The active packet, if one is running
22-
packet: Optional[Packet]
21+
packet: Packet | None
2322
# the path to the packet running directory. This is a pathlib Path object
2423
path: Path
2524
# the path to the packet source
@@ -33,7 +32,7 @@ class OrderlyContext:
3332
# Special orderly custom metadata
3433
orderly: OrderlyCustomMetadata
3534
# Options used when searching for dependencies
36-
search_options: Optional[SearchOptions]
35+
search_options: SearchOptions | None
3736

3837
@staticmethod
3938
def from_packet(packet, path_src, search_options=None):

src/pyorderly/outpack/config.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import os.path
22
from dataclasses import dataclass, field
3-
from typing import Optional
43

54
from dataclasses_json import config, dataclass_json
65

@@ -37,7 +36,7 @@ def _decode_location_dict(d):
3736
@dataclass
3837
class ConfigCore:
3938
hash_algorithm: str
40-
path_archive: Optional[str]
39+
path_archive: str | None
4140
use_file_store: bool
4241
require_complete_tree: bool
4342

src/pyorderly/outpack/location.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import collections
22
import shutil
33
from pathlib import PurePath
4-
from typing import Union
4+
from typing import TypeAlias
55

66
from pyorderly.outpack.config import Location, update_config
77
from pyorderly.outpack.location_driver import LocationDriver
@@ -17,7 +17,7 @@
1717
LOCATION_RESERVED_NAME,
1818
)
1919

20-
LocationSelector = Union[None, str, list[str]]
20+
LocationSelector: TypeAlias = None | str | list[str]
2121

2222

2323
def outpack_location_list(root=None, *, locate=True):

src/pyorderly/outpack/location_packit.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import functools
22
import re
3-
from typing import Optional
43
from urllib.parse import urljoin
54

65
from pyorderly.outpack.location_http import (
@@ -19,7 +18,7 @@
1918
# - It should check for expiry of tokens and/or check for authentication errors
2019
# and purge offending tokens from it.
2120
@functools.cache
22-
def packit_authorisation(url: str, token: Optional[str]) -> dict[str, str]:
21+
def packit_authorisation(url: str, token: str | None) -> dict[str, str]:
2322
# If a non-Github token is provided, we assume it is a native Packit token
2423
# and use that directly.
2524
if token is not None:
@@ -45,7 +44,7 @@ def packit_authorisation(url: str, token: Optional[str]) -> dict[str, str]:
4544

4645

4746
def outpack_location_packit(
48-
url: str, token: Optional[str] = None
47+
url: str, token: str | None = None
4948
) -> OutpackLocationHTTP:
5049
if not url.endswith("/"):
5150
url += "/"

src/pyorderly/outpack/location_pull.py

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
from collections.abc import Generator
55
from contextlib import contextmanager
66
from dataclasses import dataclass
7-
from typing import Optional, Union
87

98
import humanize
109

@@ -136,11 +135,11 @@ def _mark_all_known(
136135

137136

138137
def outpack_location_pull_packet(
139-
ids: Union[str, list[str]],
138+
ids: str | list[str],
140139
*,
141-
options: Optional[SearchOptions] = None,
142-
recursive: Optional[bool] = None,
143-
root: Union[str, OutpackRoot, None] = None,
140+
options: SearchOptions | None = None,
141+
recursive: bool | None = None,
142+
root: str | OutpackRoot | None = None,
144143
locate: bool = True,
145144
):
146145
root = root_open(root, locate=locate)
@@ -356,9 +355,9 @@ class PullPlanPackets:
356355

357356
def location_build_pull_plan(
358357
packet_ids: list[str],
359-
locations: Optional[list[str]],
358+
locations: list[str] | None,
360359
*,
361-
files: Optional[dict[str, list[str]]] = None,
360+
files: dict[str, list[str]] | None = None,
362361
recursive: bool,
363362
root: OutpackRoot,
364363
) -> LocationPullPlan:
@@ -432,7 +431,7 @@ def _location_build_pull_plan_packets(
432431

433432

434433
def _location_build_pull_plan_location(
435-
packets: PullPlanPackets, locations: Optional[list[str]], root: OutpackRoot
434+
packets: PullPlanPackets, locations: list[str] | None, root: OutpackRoot
436435
) -> list[str]:
437436
location_names = location_resolve_valid(
438437
locations,

src/pyorderly/outpack/location_push.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
from dataclasses import dataclass
2-
from typing import Union
32

43
from pyorderly.outpack.location import (
54
_find_all_dependencies,
@@ -19,10 +18,10 @@ class LocationPushPlan:
1918

2019

2120
def outpack_location_push(
22-
ids: Union[str, list[str]],
21+
ids: str | list[str],
2322
location: str,
2423
*,
25-
root: Union[str, OutpackRoot, None] = None,
24+
root: str | OutpackRoot | None = None,
2625
locate: bool = True,
2726
):
2827
root = root_open(root, locate=locate)

src/pyorderly/outpack/metadata.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from dataclasses import dataclass
22
from pathlib import Path
3-
from typing import Optional, Union
3+
from typing import TypeAlias
44

55
from dataclasses_json import DataClassJsonMixin
66

@@ -51,7 +51,7 @@ def files_from_dict(files):
5151
return [{"here": h, "there": t} for h, t, in files.items()]
5252

5353

54-
Parameters = dict[str, Union[bool, int, float, str]]
54+
Parameters: TypeAlias = dict[str, bool | int | float | str]
5555

5656

5757
@dataclass
@@ -63,8 +63,8 @@ class MetadataCore(DataClassJsonMixin):
6363
time: dict[str, float]
6464
files: list[PacketFile]
6565
depends: list[PacketDepends]
66-
git: Optional[GitInfo]
67-
custom: Optional[dict]
66+
git: GitInfo | None
67+
custom: dict | None
6868

6969
def file_hash(self, name):
7070
for x in self.files:

0 commit comments

Comments
 (0)