Skip to content

Commit 17ded39

Browse files
Refactors logging and display architecture (#107)
* Converts print statements to logging * Refactors plotting module to display module * Refines parameter handling and logging functionality * Refines CIF serialization and updates docs * Refines renderer architecture and error handling * Refines logging and utils import structure * Refines table rendering and error handling logic * Enhances logging with customizable rich formatting * Refactors plotting modules and updates test expectations * Refactors logger and environment detection functions * Switches logging from log to console * Improves axis scaling for asciichartpy * Refactors logging utility with enhanced features * Renames utils module for clarity * Enhances display and tracking in analysis module * Disable Jupyter notebook output scrolling * Rename environment checks for clarity * Remove redundant type ignores and streamline exception handling * Improves console width detection for flexible environments * Refactors logging modes and console output methods * Enhances logging utilities with improved docs * Removes unused imports and obsolete functions * Refactors logging architecture for clarity * Removes unused show_index parameter * Refactors logger configuration setup * Reorders render_table arguments for clarity * Refactors parameter table rendering and identity handling * Removes redundant header handling in render_table * Adds structure refinement example scripts * Refactors test environment detection logic * Enhances table styling with padding and font size * Refactors logger imports and removes lazy loading * Suppresses user warnings in pytest configuration * Adds SPDX license headers to utils.py * Reorganizes display and logging structure * Refines logging initialization and aliases * Activates commented pre-commit hooks * Adds SPDX license identifiers to init files * Enhances Pandas table styling * Removes Jupyter-specific logic from CIF renderer * Updates deps * Temporarily disable Jupyter scroll in MkDocs * Improves table styling for enhanced readability * Add conditional doc build for branch environments
1 parent 0b21681 commit 17ded39

File tree

86 files changed

+5303
-2117
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

86 files changed

+5303
-2117
lines changed

.github/workflows/docs.yaml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,14 @@ jobs:
137137
# Input: docs/ directory containing the Markdown files
138138
# Output: site/ directory containing the generated HTML files
139139
- name: Build site with MkDocs
140-
run: pixi run docs-build
140+
run: |
141+
if [[ "${CI_BRANCH}" == "develop" || "${CI_BRANCH}" == "master" || "${CI_BRANCH}" == "main" ]]; then
142+
echo "📘 Building production docs for ${CI_BRANCH}"
143+
pixi run docs-build
144+
else
145+
echo "📗 Building local docs for ${CI_BRANCH}"
146+
pixi run docs-local
147+
fi
141148
142149
# Set up the Pages action to configure the static files to be deployed
143150
# NOTE: The repository must have GitHub Pages enabled and configured to build using GitHub Actions

.pre-commit-config.yaml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,9 @@ repos:
4949
pass_filenames: false
5050
stages: [pre-push]
5151

52-
#- id: pixi-unit-tests
53-
# name: pixi run unit-tests
54-
# entry: pixi run unit-tests
55-
# language: system
56-
# pass_filenames: false
57-
# stages: [pre-push]
52+
- id: pixi-unit-tests
53+
name: pixi run unit-tests
54+
entry: pixi run unit-tests
55+
language: system
56+
pass_filenames: false
57+
stages: [pre-push]

docs/api-reference/display.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
::: easydiffraction.display

docs/api-reference/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ available in EasyDiffraction:
1313
space groups, and symmetry operations.
1414
- [utils](utils.md) – Miscellaneous utility functions for formatting,
1515
decorators, and general helpers.
16-
- [plotting](plotting.md) – Tools for visualizing data and fitting results.
16+
- [display](display.md) – Tools for plotting data and rendering tables.
1717
- [project](project.md) – Defines the project and manages its state.
1818
- [sample_models](sample_models.md) – Defines sample models, such as
1919
crystallographic structures, and manages their properties.

docs/api-reference/io.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
::: easydiffraction.io

docs/api-reference/plotting.md

Lines changed: 0 additions & 1 deletion
This file was deleted.

docs/architecture/package-structure-full.md

Lines changed: 39 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
│ │ ├── 📄 reporting.py
3333
│ │ │ └── 🏷️ class FitResults
3434
│ │ └── 📄 tracking.py
35+
│ │ ├── 🏷️ class _TerminalLiveHandle
3536
│ │ └── 🏷️ class FitProgressTracker
3637
│ ├── 📁 minimizers
3738
│ │ ├── 📄 __init__.py
@@ -93,6 +94,37 @@
9394
│ ├── 📄 __init__.py
9495
│ ├── 📄 crystallography.py
9596
│ └── 📄 space_groups.py
97+
├── 📁 display
98+
│ ├── 📁 plotters
99+
│ │ ├── 📄 __init__.py
100+
│ │ ├── 📄 ascii.py
101+
│ │ │ └── 🏷️ class AsciiPlotter
102+
│ │ ├── 📄 base.py
103+
│ │ │ └── 🏷️ class PlotterBase
104+
│ │ └── 📄 plotly.py
105+
│ │ └── 🏷️ class PlotlyPlotter
106+
│ ├── 📁 tablers
107+
│ │ ├── 📄 __init__.py
108+
│ │ ├── 📄 base.py
109+
│ │ │ └── 🏷️ class TableBackendBase
110+
│ │ ├── 📄 pandas.py
111+
│ │ │ └── 🏷️ class PandasTableBackend
112+
│ │ └── 📄 rich.py
113+
│ │ └── 🏷️ class RichTableBackend
114+
│ ├── 📄 __init__.py
115+
│ ├── 📄 base.py
116+
│ │ ├── 🏷️ class RendererBase
117+
│ │ └── 🏷️ class RendererFactoryBase
118+
│ ├── 📄 plotting.py
119+
│ │ ├── 🏷️ class PlotterEngineEnum
120+
│ │ ├── 🏷️ class Plotter
121+
│ │ └── 🏷️ class PlotterFactory
122+
│ ├── 📄 tables.py
123+
│ │ ├── 🏷️ class TableEngineEnum
124+
│ │ ├── 🏷️ class TableRenderer
125+
│ │ └── 🏷️ class TableRendererFactory
126+
│ └── 📄 utils.py
127+
│ └── 🏷️ class JupyterScrollManager
96128
├── 📁 experiments
97129
│ ├── 📁 categories
98130
│ │ ├── 📁 background
@@ -192,19 +224,6 @@
192224
│ ├── 📄 handler.py
193225
│ │ └── 🏷️ class CifHandler
194226
│ └── 📄 serialize.py
195-
├── 📁 plotting
196-
│ ├── 📁 plotters
197-
│ │ ├── 📄 __init__.py
198-
│ │ ├── 📄 plotter_ascii.py
199-
│ │ │ └── 🏷️ class AsciiPlotter
200-
│ │ ├── 📄 plotter_base.py
201-
│ │ │ └── 🏷️ class PlotterBase
202-
│ │ └── 📄 plotter_plotly.py
203-
│ │ └── 🏷️ class PlotlyPlotter
204-
│ ├── 📄 __init__.py
205-
│ └── 📄 plotting.py
206-
│ ├── 🏷️ class Plotter
207-
│ └── 🏷️ class PlotterFactory
208227
├── 📁 project
209228
│ ├── 📄 __init__.py
210229
│ ├── 📄 project.py
@@ -236,9 +255,14 @@
236255
│ └── 🏷️ class Summary
237256
├── 📁 utils
238257
│ ├── 📄 __init__.py
239-
│ ├── 📄 formatting.py
258+
│ ├── 📄 environment.py
240259
│ ├── 📄 logging.py
241-
│ │ └── 🏷️ class Logger
260+
│ │ ├── 🏷️ class IconifiedRichHandler
261+
│ │ ├── 🏷️ class ConsoleManager
262+
│ │ ├── 🏷️ class LoggerConfig
263+
│ │ ├── 🏷️ class ExceptionHookManager
264+
│ │ ├── 🏷️ class Logger
265+
│ │ └── 🏷️ class ConsolePrinter
242266
│ └── 📄 utils.py
243267
├── 📄 __init__.py
244268
└── 📄 __main__.py

docs/architecture/package-structure-short.md

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,22 @@
4646
│ ├── 📄 __init__.py
4747
│ ├── 📄 crystallography.py
4848
│ └── 📄 space_groups.py
49+
├── 📁 display
50+
│ ├── 📁 plotters
51+
│ │ ├── 📄 __init__.py
52+
│ │ ├── 📄 ascii.py
53+
│ │ ├── 📄 base.py
54+
│ │ └── 📄 plotly.py
55+
│ ├── 📁 tablers
56+
│ │ ├── 📄 __init__.py
57+
│ │ ├── 📄 base.py
58+
│ │ ├── 📄 pandas.py
59+
│ │ └── 📄 rich.py
60+
│ ├── 📄 __init__.py
61+
│ ├── 📄 base.py
62+
│ ├── 📄 plotting.py
63+
│ ├── 📄 tables.py
64+
│ └── 📄 utils.py
4965
├── 📁 experiments
5066
│ ├── 📁 categories
5167
│ │ ├── 📁 background
@@ -96,14 +112,6 @@
96112
│ └── 📁 cif
97113
│ ├── 📄 handler.py
98114
│ └── 📄 serialize.py
99-
├── 📁 plotting
100-
│ ├── 📁 plotters
101-
│ │ ├── 📄 __init__.py
102-
│ │ ├── 📄 plotter_ascii.py
103-
│ │ ├── 📄 plotter_base.py
104-
│ │ └── 📄 plotter_plotly.py
105-
│ ├── 📄 __init__.py
106-
│ └── 📄 plotting.py
107115
├── 📁 project
108116
│ ├── 📄 __init__.py
109117
│ ├── 📄 project.py
@@ -125,7 +133,7 @@
125133
│ └── 📄 summary.py
126134
├── 📁 utils
127135
│ ├── 📄 __init__.py
128-
│ ├── 📄 formatting.py
136+
│ ├── 📄 environment.py
129137
│ ├── 📄 logging.py
130138
│ └── 📄 utils.py
131139
├── 📄 __init__.py

docs/mkdocs.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -86,12 +86,13 @@ nav:
8686
- 2025 DMSC: tutorials/dmsc-summer-school-2025_analysis-powder-diffraction.ipynb
8787
- API Reference:
8888
- API Reference: api-reference/index.md
89+
- analysis: api-reference/analysis.md
8990
- core: api-reference/core.md
9091
- crystallography: api-reference/crystallography.md
91-
- utils: api-reference/utils.md
92-
- plotting: api-reference/plotting.md
92+
- display: api-reference/display.md
93+
- experiments: api-reference/experiments.md
94+
- io: api-reference/io.md
9395
- project: api-reference/project.md
9496
- sample_models: api-reference/sample_models.md
95-
- experiments: api-reference/experiments.md
96-
- analysis: api-reference/analysis.md
9797
- summary: api-reference/summary.md
98+
- utils: api-reference/utils.md

0 commit comments

Comments
 (0)