Skip to content

Commit

Permalink
Drop Python 3.9 support (#102)
Browse files Browse the repository at this point in the history
Contributes to rapidsai/build-planning#88.

Drops Python 3.9 support.

## Notes for Reviewers

### Is this safe for `nvmath-python`?

I think yes.

In an offline conversation, I was told that `nvmath-python` follows NEP 29 (https://numpy.org/neps/nep-0029-deprecation_policy.html) and so would want to drop Python 3.9 in its next release anyway.

That's documented in its docs as well:

https://github.com/NVIDIA/nvmath-python/blob/7c485842d0f3300e03ec780056936503913910fe/docs/sphinx/overview.rst?plain=1#L274

cc @leofang 

### How I tested this

Checked that there were no remaining uses like this:

```shell
git grep -E '3\.9'
git grep '39'
git grep 'py39'
```

And similar for variations on Python 3.8 (to catch things that were missed the last time this was done).

### What are these other changes?

`ruff` raised two new errors here:

```text
.ycm_extra_conf.py:24:5: N802 Function name `Settings` should be lowercase
pynvjitlink/patch.py:226:20: UP031 Use format specifiers instead of percent format
Found 2 errors.
No fixes available (1 hidden fix can be enabled with the `--unsafe-fixes` option).
```

Left `Settings` untouched... looks like `ycm` expects that to be exactly `Settings` ([ycm-core docs](https://github.com/ycm-core/YouCompleteMe/blob/0d855962a60bd993980d287a3ac97f57ecd02ea6/README.md?plain=1#L1431)).

The `verify-copyright` hook also complained about one file missing a copyright header

```text
In file .ycm_extra_conf.py:1:1:
 import os
warning: no copyright notice found
```

So I added one.

Authors:
  - James Lamb (https://github.com/jameslamb)

Approvers:
  - Bradley Dice (https://github.com/bdice)
  - Leo Fang (https://github.com/leofang)
  - https://github.com/jakirkham

URL: #102
  • Loading branch information
jameslamb authored Aug 26, 2024
1 parent a2f23b7 commit 1bda65d
Show file tree
Hide file tree
Showing 13 changed files with 26 additions and 34 deletions.
4 changes: 0 additions & 4 deletions .github/actions/compute-matrix/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,22 +16,18 @@ runs:
set -eo pipefail
export BUILD_MATRIX="
- { CUDA_VER: '12.0.1', ARCH: 'amd64', PY_VER: '3.9', LINUX_VER: 'rockylinux8' }
- { CUDA_VER: '12.0.1', ARCH: 'amd64', PY_VER: '3.10', LINUX_VER: 'rockylinux8' }
- { CUDA_VER: '12.0.1', ARCH: 'amd64', PY_VER: '3.11', LINUX_VER: 'rockylinux8' }
- { CUDA_VER: '12.0.1', ARCH: 'amd64', PY_VER: '3.12', LINUX_VER: 'rockylinux8' }
- { CUDA_VER: '12.0.1', ARCH: 'arm64', PY_VER: '3.9', LINUX_VER: 'rockylinux8' }
- { CUDA_VER: '12.0.1', ARCH: 'arm64', PY_VER: '3.10', LINUX_VER: 'rockylinux8' }
- { CUDA_VER: '12.0.1', ARCH: 'arm64', PY_VER: '3.11', LINUX_VER: 'rockylinux8' }
- { CUDA_VER: '12.0.1', ARCH: 'arm64', PY_VER: '3.12', LINUX_VER: 'rockylinux8' }
"
export TEST_MATRIX="
- { CUDA_VER: '12.0.1', ARCH: 'amd64', PY_VER: '3.9', LINUX_VER: 'ubuntu20.04', gpu: 'v100', driver: 'latest' }
- { CUDA_VER: '12.0.1', ARCH: 'amd64', PY_VER: '3.10', LINUX_VER: 'ubuntu20.04', gpu: 'v100', driver: 'latest' }
- { CUDA_VER: '12.0.1', ARCH: 'amd64', PY_VER: '3.11', LINUX_VER: 'ubuntu20.04', gpu: 'v100', driver: 'latest' }
- { CUDA_VER: '12.0.1', ARCH: 'amd64', PY_VER: '3.12', LINUX_VER: 'ubuntu20.04', gpu: 'v100', driver: 'latest' }
- { CUDA_VER: '12.0.1', ARCH: 'arm64', PY_VER: '3.9', LINUX_VER: 'ubuntu20.04', gpu: 'a100', driver: 'latest' }
- { CUDA_VER: '12.0.1', ARCH: 'arm64', PY_VER: '3.10', LINUX_VER: 'ubuntu20.04', gpu: 'a100', driver: 'latest' }
- { CUDA_VER: '12.0.1', ARCH: 'arm64', PY_VER: '3.11', LINUX_VER: 'ubuntu20.04', gpu: 'a100', driver: 'latest' }
- { CUDA_VER: '12.0.1', ARCH: 'arm64', PY_VER: '3.12', LINUX_VER: 'ubuntu20.04', gpu: 'a100', driver: 'latest' }
Expand Down
5 changes: 3 additions & 2 deletions .ycm_extra_conf.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Copyright (c) 2023-2024, NVIDIA CORPORATION.

import os
import sys

from pathlib import Path

CONDA_PREFIX = os.environ["CONDA_PREFIX"]
Expand All @@ -22,7 +23,7 @@
]


def Settings(**kwargs):
def Settings(**kwargs): # noqa: N802
return {"flags": flags}


Expand Down
3 changes: 2 additions & 1 deletion ci/run_patched_numba_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
patch.patch_numba_linker()

if __name__ == "__main__":
from numba.testing._runtests import _main
import sys

from numba.testing._runtests import _main

sys.exit(0 if _main(sys.argv) else 1)
6 changes: 1 addition & 5 deletions dependencies.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,6 @@ dependencies:
specific:
- output_types: conda
matrices:
- matrix:
py: "3.9"
packages:
- python=3.9
- matrix:
py: "3.10"
packages:
Expand All @@ -89,7 +85,7 @@ dependencies:
- python=3.12
- matrix:
packages:
- python>=3.9,<3.13
- python>=3.10,<3.13
run:
common:
- output_types: [conda, requirements, pyproject]
Expand Down
3 changes: 1 addition & 2 deletions examples/jit_link_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,10 @@
# In addition to CUSource files, PTXSource objects can be used to link PTX from
# memory (not shown in this example).

import numpy as np
from numba import cuda
from pynvjitlink import patch

import numpy as np

patch.patch_numba_linker()

source = cuda.CUSource(
Expand Down
2 changes: 1 addition & 1 deletion pynvjitlink/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Copyright (c) 2023-2024, NVIDIA CORPORATION.

from pynvjitlink.api import NvJitLinker, NvJitLinkError, nvjitlink_version
from pynvjitlink._version import __git_commit__, __version__
from pynvjitlink.api import NvJitLinker, NvJitLinkError, nvjitlink_version

__all__ = [
"NvJitLinkError",
Expand Down
4 changes: 2 additions & 2 deletions pynvjitlink/api.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# Copyright (c) 2023-2024, NVIDIA CORPORATION.

import weakref
from enum import Enum
from pynvjitlink import _nvjitlinklib

import weakref
from pynvjitlink import _nvjitlinklib


class InputType(Enum):
Expand Down
12 changes: 6 additions & 6 deletions pynvjitlink/patch.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# Copyright (c) 2023-2024, NVIDIA CORPORATION.
from functools import partial
from pynvjitlink.api import NvJitLinker, NvJitLinkError

import os
import pathlib
from functools import partial

from pynvjitlink.api import NvJitLinker, NvJitLinkError

_numba_version_ok = False
_numba_error = None
Expand All @@ -29,14 +29,14 @@
_numba_error = f"failed to import Numba: {ie}."

if _numba_version_ok:
from numba.core import config
from numba import cuda
from numba.core import config
from numba.cuda.cudadrv import nvrtc
from numba.cuda.cudadrv.driver import (
driver,
FILE_EXTENSION_MAP,
Linker,
LinkerError,
driver,
)
else:
# Prevent the definition of PatchedLinker failing if we have no Numba
Expand Down Expand Up @@ -223,7 +223,7 @@ def add_cu(self, cu, name):
ptx, log = nvrtc.compile(cu, name, cc)

if config.DUMP_ASSEMBLY:
print(("ASSEMBLY %s" % name).center(80, "-"))
print((f"ASSEMBLY {name}").center(80, "-"))
print(ptx)
print("=" * 80)

Expand Down
4 changes: 2 additions & 2 deletions pynvjitlink/tests/conftest.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# Copyright (c) 2024, NVIDIA CORPORATION.

import os
import pytest

import pytest
from numba import cuda
from pynvjitlink.patch import Archive, Cubin, CUSource, Fatbin, Object, PTXSource, LTOIR
from pynvjitlink.patch import LTOIR, Archive, Cubin, CUSource, Fatbin, Object, PTXSource


@pytest.fixture(scope="session")
Expand Down
10 changes: 5 additions & 5 deletions pynvjitlink/tests/test_patch.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
# Copyright (c) 2023-2024, NVIDIA CORPORATION.

import pytest
import sys
from unittest.mock import patch as mock_patch

import pytest
from numba import cuda
from pynvjitlink import patch, NvJitLinkError
from pynvjitlink import NvJitLinkError, patch
from pynvjitlink.patch import (
PatchedLinker,
patch_numba_linker,
_numba_version_ok,
new_patched_linker,
patch_numba_linker,
required_numba_ver,
_numba_version_ok,
)
from unittest.mock import patch as mock_patch


def test_numba_patching_numba_not_ok():
Expand Down
3 changes: 1 addition & 2 deletions pynvjitlink/tests/test_pynvjitlink.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
# Copyright (c) 2023-2024, NVIDIA CORPORATION. All rights reserved.

import pytest

import pynvjitlink
import pytest
from pynvjitlink import _nvjitlinklib
from pynvjitlink.api import InputType

Expand Down
2 changes: 1 addition & 1 deletion pynvjitlink/tests/test_pynvjitlink_api.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Copyright (c) 2023-2024, NVIDIA CORPORATION. All rights reserved.

import pytest
import sys

import pytest
from pynvjitlink import NvJitLinker, NvJitLinkError


Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ authors = [
{ name = "NVIDIA Corporation" },
]
license = { text = "Apache 2.0" }
requires-python = ">=3.9"
requires-python = ">=3.10"
dependencies = [
] # This list was generated by `rapids-dependency-file-generator`. To make changes, edit dependencies.yaml and run `rapids-dependency-file-generator`.

Expand Down

0 comments on commit 1bda65d

Please sign in to comment.