Skip to content

Commit

Permalink
3535 - drop python 36 support (#3536)
Browse files Browse the repository at this point in the history
* drop py36 support

Signed-off-by: Wenqi Li <wenqil@nvidia.com>

* drop 20.09 test because of python min version 3.6

Signed-off-by: Wenqi Li <wenqil@nvidia.com>

* update tests

Signed-off-by: Wenqi Li <wenqil@nvidia.com>

* error->warning, revise copyright

Signed-off-by: Wenqi Li <wenqil@nvidia.com>
  • Loading branch information
wyli authored Dec 23, 2021
1 parent 6767959 commit e655b4e
Show file tree
Hide file tree
Showing 13 changed files with 28 additions and 25 deletions.
15 changes: 8 additions & 7 deletions .github/workflows/pythonapp-gpu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,30 +20,31 @@ jobs:
matrix:
environment:
- "PT17+CUDA102"
- "PT17+CUDA110"
- "PT18+CUDA102"
- "PT18+CUDA112"
- "PT19+CUDA114"
- "PT110+CUDA115"
- "PT110+CUDA102"
include:
# https://docs.nvidia.com/deeplearning/frameworks/pytorch-release-notes
- environment: PT17+CUDA102
pytorch: "torch==1.7.1 torchvision==0.8.2"
base: "nvcr.io/nvidia/cuda:10.2-devel-ubuntu18.04"
- environment: PT17+CUDA110
# we explicitly set pytorch to -h to avoid pip install error
pytorch: "-h"
base: "nvcr.io/nvidia/pytorch:20.09-py3"
- environment: PT18+CUDA102
pytorch: "torch==1.8.1 torchvision==0.9.1"
base: "nvcr.io/nvidia/cuda:10.2-devel-ubuntu18.04"
- environment: PT18+CUDA112
# we explicitly set pytorch to -h to avoid pip install error
# 21.03: 1.9.0a0+df837d0
pytorch: "-h"
base: "nvcr.io/nvidia/pytorch:21.03-py3"
- environment: PT19+CUDA114
# we explicitly set pytorch to -h to avoid pip install error
# 21.10: 1.10.0a0+0aef44c
pytorch: "-h"
base: "nvcr.io/nvidia/pytorch:21.10-py3"
- environment: PT110+CUDA115
# we explicitly set pytorch to -h to avoid pip install error
# https://docs.nvidia.com/deeplearning/frameworks/pytorch-release-notes
# 21.12: 1.11.0a0+b6df043
pytorch: "-h"
base: "nvcr.io/nvidia/pytorch:21.12-py3"
Expand All @@ -62,7 +63,7 @@ jobs:
[ ${{ matrix.environment }} = "PT18+CUDA102" ] || \
[ ${{ matrix.environment }} = "PT110+CUDA102" ]
then
PYVER=3.6 PYSFX=3 DISTUTILS=python3-distutils && \
PYVER=3.7 PYSFX=3 DISTUTILS=python3-distutils && \
apt-get update && apt-get install -y --no-install-recommends \
curl \
pkg-config \
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pythonapp-min.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: [3.6, 3.7, 3.8, 3.9]
python-version: [3.7, 3.8, 3.9]
timeout-minutes: 40
steps:
- uses: actions/checkout@v2
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.6, 3.7, 3.8, 3.9]
python-version: [3.7, 3.8, 3.9]
steps:
- uses: actions/checkout@v2
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/setupapp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.6, 3.7, 3.8, 3.9]
python-version: [3.7, 3.8, 3.9]
steps:
- uses: actions/checkout@v2
with:
Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ repos:
rev: v2.29.0
hooks:
- id: pyupgrade
args: [--py36-plus]
args: [--py37-plus]
name: Upgrade code
exclude: |
(?x)^(
Expand Down
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ or (for new features that would not break existing functionality):
```

It is recommended that the new test `test_[module_name].py` is constructed by using only
python 3.6+ build-in functions, `torch`, `numpy`, `coverage` (for reporting code coverages) and `parameterized` (for organising test cases) packages.
python 3.7+ build-in functions, `torch`, `numpy`, `coverage` (for reporting code coverages) and `parameterized` (for organising test cases) packages.
If it requires any other external packages, please make sure:
- the packages are listed in [`requirements-dev.txt`](requirements-dev.txt)
- the new test `test_[module_name].py` is added to the `exclude_cases` in [`./tests/min_tests.py`](./tests/min_tests.py) so that
Expand Down Expand Up @@ -228,7 +228,7 @@ Notably,
for example, ``import monai.transforms.Spacing`` is the equivalent of ``monai.transforms.spatial.array.Spacing`` if
``class Spacing`` defined in file `monai/transforms/spatial/array.py` is decorated with ``@export("monai.transforms")``.

For string definition, [f-string](https://www.python.org/dev/peps/pep-0498/) is recommended to use over `%-print` and `format-print` from python 3.6. So please try to use `f-string` if you need to define any string object.
For string definition, [f-string](https://www.python.org/dev/peps/pep-0498/) is recommended to use over `%-print` and `format-print`. So please try to use `f-string` if you need to define any string object.

#### Backwards compatibility
MONAI is currently under active development, and with major version zero (following the [Semantic Versioning](https://semver.org/)).
Expand Down
2 changes: 1 addition & 1 deletion docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

# -- Project information -----------------------------------------------------
project = "MONAI"
copyright = "2020 - 2021 MONAI Consortium"
copyright = "MONAI Consortium"
author = "MONAI Contributors"

# The full version, including alpha/beta/rc tags
Expand Down
2 changes: 1 addition & 1 deletion docs/source/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

---

MONAI's core functionality is written in Python 3 (>= 3.6) and only requires [Numpy](https://numpy.org/) and [Pytorch](https://pytorch.org/).
MONAI's core functionality is written in Python 3 (>= 3.7) and only requires [Numpy](https://numpy.org/) and [Pytorch](https://pytorch.org/).

The package is currently distributed via Github as the primary source code repository,
and the Python package index (PyPI). The pre-built Docker images are made available on DockerHub.
Expand Down
14 changes: 8 additions & 6 deletions monai/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,22 +15,24 @@
from ._version import get_versions

PY_REQUIRED_MAJOR = 3
PY_REQUIRED_MINOR = 6
PY_REQUIRED_MINOR = 7

version_dict = get_versions()
__version__: str = version_dict.get("version", "0+unknown")
__revision_id__: str = version_dict.get("full-revisionid")
del get_versions, version_dict

__copyright__ = "(c) 2020 - 2021 MONAI Consortium"
__copyright__ = "(c) MONAI Consortium"

__basedir__ = os.path.dirname(__file__)

if sys.version_info.major != PY_REQUIRED_MAJOR or sys.version_info.minor < PY_REQUIRED_MINOR:
raise RuntimeError(
"MONAI requires Python {}.{} or higher. But the current Python is: {}".format(
PY_REQUIRED_MAJOR, PY_REQUIRED_MINOR, sys.version
)
import warnings

warnings.warn(
f"MONAI requires Python {PY_REQUIRED_MAJOR}.{PY_REQUIRED_MINOR} or higher. "
f"But the current Python is: {sys.version}",
category=RuntimeWarning,
)

from .utils.module import load_submodules # noqa: E402
Expand Down
2 changes: 1 addition & 1 deletion monai/data/torchscript_utils.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2020 - 2021 MONAI Consortium
# Copyright (c) MONAI Consortium
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ requires = [

[tool.black]
line-length = 120
target-version = ['py36', 'py37', 'py38']
target-version = ['py37', 'py38', 'py39']
include = '\.pyi?$'
exclude = '''
(
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ project_urls =
Source Code=https://github.com/Project-MONAI/MONAI

[options]
python_requires = >= 3.6
python_requires = >= 3.7
# for compiling and develop setup only
# no need to specify the versions so that we could
# compile for multiple targeted versions.
Expand Down
2 changes: 1 addition & 1 deletion tests/test_torchscript_utils.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2020 - 2021 MONAI Consortium
# Copyright (c) MONAI Consortium
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
Expand Down

0 comments on commit e655b4e

Please sign in to comment.