# profile URL: /api/utils/profile/ Section: utils -------------------------------------------------------------------------------- profile - Bengal window.BENGAL_THEME_DEFAULTS = { appearance: 'dark', palette: 'snow-lynx' }; // Progressive Enhancement System Configuration window.Bengal = window.Bengal || {}; window.Bengal.enhanceBaseUrl = '/bengal/assets/js/enhancements'; window.Bengal.watchDom = true; window.Bengal.debug = false; (function () { try { var defaults = window.BENGAL_THEME_DEFAULTS || { appearance: 'system', palette: '' }; var defaultAppearance = defaults.appearance; if (defaultAppearance === 'system') { defaultAppearance = (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) ? 'dark' : 'light'; } var storedTheme = localStorage.getItem('bengal-theme'); var storedPalette = localStorage.getItem('bengal-palette'); var theme = storedTheme ? (storedTheme === 'system' ? defaultAppearance : storedTheme) : defaultAppearance; var palette = storedPalette ?? defaults.palette; document.documentElement.setAttribute('data-theme', theme); if (palette) { document.documentElement.setAttribute('data-palette', palette); } } catch (e) { document.documentElement.setAttribute('data-theme', 'light'); } })(); Skip to main content Magnifying Glass ESC Recent Clear Magnifying Glass No results for "" Try different keywords or check your spelling Start typing to search... ↑↓ Navigate ↵ Open ESC Close Powered by Lunr ᓚᘏᗢ Documentation Info About Arrow Clockwise Get Started Note Tutorials File Text Content Palette Theming Settings Building Starburst Extending Bookmark Reference Learning Tracks Releases Dev GitHub API Reference bengal CLI Magnifying Glass Search ⌘K Palette Appearance Chevron Down Mode Monitor System Sun Light Moon Dark Palette Snow Lynx Brown Bengal Silver Bengal Charcoal Bengal Blue Bengal List ᓚᘏᗢ Magnifying Glass Search X Close Documentation Info About Arrow Clockwise Get Started Note Tutorials File Text Content Palette Theming Settings Building Starburst Extending Bookmark Reference Learning Tracks Releases Dev GitHub API Reference bengal CLI Palette Appearance Chevron Down Mode Monitor System Sun Light Moon Dark Palette Snow Lynx Brown Bengal Silver Bengal Charcoal Bengal Blue Bengal API Reference __main__ bengal Caret Right Folder Analysis community_detection graph_analysis graph_reporting graph_visualizer knowledge_graph link_suggestions link_types page_rank path_analysis performance_advisor results Caret Right Folder Assets manifest pipeline Caret Right Folder Autodoc base config docstring_parser utils virtual_orchestrator Caret Right Folder Extractors cli openapi python Caret Right Folder Models cli common openapi python Caret Right Folder Cache asset_dependency_map cache_store cacheable compression dependency_tracker page_discovery_cache query_index query_index_registry taxonomy_index utils Caret Right Folder Build Cache autodoc_tracking core file_tracking fingerprint parsed_content_cache rendered_output_cache taxonomy_index_mixin validation_cache Caret Right Folder Indexes author_index category_index date_range_index section_index Caret Right Folder Cli __main__ base site_templates utils Caret Right Folder Commands assets build clean collections config debug explain fix health init perf project serve site skeleton sources theme utils validate Caret Right Folder Graph __main__ bridges communities orphans pagerank report suggest Caret Right Folder New config presets scaffolds site wizard Caret Right Folder Helpers cli_app_loader cli_output config_validation error_handling menu_config metadata progress site_loader traceback validation Caret Right Folder Skeleton hydrator schema Caret Right Folder Templates base registry Caret Right Folder Blog template Caret Right Folder Changelog template Caret Right Folder Default template Caret Right Folder Docs template Caret Right Folder Landing template Caret Right Folder Portfolio template Caret Right Folder Resume template Caret Right Folder Collections errors loader schemas validator Caret Right Folder Config defaults deprecation directory_loader env_overrides environment feature_mappings hash loader merge origin_tracker validators Caret Right Folder Content Layer entry loaders manager source Caret Right Folder Sources github local notion rest Caret Right Folder Content Types base registry strategies Caret Right Folder Core build_context cascade_engine menu section theme Caret Right Folder Asset asset_core css_transforms Caret Right Folder Page computed content metadata navigation operations page_core proxy relationships utils Caret Right Folder Site core data discovery factories page_caches properties section_registry theme Caret Right Folder Debug base config_inspector content_migrator delta_analyzer dependency_visualizer explainer incremental_debugger models reporter shortcode_sandbox Caret Right Folder Discovery asset_discovery content_discovery Caret Right Folder Fonts downloader generator Caret Right Folder Health autofix base health_check report Caret Right Folder Linkcheck async_checker ignore_policy internal_checker models orchestrator Caret Right Folder Validators anchors assets cache config connectivity cross_ref fonts links menu navigation output performance rendering rss sitemap taxonomy tracks Caret Right Folder Directives analysis checkers constants Caret Right Folder Orchestration asset content full_to_incremental incremental menu postprocess related_posts render section static streaming taxonomy Caret Right Folder Postprocess html_output redirects rss sitemap special_pages Caret Right Folder Output Formats index_generator json_generator llm_generator lunr_index_generator txt_generator utils Caret Right Folder Rendering api_doc_enhancer asset_extractor errors jinja_utils link_transformer link_validator pygments_cache renderer template_context template_profiler validator Caret Right Folder Parsers base factory mistune native_html pygments_patch python_markdown Caret Right Folder Pipeline core output thread_local toc transforms Caret Right Folder Plugins badges cross_references inline_icon term variable_substitution Caret Right Folder Directives _icons admonitions badge base button cache cards checklist code_tabs container contracts data_table dropdown embed errors example_label fenced figure glossary icon include list_table literalinclude marimo navigation options rubric steps tabs target term terminal tokens utils validator video Caret Right Folder Template Engine asset_url core environment manifest menu url_helpers Caret Right Folder Template Functions advanced_collections advanced_strings autodoc collections content crossref data dates debug files get_page i18n icons images math_functions navigation pagination_helpers seo strings tables taxonomies theme urls Caret Right Folder Server build_handler component_preview constants dev_server live_reload pid_manager reload_controller request_handler request_logger resource_manager utils Caret Right Folder Services validation Caret Right Folder Themes config Caret Right Folder Utils atomic_write autodoc build_context build_stats build_summary cli_output css_minifier dates dotdict error_handlers file_io file_lock hashing incremental_constants js_bundler live_progress logger metadata observability page_initializer pagination path_resolver paths performance_collector performance_report profile progress retry rich_console sections swizzle text theme_registry theme_resolution thread_local traceback_config traceback_renderer url_normalization url_strategy API Reference Utils ᗢ Caret Down Link Copy URL External Open LLM text Copy Copy LLM text Share with AI Ask Claude Ask ChatGPT Ask Gemini Ask Copilot Module utils.profile Build profile system for persona-based observability. Provides three profiles optimized for different user workflows: Writer: Fast, clean builds for content authors Theme Developer: Template-focused debugging for theme builders Developer: Full observability for framework contributors Example: from bengal.utils.profile import BuildProfile profile = BuildProfile.from_cli_args(dev=True) config = profile.get_config() if config['track_memory']: # Enable memory tracking pass View source 1 Class 7 Functions Classes BuildProfile Build profiles for different user personas. Each profile optimizes observability features for a sp… 4 Caret Right Build profiles for different user personas. Each profile optimizes observability features for a specific workflow: WRITER: Content authors who want fast, clean builds THEME_DEV: Theme developers who need template debugging DEVELOPER: Framework contributors who need full observability Inherits from Enum Methods 3 from_string classmethod Parse profile from string. 1 BuildProfile Caret Right def from_string(cls, value: str) -> BuildProfile Parse profile from string. Parameters 1 value str Profile name (case-insensitive) Returns BuildProfile — BuildProfile enum value from_cli_args classmethod Determine profile from CLI arguments with proper precedence. Precedence (highe… 4 BuildProfile Caret Right def from_cli_args(cls, profile: str | None = None, dev: bool = False, theme_dev: bool = False, debug: bool = False) -> BuildProfile Determine profile from CLI arguments with proper precedence. Precedence (highest to lowest): --dev flag (full developer mode) --theme-dev flag --profile option --debug flag (enables DEVELOPER profile) Default (WRITER) NOTE: --verbose is NOT a profile selector. It only controls output verbosity. Use --theme-dev or --dev for profile-based health checks and metrics. Parameters 4 profile str | None Explicit profile name from --profile dev bool --dev flag (full developer mode) theme_dev bool --theme-dev flag debug bool --debug flag (debug logging, maps to DEVELOPER profile) Returns BuildProfile — Determined BuildProfile get_config Get configuration dictionary for this profile. 0 dict[str, Any] Caret Right def get_config(self) -> dict[str, Any] Get configuration dictionary for this profile. Returns dict[str, Any] — Configuration with feature toggles for this profile Configuration keys: show_phase_timing: Show build phase timing track_memory: Enable memory profiling (tracemalloc + psutil) enable_debug_output: Print debug messages to stderr collect_metrics: Save metrics to .bengal/metrics/ health_checks: Dict with enabled/disabled validator lists verbose_build_stats: Show detailed build statistics Internal Methods 1 Caret Right __str__ String representation of profile. 0 str Caret Right def __str__(self) -> str String representation of profile. Returns str Functions set_current_profile Set the current build profile. This is used by helper functions to determine behavior without pass… 1 None Caret Right def set_current_profile(profile: BuildProfile) -> None Set the current build profile. This is used by helper functions to determine behavior without passing profile through every function call. Parameters 1 Name Type Default Description profile BuildProfile — BuildProfile to set as current get_current_profile Get the current build profile. 0 BuildProfile Caret Right def get_current_profile() -> BuildProfile Get the current build profile. Returns BuildProfile — Current profile, or WRITER if not set should_show_debug Check if debug output should be shown. This is a helper for conditional debug output without passi… 0 bool Caret Right def should_show_debug() -> bool Check if debug output should be shown. This is a helper for conditional debug output without passing profile through every function. Returns bool — True if debug output should be shown should_track_memory Check if memory tracking should be enabled. 0 bool Caret Right def should_track_memory() -> bool Check if memory tracking should be enabled. Returns bool — True if memory should be tracked should_collect_metrics Check if metrics collection should be enabled. 0 bool Caret Right def should_collect_metrics() -> bool Check if metrics collection should be enabled. Returns bool — True if metrics should be collected get_enabled_health_checks Get list of enabled health check validators for current profile. 0 list[str] Caret Right def get_enabled_health_checks() -> list[str] Get list of enabled health check validators for current profile. Returns list[str] — List of validator names that should run, or 'all' string is_validator_enabled Check if a specific validator should run. 1 bool Caret Right def is_validator_enabled(validator_name: str) -> bool Check if a specific validator should run. Parameters 1 Name Type Default Description validator_name str — Name of validator (e.g., 'config', 'links') Returns bool — True if validator should run ← Previous performance_report Next → progress List © 2025 Bengal ᓚᘏᗢ window.BENGAL_LAZY_ASSETS = { tabulator: '/bengal/assets/js/tabulator.min.js', dataTable: '/bengal/assets/js/data-table.js', mermaidToolbar: '/bengal/assets/js/mermaid-toolbar.9de5abba.js', mermaidTheme: '/bengal/assets/js/mermaid-theme.344822c5.js', graphMinimap: '/bengal/assets/js/graph-minimap.cc7e42e3.js', graphContextual: '/bengal/assets/js/graph-contextual.440e59c6.js' }; window.BENGAL_ICONS = { close: '/bengal/assets/icons/close.911d4fe1.svg', enlarge: '/bengal/assets/icons/enlarge.652035e5.svg', copy: '/bengal/assets/icons/copy.3d56e945.svg', 'download-svg': '/bengal/assets/icons/download.04f07e1b.svg', 'download-png': '/bengal/assets/icons/image.c34dfd40.svg', 'zoom-in': '/bengal/assets/icons/zoom-in.237b4a83.svg', 'zoom-out': '/bengal/assets/icons/zoom-out.38857c77.svg', reset: '/bengal/assets/icons/reset.d26dba29.svg' }; Arrow Up X -------------------------------------------------------------------------------- Metadata: - Author: lbliii - Word Count: 1592 - Reading Time: 8 minutes