Writers

The following Writers are available:

Create a New Writer

When adding a new Writer class to the repository the following steps should be performed. Please follow the style guide.

  1. Create a fork of the repository.

  2. Create a new Writer by following this template and save it to the msl/io/writers/ directory.

    # import the necessary MSL-IO objects
    from msl.io import Writer
    
    class MyExampleWriter(Writer):
        """Name your class to be whatever you want, i.e., change MyExampleWriter"""
    
        def write(self, file=None, root=None, **kwargs):
            """Implement your write method with the above signature.
    
            Parameters
            ----------
            file : path-like or file-like
                The file to write to. If None then uses the value of
                `file` that was specified when MyExampleWriter was instantiated.
            root : Root
                Write `root` to the file. If None then write the Groups
                and Datasets that were created using MyExampleWriter.
            **kwargs
                Optional key-value pairs.
            """
    
  3. Add test cases to the tests/ directory to make sure that your Writer works as expected. It is recommended to try converting a Root object between your Writer and other Writers that are available to verify different file-format conversions. Also, look at the test modules that begin with test_writer for more examples. Run the tests using python setup.py tests (ideally you would run the tests for all currently-supported versions of Python, see also condatests.py).

  4. Create a new msl.io.writers.<name of your module from Step 2>.rst file in docs/_api. Follow the template that is used for the other .rst files in this directory.

  5. Add the new Writer, alphabetically, to the .. toctree:: in docs/writers.rst. Follow the template that is used for the other Writers.

  6. Add the new Writer, alphabetically, to the .. autosummary:: in docs/api_docs.rst. Follow the template that is used for the other Writers.

  7. Add yourself to AUTHORS.rst and add a note in CHANGES.rst that you created this new Writer. These files are located in the root directory of the MSL-IO package.

  8. Build the documentation running python setup.py docs (view the documentation by opening the docs/_build/html/index.html file).

  9. If running the tests pass and building the documentation show no errors/warnings then create a pull request.