字幕表 動画を再生する
writing documentation is the dream of every engineer.
It gives you a chance to describe your code in beautiful prose, and the documentation often takes up more space than the code itself.
What could be more fun than that?
Luckily, Python gives you a tool to share your written masterpiece with your fellow engineers, the Pied Up module.
This will generate Web pages from your python documentation.
It can even launch a Web server so your colleagues can read about how to use your code before they gave up on Ask you in person.
I hope you brought your dancing shoes because this documentation party is about to begin.
Prepare to have your mind blown because we're going to start by looking at the documentation for the documentation tool.
The fastest way to do this is to simply run the pie doc module.
Do not forget to use the Dash M option to run the Pie Doc module as a script.
The first way we will use Pi Doc is to look at the documentation for a class module or function.
For example, we can use Pi Doc to look at the documentation for the math module in addition to a brief description of the module.
It describes each function it contains.
We can also look at the help text for a class such as to pull or even a function like power.
You can also access this an interactive mode by using the help function.
But one small benefit with Pie Doc is that you do not have to import a module to look at its help text.
Otherwise, this is identical to starting python and calling the help function.
But wait, there's more.
The second use of the Pie Doc module is to search all modules for a surgeon.
Keyword excitement level plus plus.
For example, let us search the python modules for the key ward FTP.
My system has two results.
A class and its test class.
You may get something else if you're using a different version of python or have additional python libraries installed, let us use Pi Dog to learn more about the FTP lit class.
What, is this an example?
Be still my beating heart.
This is some great A help text.
Let us do another search.
Does Python contain any modules?
With the keyword sequel?
I would say this is a resounding Yes.
Let us dive into the sequel Light three package.
If we page down, we see this package comes with a variety of errors, classes and functions.
We will learn how to use these in a separate video.
Let us return to the list of Pie Doc features.
The third entry says you can use Pi Doc to start an http server on a specified port For browsing the documentation, we will start a server on port 314 This will give us a pie dog server on pork pie.
See what I did there?
Python gives us the U.
R L for browsing all the documentation.
You can open a browser and type in this You are l yourself or you can simply enter.
B python will then open a browser and go to the documentation home page for you.
The top section displays the built in modules.
Clicking one will give you full details.
For example, if you click on the sea math link, you can learn about this module.
It is called C math for complex math.
Because thes functions work with complex numbers, you return to the home page by clicking on the module index link above.
If you scroll further down, you can see there was a tremendous number of modules and packages in the Python library.
I would strongly recommend you take the time to browse thes modules to become familiar with what features are available to you.
For examples, clicking on the XML package gives you an idea of what XML capabilities comes standard with python.
If you want to view the documentation for a specific item, then enter it in the text box above and click Get Python will then fetch the documentation for that function class, module or package.
If you are not exactly sure of the name of the item, you can search for it as well.
For example, a search for the term RPC, which is short for remote procedure call the search results are listed below.
Clicking on a result takes you to the documentation.
As you can see, this is a fast way to browse, find and search through the python documentation.
To stop the documentation server, return to the consul and enter cute return once more to the pie dog documentation.
There are two features remaining calling pie Dock with the Dash B option will start the server on an available port and launch a browser for you.
A handy shortcut indeed, especially if you have other service, is running on a large number of ports.
This brings us to the final feature, the ability to generate HTML files of the documentation.
As a demonstration, we will create a folder called Pied a Demo.
Once inside, we will generate an HTML file with the documentation for the Jason Package.
To do this, run pie dock with a dash W option and then enter the name of the function class, module or package.
You can see that the file jayson dot html was created.
If you open this in a browser, you can see the documentation.
This feature is especially useful if you want to host the python documentation for your code on a separate server rather than your workstation.
All too often, engineers right, beautiful documentation only to find that others refuse to read the manual.
But with pie Doc, you can turn all your python documentation into an interactive website with pretty colors and clicky links.
This is a fantastic aid when writing code and in a valuable tool when working on large projects now run!
Run to the nearest workstation and get to work using pi Doc, Please hurry.
There is not enough time to subscribe to our channel.
Documentation comes first.
It comes first after subscribing.
Yeah.
Do you You?