![]() ![]() To make it easier for your users to use the package we fix this by using internal imports.įirst, we have to add two relative imports to the _init_.py file in the augmentation folder. ![]() If we currently want to use the CutMixImageDataGenerator we have to import it like this: import tensorflow_imagedatagenerator help(tensorflow_imagedatagenerator.CutMixImageDataGenerator) ![]() By default, the following does not work: from tensorflow_gmentation import CutMixImageDataGenerator help(CutMixImageDataGenerator)Įxecuting this results in the following error: Traceback (most recent call last): File "main.py", line 3, in help(tensorflow_helpers.CutMixImageDataGenerator) AttributeError: module 'tensorflow_helpers' has no attribute 'CutMixImageDataGenerator' With the documentation in place, it’s time to think about how you want the users to import your package. With the added documentation template by pyment Structuring imports Of course, it won’t write the documentation but gives you an excellent start. The -o sets the output documentation style, in our case reST. The -w tells pyment to add documentation to the existing file. Then you can use it to generate a documentation template, like this: pyment -w. You install pyment using pip install pyment. It supports the previously mentioned styles. This is a Python program that can create, update or convert docstrings in an existing Python file. This style is recommended by PEP 287.Īn easy way to start documenting is by using pyment. I chose to use the reStructuredText (reST). There are four styles that you can use: Google, NumPy, reST, and Javadoc - they don’t differ a lot. Before we start, we have to choose a documentation style. We have to document each function, class, and class method. I know it is not the most fun part, but it is crucial as it helps users to use your code. ![]() With the directory structure in place, we have to talk about documentation. ![]()
0 Comments
Leave a Reply. |