Skip to content

Commit 4add695

Browse files
committed
Refactor module and function naming
1 parent 33cd234 commit 4add695

File tree

4 files changed

+15
-15
lines changed

4 files changed

+15
-15
lines changed

setup.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
AUTHOR = "ML Tooling Team"
1616
LICENSE = "MIT"
1717
REQUIRES_PYTHON = ">=3.6"
18-
VERSION = None # Only set version if you like to overwrite the version in about.py
18+
VERSION = None # Only set version if you like to overwrite the version in _about.py
1919

2020
# Please define the requirements within the requirements.txt
2121

@@ -57,10 +57,10 @@ def load_requirements(path_dir=PWD, file_name="requirements.txt", comment_char="
5757
with open(os.path.join(PWD, "README.md"), encoding="utf-8") as f:
5858
long_description = f.read()
5959

60-
# Load the package's about.py module as a dictionary.
60+
# Load the package's _about.py module as a dictionary.
6161
about = {} # type: dict
6262
if not VERSION:
63-
with open(os.path.join(PWD, os.path.join("src", MAIN_PACKAGE), "about.py")) as f: # type: ignore
63+
with open(os.path.join(PWD, os.path.join("src", MAIN_PACKAGE), "_about.py")) as f: # type: ignore
6464
# todo: extract version via regex? re.findall("__version__ = '([\d.\w]+)'", f.read())[0]
6565
exec(f.read(), about)
6666
VERSION = about["__version__"]

src/lazydocs/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@
33
# define the version before the other imports since these need it
44
__version__ = _about.__version__
55

6-
from . import generator
6+
from .generation import MarkdownGenerator, generate_docs

src/lazydocs/_cli.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,27 +4,27 @@
44

55
import typer
66

7-
import lazydocs.generator
7+
import lazydocs.generation
88

99
app = typer.Typer()
1010

1111

1212
@app.command()
1313
def generate(
1414
paths: List[str] = typer.Argument(
15-
..., help="Selected paths or import name for markdown generation."
15+
..., help="Selected paths or imports for markdown generation."
1616
),
1717
output_path: str = typer.Option(
1818
"./docs/",
1919
help="The output path for the creation of the markdown files. Set this to `stdout` to print all markdown to stdout.",
2020
),
21-
github_link: Optional[str] = typer.Option(
21+
src_base_url: Optional[str] = typer.Option(
2222
None,
23-
help="The base github link. Should include branch name. All source links are generated with this prefix.",
23+
help="The base repo link used as prefix for all source links. Should also include the branch name.",
2424
),
2525
overview_file: Optional[str] = typer.Option(
2626
None,
27-
help="Filename of overview file. If not provided, no overview file will be generated.",
27+
help="Filename of overview file. If not provided, no API overview file will be generated.",
2828
),
2929
remove_package_prefix: bool = typer.Option(
3030
True,
@@ -43,12 +43,12 @@ def generate(
4343
help="If `True`, validate the docstrings via pydocstyle. Requires pydocstyle to be installed.",
4444
),
4545
) -> None:
46-
"""Generates markdown documentation for provided path based on Google-style docstrings."""
46+
"""Generates markdown documentation for your Python project based on Google-style docstrings."""
4747

4848
lazydocs.generator.generate_docs(
4949
paths=paths,
5050
output_path=output_path,
51-
src_base_url=github_link,
51+
src_base_url=src_base_url,
5252
remove_package_prefix=remove_package_prefix,
5353
ignored_modules=ignored_modules,
5454
overview_file=overview_file,

src/lazydocs/generator.py renamed to src/lazydocs/generation.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ def to_md_file(
186186

187187
if watermark:
188188
string += _WATERMARK_TEMPLATE.format(
189-
date=datetime.date.today().strftime("%d, %b %Y")
189+
date=datetime.date.today().strftime("%d %b %Y")
190190
)
191191

192192
with open(os.path.join(out_path, md_file), "w") as f:
@@ -244,7 +244,7 @@ def _get_src_root_path(obj: Any) -> str:
244244
return module.__file__.split(root_package)[0] + root_package
245245

246246

247-
class MarkdownAPIGenerator(object):
247+
class MarkdownGenerator(object):
248248
"""Markdown generator class."""
249249

250250
def __init__(
@@ -800,8 +800,8 @@ def generate_docs(
800800
# Ignore all exceptions
801801
pass
802802

803-
# Initilize Markdown Generator
804-
generator = MarkdownAPIGenerator(
803+
# Initialize Markdown Generator
804+
generator = MarkdownGenerator(
805805
src_root_path=src_root_path,
806806
src_base_url=src_base_url,
807807
remove_package_prefix=remove_package_prefix,

0 commit comments

Comments
 (0)