diff --git a/04_workdir.yaml b/04_workdir.yaml index 6c9b443..a7a4012 100644 --- a/04_workdir.yaml +++ b/04_workdir.yaml @@ -2,30 +2,49 @@ # ---- Logging ----- # ------------------------------------- logging: - handlers: - file: - filename: "logs/my_saezapp_logger.log" + handlers: + file: + filename: logs/my_saezapp_logger.log + + loggers: + default: + level: DEBUG + pkg_infra: + level: INFO + handlers: [file, console] + propagate: false + download_manager: + level: INFO + handlers: [file, console] + propagate: false + ontograph: + level: INFO + handlers: [file, console] + propagate: false + + root: + level: WARNING + handlers: [file, console] # ------------------------------------- # ---- Integrations ----- # ------------------------------------- integrations: # New question: store the big yaml? # OntoGraph - ontograph: - settings: - - enabled: true # This will be switch <--- what should be the default value? - - cache_path: "ontograph_config.yaml" - - source_ontology: "chebi" - - backend: "graphblas" + ontograph: + settings: + - enabled: true # This will be switch <--- what should be the default value? + - cache_path: ontograph_config.yaml + - source_ontology: chebi + - backend: graphblas # Download manager - download_manager: - settings: - enabled: true # This will be switch <--- what should be the default value? - path: "/tmp" - backend: "requests" - - url: "https://getsamplefiles.com/download/txt/sample-1.txt" - dest: false - newer_than: null - older_than: null + download_manager: + settings: + enabled: true # This will be switch <--- what should be the default value? + path: /tmp + backend: requests + url: https://getsamplefiles.com/download/txt/sample-1.txt + dest: false + newer_than: + older_than: diff --git a/pyproject.toml b/pyproject.toml index 5131c52..afa73b0 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -152,6 +152,9 @@ report_level = "INFO" # ---- Ruff: a fast Python linter and formatter. [tool.ruff] +exclude = [ + "sandbox/" +] extend-include = ["*.ipynb"] line-length = 80 target-version = "py312" diff --git a/sandbox/use_case_downloaders.py b/sandbox/use_case_downloaders.py new file mode 100644 index 0000000..0b346c5 --- /dev/null +++ b/sandbox/use_case_downloaders.py @@ -0,0 +1,39 @@ +import pkg_infra + +from ontograph.client import ClientCatalog, ClientOntology +from ontograph.downloader import PoochDownloaderAdapter +from ontograph.config.settings import DEFAULT_CACHE_DIR + +def main(): + workspace = './' + + # Create a session for the app + session = pkg_infra.get_session(workspace=workspace, include_location=True) + + # Get logger from the session + logger = session.get_logger() + + # Add simple messages to the current logger + logger.info('This is an INFO message') + logger.debug('This is a DEBUG message') + logger.warning('This is a WARNING message') + logger.error('This is an ERROR message') + logger.critical('This is a CRITICAL message') + + # Call a given downloader from OntoGraph + downloader = PoochDownloaderAdapter(cache_dir=DEFAULT_CACHE_DIR) + + # Download a catalog + catalog = ClientCatalog(cache_dir='./data/out', downloader=downloader) + catalog.load_catalog() + + # print the schema tree + #catalog.print_catalog_schema_tree() + + # Download a given ontology + client = ClientOntology(cache_dir='./data/out', downloader=downloader) + client.load(source='go') # catalog download + +if __name__ == '__main__': + + main()