Skip to content

Commit

Permalink
Restore support for Python 3.9 (#21)
Browse files Browse the repository at this point in the history
#19 added MyPy
linting, but CI did not run under Python 3.9, so the new type annotation
syntax was used. Use the old syntax to support Python 3.9, and run CI in
Python 3.9.
  • Loading branch information
KyleFromNVIDIA authored May 3, 2024
1 parent 30a3995 commit 0c7e6d1
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/checks-and-builds.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
needs: check-style
runs-on: ubuntu-latest
container:
image: rapidsai/ci-conda:latest
image: rapidsai/ci-conda:cuda12.2.2-ubuntu22.04-py3.9
env:
PUBLISH: "${{ inputs.publish }}"
steps:
Expand All @@ -42,7 +42,7 @@ jobs:
needs: check-style
runs-on: ubuntu-latest
container:
image: rapidsai/ci-wheel:latest
image: rapidsai/ci-wheel:cuda12.2.2-ubuntu20.04-py3.9
env:
PUBLISH: "${{ inputs.publish }}"
RAPIDS_CONDA_TOKEN: ${{ secrets.CONDA_RAPIDSAI_WHEELS_NIGHTLY_TOKEN }}
Expand Down
10 changes: 6 additions & 4 deletions rapids_build_backend/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,18 @@
from .utils import _get_pyproject

if TYPE_CHECKING:
from typing import Callable
from typing import Callable, Union

# config options can be one of these types...
config_val_type = str | bool | None
config_val_type = Union[str, bool, None]

# ... or a callable that returns one of those or some other mutable types
mutable_config_val_type = list[str]
config_val_callable = Callable[[], config_val_type | mutable_config_val_type]
config_val_callable = Callable[[], Union[config_val_type, mutable_config_val_type]]

config_options_type = dict[str, tuple[config_val_type | config_val_callable, bool]]
config_options_type = dict[
str, tuple[Union[config_val_type, config_val_callable], bool]
]


class Config:
Expand Down
3 changes: 2 additions & 1 deletion rapids_build_backend/impls.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
from contextlib import contextmanager
from functools import lru_cache
from importlib import import_module
from typing import Union

import rapids_dependency_file_generator
import tomli_w
Expand Down Expand Up @@ -99,7 +100,7 @@ def _get_cuda_suffix(require_cuda=False) -> str:


@lru_cache
def _get_git_commit() -> str | None:
def _get_git_commit() -> Union[str, None]:
"""Get the current git commit.
Returns None if git is not in the PATH or if it fails to find the commit.
Expand Down

0 comments on commit 0c7e6d1

Please sign in to comment.