Skip to content

Commit

Permalink
Merge pull request #10 from spapa013/main
Browse files Browse the repository at this point in the history
v0.0.4 - adds register_bases
  • Loading branch information
spapa013 authored Nov 30, 2021
2 parents a0ef6b0 + 24a4699 commit 88b4a9d
Show file tree
Hide file tree
Showing 9 changed files with 48 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,4 @@
)
)

def check_latest_version_from_github(owner='cajal', repo='microns-materialization', source='tag', branch=None, path_to_version_file=None, warn=True):
"""
Wrapper for :func:`~microns_utils.version_utils.check_latest_version_from_github`
"""
return version_utils.check_latest_version_from_github(owner=owner, repo=repo, source=source, branch=branch, path_to_version_file=path_to_version_file, warn=warn)
check_latest_version_from_github = version_utils.latest_github_version_checker(owner='cajal', repo='microns-materialization')
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,23 @@
Configuration package/module for microns-materialization.
"""

import inspect
import traceback
from enum import Enum
from . import adapters
from . import externals

import traceback

from . import bases
try:
import datajoint as dj
except:
traceback.print_exc()
raise ImportError('DataJoint package not found.')
from microns_utils import config_utils

from enum import Enum

from microns_utils import config_utils

config_utils.enable_datajoint_flags()


def register_externals(schema_name:str):
"""
Registers the external stores for a schema_name in this module.
Expand All @@ -39,12 +39,27 @@ def register_adapters(schema_name:str, context=None):
config_utils.register_adapters(adapter_objects, context=context)


def register_bases(schema_name:str, module):
"""
Maps base classes to DataJoint tables.
"""
bases = config_mapping[SCHEMAS(schema_name)]["bases"]

if bases is not None:
for base in bases:
config_utils.register_bases(base, module)
return module


def create_vm(schema_name:str):
"""
Creates a virtual module after registering the external stores, and includes the adapter objects in the vm.
Creates a virtual module after registering the external stores, adapter objects, DatajointPlus and base classes.
"""
schema = SCHEMAS(schema_name)
return config_utils.create_vm(schema.value, external_stores=config_mapping[schema]["externals"], adapter_objects=config_mapping[schema]["adapters"])
vm = config_utils._create_vm(schema.value, external_stores=config_mapping[schema]["externals"], adapter_objects=config_mapping[schema]["adapters"])
config_utils.add_datajoint_plus(vm)
register_bases(schema_name, vm)
return vm


class SCHEMAS(Enum):
Expand All @@ -56,10 +71,12 @@ class SCHEMAS(Enum):
SCHEMAS.H01_MATERIALIZATION: {
"externals": externals.h01_materialization,
"adapters": adapters.h01_materialization_adapter_objects,
"bases": None
},
SCHEMAS.MINNIE65_MATERIALIZATION: {
"externals": externals.minnie65_materialization,
"adapters": adapters.minnie65_materialization_adapter_objects
"adapters": adapters.minnie65_materialization_adapter_objects,
"bases": None
},

}
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
"""
Adapters for DataJoint tables.
"""

import datajoint as dj
import numpy as np
import h5py
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
"""
Base classes for DataJoint tables.
"""
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
"""
Externals for DataJoint tables.
"""

from pathlib import Path
from microns_utils import config_utils

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,4 @@
)
)

def check_latest_version_from_github(owner='cajal', repo='microns-materialization', source='tag', branch=None, path_to_version_file=None, warn=True):
"""
Wrapper for :func:`~microns_utils.version_utils.check_latest_version_from_github`
"""
return version_utils.check_latest_version_from_github(owner=owner, repo=repo, source=source, branch=branch, path_to_version_file=path_to_version_file, warn=warn)
check_latest_version_from_github = version_utils.latest_github_version_checker(owner='cajal', repo='microns-materialization')
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
from microns_materialization_api import config
from . import h01_materialization

config.register_bases(config.SCHEMAS.H01_MATERIALIZATION, h01_materialization)
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
from microns_materialization_api import config
from . import minnie65_materialization

config.register_bases(config.SCHEMAS.MINNIE65_MATERIALIZATION, minnie65_materialization)
2 changes: 1 addition & 1 deletion python/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.0.3"
__version__ = "0.0.4"

0 comments on commit 88b4a9d

Please sign in to comment.