Skip to content

Commit

Permalink
fix: Restore support for Python 3.9 (#82)
Browse files Browse the repository at this point in the history
  • Loading branch information
KyleFromNVIDIA authored Apr 24, 2024
1 parent 2730275 commit ff5c739
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 12 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
path: ${{ env.OUTPUT_DIR }}
wheel:
runs-on: ubuntu-latest
container: python:3
container: python:3.9
steps:
- uses: actions/checkout@v4
with:
Expand Down
13 changes: 7 additions & 6 deletions src/rapids_dependency_file_generator/_config.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import typing
from dataclasses import dataclass, field
from enum import Enum
from os import PathLike
Expand Down Expand Up @@ -43,7 +44,7 @@ class FileExtras:
table: str
"""The ``table`` field."""

key: str | None = None
key: typing.Union[str, None] = None
"""The ``key`` field."""


Expand All @@ -57,7 +58,7 @@ class File:
includes: list[str]
"""The list of dependency sets to include."""

extras: FileExtras | None = None
extras: typing.Union[FileExtras, None] = None
"""Optional extra information for the file generator."""

matrix: dict[str, list[str]] = field(default_factory=dict)
Expand Down Expand Up @@ -88,7 +89,7 @@ class CommonDependencies:
output_types: set[Output]
"""The set of output types for this entry."""

packages: list[str | PipRequirements]
packages: list[typing.Union[str, PipRequirements]]
"""The list of packages for this entry."""


Expand All @@ -99,7 +100,7 @@ class MatrixMatcher:
matrix: dict[str, str]
"""The set of matrix values to match."""

packages: list[str | PipRequirements]
packages: list[typing.Union[str, PipRequirements]]
"""The list of packages for this entry."""


Expand Down Expand Up @@ -142,7 +143,7 @@ class Config:
"""The dependency sets, keyed by name."""


def _parse_outputs(outputs: str | list[str]) -> set[Output]:
def _parse_outputs(outputs: typing.Union[str, list[str]]) -> set[Output]:
if isinstance(outputs, str):
outputs = [outputs]
if outputs == ["none"]:
Expand Down Expand Up @@ -177,7 +178,7 @@ def get_extras():
)


def _parse_requirement(requirement: str | dict[str, str]) -> str | PipRequirements:
def _parse_requirement(requirement: typing.Union[str, dict[str, str]]) -> typing.Union[str, PipRequirements]:
if isinstance(requirement, str):
return requirement

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import itertools
import os
import textwrap
import typing
from collections import defaultdict
from collections.abc import Generator

Expand Down Expand Up @@ -40,8 +41,8 @@ def delete_existing_files(root: os.PathLike) -> None:


def dedupe(
dependencies: list[str | _config.PipRequirements],
) -> list[str | dict[str, str]]:
dependencies: list[typing.Union[str, _config.PipRequirements]],
) -> list[typing.Union[str, dict[str, str]]]:
"""Generate the unique set of dependencies contained in a dependency list.
Parameters
Expand Down Expand Up @@ -96,7 +97,7 @@ def make_dependency_file(
config_file: os.PathLike,
output_dir: os.PathLike,
conda_channels: list[str],
dependencies: list[str | dict[str, list[str]]],
dependencies: list[typing.Union[str, dict[str, list[str]]]],
extras: _config.FileExtras,
):
"""Generate the contents of the dependency file.
Expand Down Expand Up @@ -314,8 +315,8 @@ def should_use_specific_entry(matrix_combo: dict[str, str], specific_entry_matri
def make_dependency_files(
parsed_config: _config.Config,
file_keys: list[str],
output: set[_config.Output] | None,
matrix: dict[str, list[str]] | None,
output: typing.Union[set[_config.Output], None],
matrix: typing.Union[dict[str, list[str]], None],
prepend_channels: list[str],
to_stdout: bool,
):
Expand Down

0 comments on commit ff5c739

Please sign in to comment.