Skip to content

Instantly share code, notes, and snippets.

@masterPiece93
Last active September 2, 2025 08:28
Show Gist options
  • Save masterPiece93/e57b2abf225c66a0e6f0839b89d6e375 to your computer and use it in GitHub Desktop.
Save masterPiece93/e57b2abf225c66a0e6f0839b89d6e375 to your computer and use it in GitHub Desktop.
Pycco

Pycco

a python documenting tool .

How to Proceed .

Steps :

  • Create a folder on your machine ( let's say demo/ )
    • enter in this folder
      • if your are on ubuntu : cd demo
  • Create a python file in that folder ( let's say pycco_demo.py )
    • in this file , copy the contents from this file, and paste in your file .
  • Now create a python virtual environment in this current folder of yours .
  • Activate the virtual environment .
  • Install Pycco : pip install Pycco
  • Now run command : pycco pycco_demo.py
    • this will create a folder named docs/ in your current folder .
    • this docs/ folder will have a html file called : pycco_demo.html
    • just open this file in your browser , and viola ! your documentation is there !

NOTE : we are using : | python3.12 | Pycco==0.6.0 |

References :

blog on pycco usage

"""
### This is a test script for demonstrating pycco working .
> Demonstration of `functools.partial`
| `python 3.12` | `Pycco==0.6.0` |
"""
from functools import partial
# Let's write a simple function for adding two numbers :
def sum(a: int, b: int):
"""
Adds two numbers
"""
return a + b
# </br>
# prints output : `3`
print(sum(1, 2))
...
# ## Usage of `functools.partial`
# here we have created a new object that
# adds value '2'
add_2 = partial(sum, 2)
# prints output : `5`
print(add_2(3))
# ---
"""
### Conclusion
So as you can see , `sum(a: int, b: int)` was the original function for adding two numbers .
**functools.partial** extended it by reserving one argument as '2' , and now it has
become `add_2(b: int)` function , which will always add value '2' to the
other argument passed to it .
"""
# ---
"""
### Developer Zone
#### Directory structure :
```sh
.
├── pycco_demo.py
└── requirements.txt
```
we have installed `pycco`:
```sh
pip install pycco
```
#### Execution
we generated the documentation using following command :
```sh
pycco pycco_demo.py
```
as you run this command , the `docs/` folder will be generated in your
current working directory as :
```sh
.
├── docs
│ ├── pycco_demo.html
│ └── pycco.css
├── pycco_demo.py
└── requirements.txt
```
"""
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment