Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for cached properties in python older python versions #5423

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion detectron2/utils/events.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,19 @@
import json
import logging
import os
import sys
import time
from collections import defaultdict
from contextlib import contextmanager
from functools import cached_property
from typing import Optional
import torch
from fvcore.common.history_buffer import HistoryBuffer

if sys.version_info >= (3, 8):
from functools import cached_property
else:
from backports.cached_property import cached_property

from detectron2.utils.file_io import PathManager

__all__ = [
Expand Down
1 change: 1 addition & 0 deletions docs/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,4 @@ omegaconf>=2.1.0.dev24
hydra-core>=1.1.0.dev5
scipy
timm
backports.cached-property==1.0.2; python_version < '3.8'
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,7 @@ def get_model_zoo_configs() -> List[str]:
"hydra-core>=1.1",
"black",
"packaging",
"backports.cached-property==1.0.2; python_version < '3.8'",
# NOTE: When adding new dependencies, if it is required at import time (in addition
# to runtime), it probably needs to appear in docs/requirements.txt, or as a mock
# in docs/conf.py
Expand Down