Skip to content

Commit 5e5167e

Browse files
committed
Add README.rst
1 parent 22df186 commit 5e5167e

File tree

1 file changed

+81
-0
lines changed

1 file changed

+81
-0
lines changed

README.rst

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
python-mkdoc
2+
============
3+
4+
An amazing helper script to generate pydoc for your python projects.
5+
6+
Running the script ( *mkpydoc.sh* ) from the root directory of your project will generate pydoc for all module components (and they will link to eachother) into the "doc" directory, as well as creating an index.html -- ready to zip up and upload to pythonhosted.org via pypi
7+
8+
9+
Installation
10+
------------
11+
12+
*mkpydoc.sh* has an optional dependency on AdvancedHTMLParser ( https://github.com/kata198/AdvancedHTMLParser or https://pypi.python.org/pypi/AdvancedHTMLParser ).
13+
14+
It is STRONGLY recommended you have this package installed, otherwise *mkpydoc.sh* will NOT be able to prepare the documentation for web-hosting (they will contain links to the local filesystem). You CAN still generate docs easily with this script without AdvancedHTMLParser.
15+
16+
17+
Either use "install.sh" in the project root to install *mkpydoc.sh* to the local system. You may also choose to just add the *mkpydoc.sh* script to your project's root directory. More on this is covered below
18+
19+
20+
How to Use
21+
----------
22+
23+
There are two ways to use *mkpydoc.sh*
24+
25+
The first step is to nativage to your project directory ( e.x. the directory you clone from git, NOT your package dir )
26+
27+
28+
**Local Install**
29+
30+
These instructions are for those who have run "install.sh" or otherwise installed *mkpydoc.sh* script onto the local system, such as in /usr/bin.
31+
32+
* Run *mkpydoc.sh NAME* where "NAME" is your package directory. So, for example, if I checked out the "python-subprocess2" git repo, I would run *mkpydoc.sh subprocess2* within that directory.
33+
34+
**Local Copy**
35+
36+
These instructions are for those who do NOT have *mkpydoc.sh* installed locally, but rather have a copy checked in with the source.
37+
38+
You CAN still provide the argument ( as with the "Local Install" instructions ), however if you check it in with your source code,
39+
40+
it is recommended that you modify the line:
41+
42+
43+
DEFAULT_PROJECT_NAME="YOUR_PROJECT_DIR_HERE"
44+
45+
to match your module's root directory. This will allow you to run *mkpydoc.sh* without arguments, and generate pydoc for the local project.
46+
47+
48+
What it does
49+
------------
50+
51+
*mkpydoc.sh* will scan the provided package directory and all subdirs and gather all .py files.
52+
53+
It will then invoke pydoc against all of these files in one go, which enables the various documents to reference and link to eachother.
54+
55+
Following pydoc generation, the script will "clean up" the resulting output. It will convert the local filesystem paths to relative web-safe links. This both improves security (by not exposing your filesystem structure and potentially username as well), allows the pydoc documents to be hosted online, and ensures that the links actually work from a browser.
56+
57+
All of the generated HTML files will be placed in the directory "doc" at the root level of your project.
58+
59+
A symlink will be created from "index.html" -> MODULE/\_\_init\_\_.py where "MODULE" is the root package directory you provided. This is required for submitting to pythonhosted and provides a sane "starting point" when viewing the documents.
60+
61+
62+
Further Actions
63+
---------------
64+
65+
After generating the pydoc, you can prepare it for upload to pythonhosted.org (via pypi.python.org) with the following:
66+
67+
1 Navigate into the "doc" directory
68+
69+
2 Execute *zip doc.zip \*.html*
70+
71+
3 Navigate to pypi.python.org and login. On the sidebar, select your project. Click "releases" at the top. At the bottom is a form where you can upload the "doc.zip" you created above
72+
73+
74+
You may also want to consider adding the following line to your *MANIFEST.in*
75+
76+
77+
recursive-include doc *.html
78+
79+
to include the pydoc documentation in the source distribution
80+
81+

0 commit comments

Comments
 (0)