-
Notifications
You must be signed in to change notification settings - Fork 0
Modernize to allow for Webmon Implementation #12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
…thub.com/neutrons/plot_publisher into feature/dynamic-plotly-version-injection
Co-authored-by: Copilot <[email protected]>
…ns/plot_publisher into modernize-codebase-v0.2.0
@coderabbitai full review |
@@ -66,7 +67,43 @@ def add_version_attribute(match): | |||
return modified_html | |||
|
|||
|
|||
def publish_plot(instrument, run_number, files, config=None): | |||
def inject_plotlyjs_version(html_content: str, version: str) -> str: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we need this new version inject_plotlyjs_version
, where the version is passed in as a string? I would think that detecting the version from the environment would be the preferred way?
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #12 +/- ##
==========================================
+ Coverage 53.33% 62.18% +8.85%
==========================================
Files 3 3
Lines 165 201 +36
==========================================
+ Hits 88 125 +37
+ Misses 77 76 -1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Short description of the changes:
Modernize plot_publisher codebase: Add type hints, improve security, enhance testing, and fix critical bugs
Long description of the changes:
This PR represents a comprehensive modernization of the plot_publisher package, bringing it up to current Python best practices and significantly improving its reliability, security, and maintainability.
Core Improvements
Type Safety & Code Quality:
Union
,Optional
, and proper type annotationsConfiguration System Modernization:
Configuration.from_file()
class method for easier configuration loadingSecurity Enhancements:
verify_ssl=True
)Error Handling & Validation
None
returns that could mask errorsLogging & Debugging
logger = logging.getLogger(__name__)
)Testing Improvements
Critical Bug Fixes
_is_plotly_html_content
function that was breakingpublish_plot
executionpublish_plot
function structure to ensure HTTP requests are actually made_is_plotly_html_content
logic for more robust plotly HTML detectionDocumentation Updates
Check list for the pull request
Check list for the reviewer
Manual test for the reviewer
Prerequisites:
Ensure you have a Python environment with the required dependencies (requests, plotly, numpy).
Testing Steps:
1. Run the Complete Test Suite:
2. Test New Configuration System:
3. Test Version Injection Functionality:
4. Test Public API: