Writers
The following Writer
s 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.
Create a fork of the repository.
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. """
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 withtest_writer
for more examples. Run the tests usingpython setup.py tests
(ideally you would run the tests for all currently-supported versions of Python, see also condatests.py).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.Add the new Writer, alphabetically, to the
.. toctree::
in docs/writers.rst. Follow the template that is used for the other Writers.Add the new Writer, alphabetically, to the
.. autosummary::
in docs/api_docs.rst. Follow the template that is used for the other Writers.Add yourself to
AUTHORS.rst
and add a note inCHANGES.rst
that you created this new Writer. These files are located in the root directory of the MSL-IO package.Build the documentation running
python setup.py docs
(view the documentation by opening thedocs/_build/html/index.html
file).If running the tests pass and building the documentation show no errors/warnings then create a pull request.