Skip to content

Feat/plugins - deprecate otumate and old plugins #1253

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

Open
wants to merge 13 commits into
base: master
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
6 changes: 6 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@
8080,
9000
],
"mounts": [
"type=bind,source=${env:SSH_AUTH_SOCK},target=/ssh-agent"
],
"containerEnv": {
"SSH_AUTH_SOCK": "/ssh-agent"
},
// Uncomment the next line if you want start specific services in your Docker Compose config.
// "runServices": [],
// Uncomment the next line if you want to keep your containers running after VS Code shuts down.
Expand Down
7 changes: 1 addition & 6 deletions datajoint/attribute_adapter.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import re

from .errors import DataJointError, _support_adapted_types
from .plugin import type_plugins


class AttributeAdapter:
Expand Down Expand Up @@ -44,11 +43,7 @@ def get_adapter(context, adapter_name):
raise DataJointError("Support for Adapted Attribute types is disabled.")
adapter_name = adapter_name.lstrip("<").rstrip(">")
try:
adapter = (
context[adapter_name]
if adapter_name in context
else type_plugins[adapter_name]["object"].load()
)
adapter = context[adapter_name]
except KeyError:
raise DataJointError(
"Attribute adapter '{adapter_name}' is not defined.".format(
Expand Down
39 changes: 4 additions & 35 deletions datajoint/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
from .blob import pack, unpack
from .dependencies import Dependencies
from .hash import uuid_from_buffer
from .plugin import connection_plugins
from .settings import config
from .version import __version__

Expand All @@ -27,34 +26,6 @@
cache_key = "query_cache" # the key to lookup the query_cache folder in dj.config


def get_host_hook(host_input):
if "://" in host_input:
plugin_name = host_input.split("://")[0]
try:
return connection_plugins[plugin_name]["object"].load().get_host(host_input)
except KeyError:
raise errors.DataJointError(
"Connection plugin '{}' not found.".format(plugin_name)
)
else:
return host_input


def connect_host_hook(connection_obj):
if "://" in connection_obj.conn_info["host_input"]:
plugin_name = connection_obj.conn_info["host_input"].split("://")[0]
try:
connection_plugins[plugin_name]["object"].load().connect_host(
connection_obj
)
except KeyError:
raise errors.DataJointError(
"Connection plugin '{}' not found.".format(plugin_name)
)
else:
connection_obj.connect()


def translate_query_error(client_error, query):
"""
Take client error and original query and return the corresponding DataJoint exception.
Expand Down Expand Up @@ -177,7 +148,6 @@ class Connection:
"""

def __init__(self, host, user, password, port=None, init_fun=None, use_tls=None):
Copy link
Preview

Copilot AI Jul 29, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The variable assignment host_input, host = (host, get_host_hook(host)) was removed but the original host parameter is being overwritten without preserving the original value. This could break functionality that depends on the original host value.

Copilot uses AI. Check for mistakes.

host_input, host = (host, get_host_hook(host))
if ":" in host:
# the port in the hostname overrides the port argument
host, port = host.split(":")
Expand All @@ -190,11 +160,10 @@ def __init__(self, host, user, password, port=None, init_fun=None, use_tls=None)
use_tls if isinstance(use_tls, dict) else {"ssl": {}}
)
self.conn_info["ssl_input"] = use_tls
self.conn_info["host_input"] = host_input
self.init_fun = init_fun
self._conn = None
self._query_cache = None
connect_host_hook(self)
self.connect()
if self.is_connected:
logger.info(
"DataJoint {version} connected to {user}@{host}:{port}".format(
Expand Down Expand Up @@ -232,7 +201,7 @@ def connect(self):
**{
k: v
for k, v in self.conn_info.items()
if k not in ["ssl_input", "host_input"]
if k not in ["ssl_input"]
},
)
except client.err.InternalError:
Expand All @@ -245,7 +214,7 @@ def connect(self):
k: v
for k, v in self.conn_info.items()
if not (
k in ["ssl_input", "host_input"]
k == "ssl_input"
or k == "ssl"
and self.conn_info["ssl_input"] is None
)
Expand Down Expand Up @@ -352,7 +321,7 @@ def query(
if not reconnect:
raise
logger.warning("Reconnecting to MySQL server.")
connect_host_hook(self)
self.connect()
if self._in_transaction:
self.cancel_transaction()
raise errors.LostConnectionError(
Expand Down
20 changes: 0 additions & 20 deletions datajoint/errors.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,32 +5,12 @@
import os


# --- Unverified Plugin Check ---
class PluginWarning(Exception):
pass


# --- Top Level ---
class DataJointError(Exception):
"""
Base class for errors specific to DataJoint internal operation.
"""

def __init__(self, *args):
from .plugin import connection_plugins, type_plugins

self.__cause__ = (
PluginWarning("Unverified DataJoint plugin detected.")
if any(
[
any([not plugins[k]["verified"] for k in plugins])
for plugins in [connection_plugins, type_plugins]
if plugins
]
)
else None
)

def suggest(self, *args):
"""
regenerate the exception with additional arguments
Expand Down
46 changes: 0 additions & 46 deletions datajoint/plugin.py

This file was deleted.

Loading
Loading