API Reference¶
Auto-generated code documentation.
analytics_project ¶
demo_module_basics ¶
Demonstrate Python basics for professional analytics.
This module demonstrates fundamental Python concepts essential for data analysts, including imports, variables, functions, and function calls.
Module Information
- Filename: demo_module_basics.py
- Module: demo_module_basics
- Location: src/analytics_project/
Key Concepts
- Module imports and code organization
- Variable declaration and scope
- Function definition (reusable logic)
- Function invocation and returns
Professional Applications
- Building maintainable analytics pipelines
- Creating reusable analysis functions
- Organizing code for team collaboration
- Setting up logging for production debugging
demo_basics ¶
demo_basics() -> None
Demonstrate Python basics.
Source code in src/analytics_project/demo_module_basics.py
88 89 90 91 92 93 94 95 96 97 |
|
main ¶
main() -> None
Test demo locally.
Source code in src/analytics_project/demo_module_basics.py
105 106 107 108 109 110 111 |
|
main ¶
Entry point for professional analytics project execution.
This module serves as the orchestrator, demonstrating how professional Python projects integrate multiple modules into a cohesive application.
Module Information
- Filename: main.py
- Module: main
- Location: src/analytics_project/
main ¶
main() -> int
Demonstrate a complete Python project structure.
This function coordinates multiple demo modules to illustrate how professional Python projects integrate and run as a pipeline.
Returns:
Name | Type | Description |
---|---|---|
int |
int
|
Exit status code (0 for success, 1 for failure) — standard practice in professional Python projects. |
Source code in src/analytics_project/main.py
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
|
utils_logger ¶
Provide centralized logging for professional analytics projects.
This module configures project-wide logging to track events, debug issues, and maintain audit trails during data analysis workflows.
Module Information
- Filename: utils_logger.py
- Module: utils_logger
- Location: src/analytics_project/
Key Concepts
- Centralized logging configuration
- Log levels (DEBUG, INFO, WARNING, ERROR)
- File-based log persistence
- Colorized console output with Loguru
Professional Applications
- Production debugging and troubleshooting
- Audit trails for regulatory compliance
- Performance monitoring and optimization
- Error tracking in data pipelines
get_log_file_path ¶
get_log_file_path() -> pathlib.Path
Return the path to the active log file, or default path if not initialized.
Source code in src/analytics_project/utils_logger.py
48 49 50 51 52 53 |
|
init_logger ¶
init_logger(
level: str = 'INFO',
*,
log_dir: str | Path = project_root,
log_file_name: str = 'project.log',
) -> pathlib.Path
Initialize the logger and return the log file path.
Ensures the log folder exists and configures logging to write to a file.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
level
|
str
|
Logging level (e.g., "INFO", "DEBUG"). |
'INFO'
|
log_dir
|
str | Path
|
Directory where the log file will be written. |
project_root
|
log_file_name
|
str
|
File name for the log file. |
'project.log'
|
Returns:
Type | Description |
---|---|
Path
|
pathlib.Path: The resolved path to the log file. |
Source code in src/analytics_project/utils_logger.py
56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 |
|
log_example ¶
log_example() -> None
Demonstrate logging behavior with example messages.
Source code in src/analytics_project/utils_logger.py
114 115 116 117 118 |
|
main ¶
main() -> None
Execute logger setup and demonstrate its usage.
Source code in src/analytics_project/utils_logger.py
121 122 123 124 125 |
|