Remove Sentry from requirements (#2878)
This commit is contained in:
@ -164,7 +164,7 @@ class IterableSimpleNamespace(SimpleNamespace):
|
||||
return getattr(self, key, default)
|
||||
|
||||
|
||||
def plt_settings(rcparams={'font.size': 11}, backend='Agg'):
|
||||
def plt_settings(rcparams=None, backend='Agg'):
|
||||
"""
|
||||
Decorator to temporarily set rc parameters and the backend for a plotting function.
|
||||
|
||||
@ -180,6 +180,9 @@ def plt_settings(rcparams={'font.size': 11}, backend='Agg'):
|
||||
callable: Decorated function with temporarily set rc parameters and backend.
|
||||
"""
|
||||
|
||||
if rcparams is None:
|
||||
rcparams = {'font.size': 11}
|
||||
|
||||
def decorator(func):
|
||||
"""Decorator to apply temporary rc parameters and backend to a function."""
|
||||
|
||||
@ -242,7 +245,7 @@ if WINDOWS: # emoji-safe logging
|
||||
LOGGER.addFilter(EmojiFilter())
|
||||
|
||||
|
||||
def yaml_save(file='data.yaml', data={}):
|
||||
def yaml_save(file='data.yaml', data=None):
|
||||
"""
|
||||
Save YAML data to a file.
|
||||
|
||||
@ -253,6 +256,8 @@ def yaml_save(file='data.yaml', data={}):
|
||||
Returns:
|
||||
None: Data is saved to the specified file.
|
||||
"""
|
||||
if data is None:
|
||||
data = {}
|
||||
file = Path(file)
|
||||
if not file.parent.exists():
|
||||
# Create parent directories if they don't exist
|
||||
@ -603,10 +608,11 @@ def threaded(func):
|
||||
|
||||
def set_sentry():
|
||||
"""
|
||||
Initialize the Sentry SDK for error tracking and reporting. Enabled when sync=True in settings and
|
||||
disabled when sync=False. Run 'yolo settings' to see and update settings YAML file.
|
||||
Initialize the Sentry SDK for error tracking and reporting. Only used if sentry_sdk package is installed and
|
||||
sync=True in settings. Run 'yolo settings' to see and update settings YAML file.
|
||||
|
||||
Conditions required to send errors:
|
||||
Conditions required to send errors (ALL conditions must be met or no errors will be reported):
|
||||
- sentry_sdk package is installed
|
||||
- sync=True in YOLO settings
|
||||
- pytest is not running
|
||||
- running in a pip package installation
|
||||
@ -653,7 +659,12 @@ def set_sentry():
|
||||
is_pip_package() and \
|
||||
not is_git_dir():
|
||||
|
||||
import sentry_sdk # noqa
|
||||
# If sentry_sdk package is not installed then return and do not use Sentry
|
||||
try:
|
||||
import sentry_sdk # noqa
|
||||
except ImportError:
|
||||
return
|
||||
|
||||
sentry_sdk.init(
|
||||
dsn='https://5ff1556b71594bfea135ff0203a0d290@o4504521589325824.ingest.sentry.io/4504521592406016',
|
||||
debug=False,
|
||||
|
@ -232,16 +232,22 @@ def check_requirements(requirements=ROOT.parent / 'requirements.txt', exclude=()
|
||||
s += f'"{r}" '
|
||||
n += 1
|
||||
|
||||
if s and install and AUTOINSTALL: # check environment variable
|
||||
LOGGER.info(f"{prefix} Ultralytics requirement{'s' * (n > 1)} {s}not found, attempting AutoUpdate...")
|
||||
try:
|
||||
assert is_online(), 'AutoUpdate skipped (offline)'
|
||||
LOGGER.info(subprocess.check_output(f'pip install --no-cache {s} {cmds}', shell=True).decode())
|
||||
s = f"{prefix} {n} package{'s' * (n > 1)} updated per {file or requirements}\n" \
|
||||
f"{prefix} ⚠️ {colorstr('bold', 'Restart runtime or rerun command for updates to take effect')}\n"
|
||||
LOGGER.info(s)
|
||||
except Exception as e:
|
||||
LOGGER.warning(f'{prefix} ❌ {e}')
|
||||
if s:
|
||||
if install and AUTOINSTALL: # check environment variable
|
||||
LOGGER.info(f"{prefix} Ultralytics requirement{'s' * (n > 1)} {s}not found, attempting AutoUpdate...")
|
||||
try:
|
||||
assert is_online(), 'AutoUpdate skipped (offline)'
|
||||
LOGGER.info(subprocess.check_output(f'pip install --no-cache {s} {cmds}', shell=True).decode())
|
||||
s = f"{prefix} {n} package{'s' * (n > 1)} updated per {file or requirements}\n" \
|
||||
f"{prefix} ⚠️ {colorstr('bold', 'Restart runtime or rerun command for updates to take effect')}\n"
|
||||
LOGGER.info(s)
|
||||
except Exception as e:
|
||||
LOGGER.warning(f'{prefix} ❌ {e}')
|
||||
return False
|
||||
else:
|
||||
return False
|
||||
|
||||
return True
|
||||
|
||||
|
||||
def check_suffix(file='yolov8n.pt', suffix='.pt', msg=''):
|
||||
|
Reference in New Issue
Block a user