Merge pull request 'bug fix: refactored info folder' (#3) from v2.4 into main

Reviewed-on: #3
main
Steve L. Nyemba 3 weeks ago
commit 2054a8b095

@ -155,6 +155,10 @@ def initregistry (email:Annotated[str,typer.Argument(help="email")],
_msg = f"{TIMES_MARK} {e}" _msg = f"{TIMES_MARK} {e}"
print (_msg) print (_msg)
print () print ()
@app_r.command(name="add") @app_r.command(name="add")
def register (label:Annotated[str,typer.Argument(help="unique label that will be used to load the parameters of the database")], def register (label:Annotated[str,typer.Argument(help="unique label that will be used to load the parameters of the database")],
auth_file:Annotated[str,typer.Argument(help="path of the auth_file")], auth_file:Annotated[str,typer.Argument(help="path of the auth_file")],
@ -174,7 +178,17 @@ def register (label:Annotated[str,typer.Argument(help="unique label that will be
_msg = f"""{TIMES_MARK} {e}""" _msg = f"""{TIMES_MARK} {e}"""
print (_msg) print (_msg)
pass @app_r.command(name="list")
def register_list ():
"""
This function will list existing registry entries and basic information {label,vendor}
"""
# print (transport.registry.DATA)
_reg = transport.registry.DATA
_data = [{'label':key,'provider':_reg[key]['provider']} for key in _reg if 'provider' in _reg[key]]
_data = pd.DataFrame(_data)
print (_data)
@app_x.command(name='add') @app_x.command(name='add')
def register_plugs ( def register_plugs (
alias:Annotated[str,typer.Argument(help="unique function name within a file")], alias:Annotated[str,typer.Argument(help="unique function name within a file")],

@ -42,11 +42,11 @@ zip-safe = false
script-files = ["bin/transport","bin/transport.cmd"] script-files = ["bin/transport","bin/transport.cmd"]
[tool.setuptools.packages.find] [tool.setuptools.packages.find]
include = ["info","info.*", "transport", "transport.*"] include = [ "transport", "transport.*"]
[tool.setuptools.dynamic] [tool.setuptools.dynamic]
version = {attr = "info.__version__"} version = {attr = "transport.info.__version__"}
#authors = {attr = "meta.__author__"} #authors = {attr = "transport.__author__"}
# If you have a info.py file, you might also want to include the author dynamically: # If you have a info.py file, you might also want to include the author dynamically:
# [tool.setuptools.dynamic] # [tool.setuptools.dynamic]

@ -41,7 +41,7 @@ except Exception as e:
import pandas as pd import pandas as pd
import json import json
import os import os
from info import __version__,__author__,__email__,__license__,__app_name__,__whatsnew__,__edition__ from transport.info import __version__,__author__,__email__,__license__,__app_name__,__whatsnew__,__edition__
from transport.iowrapper import IWriter, IReader, IETL from transport.iowrapper import IWriter, IReader, IETL
from transport.plugins import PluginLoader from transport.plugins import PluginLoader
from transport import providers from transport import providers

@ -212,27 +212,10 @@ class IETL(BaseIO) :
This class performs an ETL operation by ineriting a read and adding writes as pipeline functions This class performs an ETL operation by ineriting a read and adding writes as pipeline functions
""" """
def __init__(self,**_args): def __init__(self,**_args):
# _source = _args['source']
# _plugins = _source['plugins'] if 'plugins' in _source else None
# # super().__init__(transport.get.reader(**_args['source']))
# super().__init__(agent=transport.get.reader(**_source),plugins=_plugins)
# # _logger =
# if 'target' in _args:
# self._targets = _args['target'] if type(_args['target']) == list else [_args['target']]
# else:
# self._targets = []
# self.jobs = []
# #
# # If the parent is already multiprocessing
# if 'token' in _source :
# self._logToken = _source['token']
# self._sourceArgs = _source['args'] if 'args' in _source else None
# self._hasParentProcess = False if 'hasParentProcess' not in _args else _args['hasParentProcess']
super().__init__() super().__init__()
self._source = _args['source'] self._source = _args['source']
self._targets= _args['target'] if _args['target'] == list else [_args['target']] self._targets= _args['target'] if type(_args['target']) == list else [_args['target']]
# #
# ETL Initialization, we should provide some measure of context ... # ETL Initialization, we should provide some measure of context ...
# #
@ -254,7 +237,8 @@ class IETL(BaseIO) :
_data = _reader.read(**self._source['args'])if 'args' in self._source else _reader.read() _data = _reader.read(**self._source['args'])if 'args' in self._source else _reader.read()
_reader.close() _reader.close()
_writers = [transport.get.writer(**_kwargs) for _kwargs in self._targets] _writers = [transport.get.writer(**_kwargs) for _kwargs in self._targets]
_schema = [] if not getattr(_reader._agent,'_table') else _reader.meta() # _schema = [] if not getattr(_reader._agent,'_table') else _reader.meta()
_schema = [] if not hasattr(_reader._agent,'_table') else _reader.meta()
if types.GeneratorType == type(_data): if types.GeneratorType == type(_data):
_index = 0 _index = 0
for _segment in _data : for _segment in _data :

@ -1,6 +1,6 @@
import os import os
import json import json
from info import __version__ from transport.info import __version__
import copy import copy
import transport import transport
import importlib import importlib

Loading…
Cancel
Save