Mk generator
In [ ]:
Copied!
"""
Handsdown to generate documentation for the project.
"""
"""
Handsdown to generate documentation for the project.
"""
In [ ]:
Copied!
import os
from pathlib import Path
from handsdown.generators.material import MaterialGenerator
from handsdown.processors.pep257 import PEP257DocstringProcessor
from handsdown.utils.path_finder import PathFinder
import os
from pathlib import Path
from handsdown.generators.material import MaterialGenerator
from handsdown.processors.pep257 import PEP257DocstringProcessor
from handsdown.utils.path_finder import PathFinder
pytype: skip-file
In [ ]:
Copied!
repo_path = Path.cwd()
repo_path = Path.cwd()
In [ ]:
Copied!
# this little tool works like `pathlib.Path.glob` with some extra magic
# but in this case `repo_path.glob("**/*.py")` would do as well
path_finder = PathFinder(repo_path)
# this little tool works like `pathlib.Path.glob` with some extra magic
# but in this case `repo_path.glob("**/*.py")` would do as well
path_finder = PathFinder(repo_path)
In [ ]:
Copied!
# no docs for tests and build
path_finder.exclude("tests/*", "build/*")
# no docs for tests and build
path_finder.exclude("tests/*", "build/*")
In [ ]:
Copied!
# generate folder structure, if needed
os.makedirs(repo_path / "docs/API/", exist_ok=True)
# generate folder structure, if needed
os.makedirs(repo_path / "docs/API/", exist_ok=True)
In [ ]:
Copied!
# initialize generator
handsdown = MaterialGenerator(
input_path=repo_path,
output_path=repo_path / "docs/API",
source_paths=path_finder.glob("**/*.py"),
source_code_url="https://github.com/uncscode/particula-beta/blob/main/",
docstring_processor=PEP257DocstringProcessor(),
)
# initialize generator
handsdown = MaterialGenerator(
input_path=repo_path,
output_path=repo_path / "docs/API",
source_paths=path_finder.glob("**/*.py"),
source_code_url="https://github.com/uncscode/particula-beta/blob/main/",
docstring_processor=PEP257DocstringProcessor(),
)
In [ ]:
Copied!
# generate all docs at once
handsdown.generate_docs()
# generate all docs at once
handsdown.generate_docs()
In [ ]:
Copied!
# generate index.md file
handsdown.generate_index()
# generate index.md file
handsdown.generate_index()