Skip to content

Commit dcec460

Browse files
Update logging configuration and exclude folder from Ruff analysis (#23)
* chores: exclude the folder from being analyzed by Ruff * chores: add script to verify the pkg_infra session, logger with ontograph. Different downloaders can be used here * chores: modify loggeing levels in the work directory config file.
1 parent 8cbff1e commit dcec460

3 files changed

Lines changed: 80 additions & 19 deletions

File tree

04_workdir.yaml

Lines changed: 38 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2,30 +2,49 @@
22
# ---- Logging -----
33
# -------------------------------------
44
logging:
5-
handlers:
6-
file:
7-
filename: "logs/my_saezapp_logger.log"
5+
handlers:
6+
file:
7+
filename: logs/my_saezapp_logger.log
8+
9+
loggers:
10+
default:
11+
level: DEBUG
12+
pkg_infra:
13+
level: INFO
14+
handlers: [file, console]
15+
propagate: false
16+
download_manager:
17+
level: INFO
18+
handlers: [file, console]
19+
propagate: false
20+
ontograph:
21+
level: INFO
22+
handlers: [file, console]
23+
propagate: false
24+
25+
root:
26+
level: WARNING
27+
handlers: [file, console]
828

929
# -------------------------------------
1030
# ---- Integrations -----
1131
# -------------------------------------
1232
integrations: # New question: store the big yaml?
1333
# OntoGraph
14-
ontograph:
15-
settings:
16-
- enabled: true # This will be switch <--- what should be the default value?
17-
- cache_path: "ontograph_config.yaml"
18-
- source_ontology: "chebi"
19-
- backend: "graphblas"
34+
ontograph:
35+
settings:
36+
- enabled: true # This will be switch <--- what should be the default value?
37+
- cache_path: ontograph_config.yaml
38+
- source_ontology: chebi
39+
- backend: graphblas
2040

2141
# Download manager
22-
download_manager:
23-
settings:
24-
enabled: true # This will be switch <--- what should be the default value?
25-
path: "/tmp"
26-
backend: "requests"
27-
28-
url: "https://getsamplefiles.com/download/txt/sample-1.txt"
29-
dest: false
30-
newer_than: null
31-
older_than: null
42+
download_manager:
43+
settings:
44+
enabled: true # This will be switch <--- what should be the default value?
45+
path: /tmp
46+
backend: requests
47+
url: https://getsamplefiles.com/download/txt/sample-1.txt
48+
dest: false
49+
newer_than:
50+
older_than:

pyproject.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,9 @@ report_level = "INFO"
152152

153153
# ---- Ruff: a fast Python linter and formatter.
154154
[tool.ruff]
155+
exclude = [
156+
"sandbox/"
157+
]
155158
extend-include = ["*.ipynb"]
156159
line-length = 80
157160
target-version = "py312"

sandbox/use_case_downloaders.py

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
import pkg_infra
2+
3+
from ontograph.client import ClientCatalog, ClientOntology
4+
from ontograph.downloader import PoochDownloaderAdapter
5+
from ontograph.config.settings import DEFAULT_CACHE_DIR
6+
7+
def main():
8+
workspace = './'
9+
10+
# Create a session for the app
11+
session = pkg_infra.get_session(workspace=workspace, include_location=True)
12+
13+
# Get logger from the session
14+
logger = session.get_logger()
15+
16+
# Add simple messages to the current logger
17+
logger.info('This is an INFO message')
18+
logger.debug('This is a DEBUG message')
19+
logger.warning('This is a WARNING message')
20+
logger.error('This is an ERROR message')
21+
logger.critical('This is a CRITICAL message')
22+
23+
# Call a given downloader from OntoGraph
24+
downloader = PoochDownloaderAdapter(cache_dir=DEFAULT_CACHE_DIR)
25+
26+
# Download a catalog
27+
catalog = ClientCatalog(cache_dir='./data/out', downloader=downloader)
28+
catalog.load_catalog()
29+
30+
# print the schema tree
31+
#catalog.print_catalog_schema_tree()
32+
33+
# Download a given ontology
34+
client = ClientOntology(cache_dir='./data/out', downloader=downloader)
35+
client.load(source='go') # catalog download
36+
37+
if __name__ == '__main__':
38+
39+
main()

0 commit comments

Comments
 (0)