Skip to content

doc(tutorials): Add a tutorial on creating a DPF Python plugin for custom file formats#3065

Open
PProfizi wants to merge 15 commits intomainfrom
doc/tutorials/python_plugin_for_custom_file_format
Open

doc(tutorials): Add a tutorial on creating a DPF Python plugin for custom file formats#3065
PProfizi wants to merge 15 commits intomainfrom
doc/tutorials/python_plugin_for_custom_file_format

Conversation

@PProfizi
Copy link
Copy Markdown
Contributor

@PProfizi PProfizi commented Mar 23, 2026

This pull request introduces a comprehensive example DPF Python plugin for reading a custom file format ("MyFormat"). It includes all necessary components and sample data to demonstrate how to implement a fully functional DPF plugin, covering streams, mesh, results, and time-frequency support. Documentation is updated to reference this new tutorial.

MyFormat DPF Plugin Implementation:

  • Added the my_format_plugin example package, which includes:

    • The main plugin entry point (my_format_plugin.py) that registers all custom operators with DPF.
    • Operators for streams, mesh info, mesh, result info, time-frequency support, and result data (displacement, temperature). [1] [2] [3]
    • Helper modules and sample data file (cube_harmonic.myf) for demonstration and testing. [1] [2]
  • Each operator is implemented with clear specifications, input/output pin definitions, and uses a shared file reader to parse the custom format. [1] [2]

Documentation Updates:

  • The tutorials index now includes a new card linking to the "Write a DPF Python plugin for a custom file format" tutorial, highlighting the new example and its capabilities.

Sample Data:

  • Added a realistic .myf result file (cube_harmonic.myf) containing mesh, frequency, and result data, used by the plugin and referenced in the documentation.

These changes provide a complete, distributable reference for users to create their own DPF plugins for custom file formats.

@PProfizi PProfizi changed the base branch from main to feat/streams_container_creation March 23, 2026 14:31
@PProfizi PProfizi requested a review from oparreno March 23, 2026 14:32
@PProfizi PProfizi self-assigned this Mar 23, 2026
@PProfizi PProfizi added the tutorials Related to PyDPF-Core tutorials label Mar 23, 2026
@PProfizi
Copy link
Copy Markdown
Contributor Author

Hey @oparreno, here is a proposal of a new tutorial which showcases what we discussed.
The idea is to make this one public and a reference even if it is a dummy one.

@PProfizi PProfizi changed the title doc(tutorials): Add a tutorial on a creating a DPF Python plugin for custom file formats doc(tutorials): Add a tutorial on creating a DPF Python plugin for custom file formats Mar 23, 2026
@PProfizi PProfizi requested a review from rafacanton March 23, 2026 14:35
@codecov
Copy link
Copy Markdown

codecov bot commented Mar 23, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 82.94%. Comparing base (35aed89) to head (8caf2e0).
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3065      +/-   ##
==========================================
- Coverage   83.01%   82.94%   -0.07%     
==========================================
  Files          93       93              
  Lines       11528    11528              
==========================================
- Hits         9570     9562       -8     
- Misses       1958     1966       +8     

return "myformat::myformat::time_freq_support_provider"


def _build_time_freq_support(model: reader.MyFormatModel) -> dpf.TimeFreqSupport:
Copy link
Copy Markdown
Contributor

@oparreno oparreno Mar 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@PProfizi, typically we create a MyFormatStream where we would use the reader to read and populate our DPF Objects. This stream will cache the data so that we don't have to read it every time. We would create this function there.

Base automatically changed from feat/streams_container_creation to main March 24, 2026 09:50
@PProfizi PProfizi marked this pull request as ready for review March 24, 2026 17:50
@PProfizi PProfizi added the deploy-pr-doc For deploying a PR's documentation label Mar 24, 2026
@PProfizi PProfizi closed this Mar 24, 2026
@PProfizi PProfizi reopened this Mar 24, 2026
@github-actions
Copy link
Copy Markdown
Contributor

Some tests with 'continue-on-error: true' have failed:

  • PyDPF-Post API tests on ubuntu-latest

Created by continue-on-error-comment

@oparreno
Copy link
Copy Markdown
Contributor

@ricardopeixotocoelho, would you please also verify that this example uses the best practices we use for MAPDLOperators?

@PProfizi PProfizi added this to the 0.16.1 milestone Apr 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

deploy-pr-doc For deploying a PR's documentation tutorials Related to PyDPF-Core tutorials

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants