-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: implement logging and some standards for ruff config (#134)
* feat(logging): add structlog integration with custom processors and example logger * chore: remove star imports * feat(lint): update ruff configuration to include new linting rules and extend exclusions * refactor: update pixi.lock and pixi.toml for ruff command structure and remove unused betapipeline entry * refactor(logging): standardize string quotes and improve logger configuration handling * feat(logging): integrate structured logging and enhance debug information in AutoPipeline and StructureSet * fix: #134 (comment) * fix: #134 (comment) * fix: #134 (comment) * refactor(logging): streamline logging configuration and ensure log directory creation * chore: add log files to .gitignore to prevent tracking of generated logs * fix: Update src/imgtools/logging/__init__.py Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * fix: #134 (comment) Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * chore: update .gitignore to include log files in imgtools directory * feat(datagraph): integrate logging for edge table processing and visualization * feat(ops): add timing for graph formation and update DataGraph initialization * chore: rename workflow from Test to CI-CD and restrict push triggers to main branch * feat(crawl): integrate logging for folder crawling and data saving processes * fix(structureset): enhance logging for ROI point retrieval errors * fix(autopipeline): update logger level to use environment variable for flexibility * fix(logging): streamline error handling for log directory creation * fix: #134 (comment) Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * refactor(logging): enhance logging configuration and streamline JSON setup * chore(pixi.lock): add license_family field for clarity * refactor(logging): enhance LoggingManager with valid log levels and improve JSON logging setup * refactor(logging): enhance documentation and improve LoggingManager configuration options * refactor(logging): validate log level assignment before setting self.level * feat(logging): add mypy and type-checking support; refactor logging manager and improve error handling * refactor(logging): remove unused Optional import from typing --------- Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
- Loading branch information
1 parent
1549be9
commit 7c31019
Showing
17 changed files
with
1,212 additions
and
278 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -219,3 +219,5 @@ data/ | |
|
||
# pixi environments | ||
.pixi | ||
|
||
.imgtools/**/*.log |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
[mypy] | ||
files = src/imgtools/logging/**/*.py |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,109 @@ | ||
[ lint ] | ||
# select = ["E4", "E7", "E9", "F", "B"] | ||
# NOTE: | ||
# The idea is that all future files should be included in the linting process. | ||
# To save the headache, we are excluding everything before, and hopefully we can | ||
# slowly fix everything | ||
|
||
ignore = [ "E722", "F405", "F403" ] | ||
include = [ | ||
"src/imgtools/logging/**/*.py", | ||
] | ||
|
||
extend-exclude = [ | ||
".pixi/**/*", | ||
"tests/**/*.py", | ||
"src/imgtools/ops/**/*.py", | ||
"src/imgtools/io/**/*.py", | ||
"src/imgtools/utils/**/*.py", | ||
"src/imgtools/modules/**/*.py", | ||
"src/imgtools/transforms/**/*.py", | ||
"src/imgtools/autopipeline.py", | ||
"src/imgtools/pipeline.py", | ||
"src/imgtools/image.py", | ||
] | ||
|
||
|
||
line-length = 100 | ||
|
||
[lint] | ||
|
||
select = [ | ||
########################################################################### | ||
# TYPE ANNOTATIONS | ||
# Ensure all functions have type annotations | ||
# https://docs.astral.sh/ruff/rules/#flake8-annotations-ann | ||
"ANN", | ||
# Use type hinting consistently | ||
# https://docs.astral.sh/ruff/rules/#flake8-type-checking-tch | ||
"TCH", | ||
|
||
########################################################################### | ||
# IMPORTS | ||
# Sort imports naturally | ||
# https://docs.astral.sh/ruff/rules/#isort-i | ||
"I", | ||
# Follow import conventions | ||
# https://docs.astral.sh/ruff/rules/#flake8-import-conventions-icn | ||
"ICN", | ||
# Clean up and organize imports | ||
# https://docs.astral.sh/ruff/rules/#flake8-tidy-imports-tid | ||
"TID", | ||
|
||
########################################################################### | ||
# CODE QUALITY | ||
# Detect possible bugs, like unused variables or exception handling issues | ||
# https://docs.astral.sh/ruff/rules/#flake8-bugbear-b | ||
"B", | ||
# Avoid using Python builtins incorrectly | ||
# https://docs.astral.sh/ruff/rules/#flake8-builtins-a | ||
"A", | ||
# Enforce correct usage of commas in lists, tuples, etc. | ||
# https://docs.astral.sh/ruff/rules/#flake8-commas-com | ||
"COM", | ||
# Prevent use of debugging code, like breakpoints | ||
# https://docs.astral.sh/ruff/rules/#flake8-debugger-t10 | ||
"T10", | ||
# Disallow print statements | ||
# https://docs.astral.sh/ruff/rules/#flake8-print-t20 | ||
"T20", | ||
# Provide clear and explanatory error messages | ||
# https://docs.astral.sh/ruff/rules/#flake8-errmsg-em | ||
"EM", | ||
|
||
########################################################################### | ||
# STANDARDS & STYLE | ||
# Prefer pathlib for path manipulation | ||
# https://docs.astral.sh/ruff/rules/#flake8-use-pathlib-pth | ||
"PTH", | ||
# Adhere to Pylint conventions | ||
# https://docs.astral.sh/ruff/rules/#pylint-pl | ||
"PL", | ||
# Simplify code to reduce complexity | ||
# https://docs.astral.sh/ruff/rules/#flake8-simplify-sim | ||
"SIM", | ||
# errors like undefined names and unused imports without enforcing style rules. | ||
# https://docs.astral.sh/ruff/rules/#pyflakes-f | ||
"F", | ||
# | ||
# https://docs.astral.sh/ruff/rules/#pep8-naming-n | ||
"N", | ||
# Pydocstyle | ||
# https://docs.astral.sh/ruff/rules/#pydocstyle-d | ||
# "D", | ||
] | ||
|
||
ignore = [ | ||
# allow self to not need type annotations | ||
"ANN101", | ||
# Allow too many arguments for functions | ||
"PLR0913", | ||
# Public Module Docstrings | ||
"D100", | ||
# Ignored because https://docs.astral.sh/ruff/formatter/#conflicting-lint-rules | ||
"COM812", # https://docs.astral.sh/ruff/rules/missing-trailing-comma/#missing-trailing-comma-com812 | ||
|
||
] | ||
|
||
[format] | ||
|
||
quote-style = "single" | ||
indent-style = "tab" | ||
docstring-code-format = true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1 @@ | ||
from . import io, ops, utils, pipeline | ||
|
||
__all__ = ["io", "ops", "utils", "pipeline"] | ||
|
||
__version__ = "1.6.0" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.