Remove Sentry from requirements (#2878)
This commit is contained in:
3
setup.py
3
setup.py
@ -11,7 +11,6 @@ FILE = Path(__file__).resolve()
|
|||||||
PARENT = FILE.parent # root directory
|
PARENT = FILE.parent # root directory
|
||||||
README = (PARENT / 'README.md').read_text(encoding='utf-8')
|
README = (PARENT / 'README.md').read_text(encoding='utf-8')
|
||||||
REQUIREMENTS = [f'{x.name}{x.specifier}' for x in pkg.parse_requirements((PARENT / 'requirements.txt').read_text())]
|
REQUIREMENTS = [f'{x.name}{x.specifier}' for x in pkg.parse_requirements((PARENT / 'requirements.txt').read_text())]
|
||||||
PKG_REQUIREMENTS = ['sentry_sdk'] # pip-only requirements
|
|
||||||
|
|
||||||
|
|
||||||
def get_version():
|
def get_version():
|
||||||
@ -37,7 +36,7 @@ setup(
|
|||||||
author_email='hello@ultralytics.com',
|
author_email='hello@ultralytics.com',
|
||||||
packages=find_packages(), # required
|
packages=find_packages(), # required
|
||||||
include_package_data=True,
|
include_package_data=True,
|
||||||
install_requires=REQUIREMENTS + PKG_REQUIREMENTS,
|
install_requires=REQUIREMENTS,
|
||||||
extras_require={
|
extras_require={
|
||||||
'dev': [
|
'dev': [
|
||||||
'check-manifest',
|
'check-manifest',
|
||||||
|
@ -164,7 +164,7 @@ class IterableSimpleNamespace(SimpleNamespace):
|
|||||||
return getattr(self, key, default)
|
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.
|
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.
|
callable: Decorated function with temporarily set rc parameters and backend.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
if rcparams is None:
|
||||||
|
rcparams = {'font.size': 11}
|
||||||
|
|
||||||
def decorator(func):
|
def decorator(func):
|
||||||
"""Decorator to apply temporary rc parameters and backend to a function."""
|
"""Decorator to apply temporary rc parameters and backend to a function."""
|
||||||
|
|
||||||
@ -242,7 +245,7 @@ if WINDOWS: # emoji-safe logging
|
|||||||
LOGGER.addFilter(EmojiFilter())
|
LOGGER.addFilter(EmojiFilter())
|
||||||
|
|
||||||
|
|
||||||
def yaml_save(file='data.yaml', data={}):
|
def yaml_save(file='data.yaml', data=None):
|
||||||
"""
|
"""
|
||||||
Save YAML data to a file.
|
Save YAML data to a file.
|
||||||
|
|
||||||
@ -253,6 +256,8 @@ def yaml_save(file='data.yaml', data={}):
|
|||||||
Returns:
|
Returns:
|
||||||
None: Data is saved to the specified file.
|
None: Data is saved to the specified file.
|
||||||
"""
|
"""
|
||||||
|
if data is None:
|
||||||
|
data = {}
|
||||||
file = Path(file)
|
file = Path(file)
|
||||||
if not file.parent.exists():
|
if not file.parent.exists():
|
||||||
# Create parent directories if they don't exist
|
# Create parent directories if they don't exist
|
||||||
@ -603,10 +608,11 @@ def threaded(func):
|
|||||||
|
|
||||||
def set_sentry():
|
def set_sentry():
|
||||||
"""
|
"""
|
||||||
Initialize the Sentry SDK for error tracking and reporting. Enabled when sync=True in settings and
|
Initialize the Sentry SDK for error tracking and reporting. Only used if sentry_sdk package is installed and
|
||||||
disabled when sync=False. Run 'yolo settings' to see and update settings YAML file.
|
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
|
- sync=True in YOLO settings
|
||||||
- pytest is not running
|
- pytest is not running
|
||||||
- running in a pip package installation
|
- running in a pip package installation
|
||||||
@ -653,7 +659,12 @@ def set_sentry():
|
|||||||
is_pip_package() and \
|
is_pip_package() and \
|
||||||
not is_git_dir():
|
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(
|
sentry_sdk.init(
|
||||||
dsn='https://5ff1556b71594bfea135ff0203a0d290@o4504521589325824.ingest.sentry.io/4504521592406016',
|
dsn='https://5ff1556b71594bfea135ff0203a0d290@o4504521589325824.ingest.sentry.io/4504521592406016',
|
||||||
debug=False,
|
debug=False,
|
||||||
|
@ -232,16 +232,22 @@ def check_requirements(requirements=ROOT.parent / 'requirements.txt', exclude=()
|
|||||||
s += f'"{r}" '
|
s += f'"{r}" '
|
||||||
n += 1
|
n += 1
|
||||||
|
|
||||||
if s and install and AUTOINSTALL: # check environment variable
|
if s:
|
||||||
LOGGER.info(f"{prefix} Ultralytics requirement{'s' * (n > 1)} {s}not found, attempting AutoUpdate...")
|
if install and AUTOINSTALL: # check environment variable
|
||||||
try:
|
LOGGER.info(f"{prefix} Ultralytics requirement{'s' * (n > 1)} {s}not found, attempting AutoUpdate...")
|
||||||
assert is_online(), 'AutoUpdate skipped (offline)'
|
try:
|
||||||
LOGGER.info(subprocess.check_output(f'pip install --no-cache {s} {cmds}', shell=True).decode())
|
assert is_online(), 'AutoUpdate skipped (offline)'
|
||||||
s = f"{prefix} {n} package{'s' * (n > 1)} updated per {file or requirements}\n" \
|
LOGGER.info(subprocess.check_output(f'pip install --no-cache {s} {cmds}', shell=True).decode())
|
||||||
f"{prefix} ⚠️ {colorstr('bold', 'Restart runtime or rerun command for updates to take effect')}\n"
|
s = f"{prefix} {n} package{'s' * (n > 1)} updated per {file or requirements}\n" \
|
||||||
LOGGER.info(s)
|
f"{prefix} ⚠️ {colorstr('bold', 'Restart runtime or rerun command for updates to take effect')}\n"
|
||||||
except Exception as e:
|
LOGGER.info(s)
|
||||||
LOGGER.warning(f'{prefix} ❌ {e}')
|
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=''):
|
def check_suffix(file='yolov8n.pt', suffix='.pt', msg=''):
|
||||||
|
Reference in New Issue
Block a user