Skip to content

Commit

Permalink
Deprecate py37 (#1611)
Browse files Browse the repository at this point in the history
Remove `_nullcontext` as from 3.7+ there is a similar method in standard library
  • Loading branch information
rahul-tuli committed Jun 8, 2023
1 parent 1575944 commit ff98ca0
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 15 deletions.
2 changes: 1 addition & 1 deletion DEVELOPING.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ limitations under the License.

# Developing SparseML

SparseML is developed and tested using Python 3.7-3.10.
SparseML is developed and tested using Python 3.8-3.10.
To develop SparseML, you will also need the development dependencies and to follow the styling guidelines.

Here are some details to get started.
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ SparseML enables you to create a sparse model trained on your dataset in two way

## Installation

This repository is tested on Python 3.7-3.10, and Linux/Debian systems.
This repository is tested on Python 3.8-3.10, and Linux/Debian systems.

It is recommended to install in a [virtual environment](https://docs.python.org/3/library/venv.html) to keep your system in order.
Currently supported ML Frameworks are the following: `torch>=1.1.0,<1.14`, `tensorflow>=1.8.0,<2.0.0`, `tensorflow.keras >= 2.2.0`.
Expand Down
2 changes: 1 addition & 1 deletion docs/source/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ limitations under the License.

# Installation

This repository is tested on Python 3.7-3.10, and Linux/Debian systems.
This repository is tested on Python 3.8-3.10, and Linux/Debian systems.
It is recommended to install in a [virtual environment](https://docs.python.org/3/library/venv.html) to keep your system in order.
Currently supported ML Frameworks are the following: `torch>=1.1.0,<1.14`, `tensorflow>=1.8.0,<=2.0.0`, `tensorflow.keras >= 2.2.0`.

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ def _setup_long_description() -> Tuple[str, str]:
install_requires=_setup_install_requires(),
extras_require=_setup_extras(),
entry_points=_setup_entry_points(),
python_requires=">=3.7.0,<3.11",
python_requires=">=3.8.0,<3.11",
classifiers=[
"Development Status :: 5 - Production/Stable",
"Programming Language :: Python :: 3",
Expand Down
13 changes: 2 additions & 11 deletions src/sparseml/pytorch/image_classification/utils/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
import logging
import os
import warnings
from contextlib import contextmanager
from contextlib import nullcontext
from enum import Enum, auto, unique
from typing import Any, Dict, List, Optional, Tuple, Union

Expand Down Expand Up @@ -262,7 +262,7 @@ def get_dataset_and_dataloader(
download_context = (
torch_distributed_zero_first(local_rank) # only download once locally
if training
else _nullcontext()
else nullcontext()
)
dataset_kwargs = dataset_kwargs or {}

Expand Down Expand Up @@ -620,12 +620,3 @@ def _download_model_from_zoo_using_recipe(
Model(recipe_stub),
recipe_name=recipe_type,
)


@contextmanager
def _nullcontext(enter_result=None):
"""
A context manager that does nothing. For compatibility with Python 3.6
Update usages to use contextlib.nullcontext on Python 3.7+
"""
yield enter_result

0 comments on commit ff98ca0

Please sign in to comment.