Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docstring markdown render overhaul (preserves markdown syntax), new features and bugfixes including no find_module AttributeError fix #85

Merged
merged 13 commits into from
Feb 28, 2025

Conversation

ltan10
Copy link
Contributor

@ltan10 ltan10 commented Feb 26, 2025

What kind of change does this PR introduce?

  • Bugfix
  • New Feature
  • Feature Improvment
  • Refactoring
  • Documentation
  • Other, please describe:

Description:

  • Fixes generation of markdown files with no module functions rendered.
  • Overhauled docstring markdown rendering.
  • Introduced support for Github flavoured admonitions block.
    • Converted from original quote blocks to admonition block
  • Changed class constructor signature rendering.
    • Changed rendered type from method to constructor.
    • Changed signature of init to class name, allows for easier understanding and implementation for new python users.
  • Added feature to include private modules modules with "_" prefix
    • cli option: --private-modules and --no-private-modules. Defaults to no-private-modules
  • Added feature for table of contents of functions generation in generated module markdown files.
    • cli option: --toc and --no-toc. Defaults to no-toc
  • Fixed non-compliant url link format using incorrect backslash due to using os.path.join platform dependency. (Source Badge URL error #41)
    • Link is quoted to generate safe URL's.
  • Added feature for user override of line anchors format to support different git hosting repo. (RFE: Allow users to override the default URL format to accommodate different Git hosting services like Bitbucket #74)
    • cli option: --url-line-prefix TEXT, defaults to None: which is github method of #Lxxx
  • Generated markdown file newlines is no longer platform dependent.
  • Updated documentation and docstrings.
  • Implemented crude work around to solve dataclass no attribute __create_fn__ error (No support for dataclasses #72)
  • Added support for dataclasses, enums and exceptions
  • Updated pr-label.yml github work flow, sync-label from "" to false as workaround was fixed in labeler v5.0.0

Checklist:

  • I have read the CONTRIBUTING document.
  • My changes don't require a change to the documentation, or if they do, I've added all required information.

…module" AttributeError

Caused by modules not correctly loaded into namespace from commit due to Issue ml-tooling#57.
Modules now correctly loaded into namespace.
Fixes AttributeError("'FileFinder' object has no attribute 'find_module'") (ml-tooling#69)
Prioritized "find_spec" and falls back to "find_module" from loader if find_spec not available.
Some whitespace removal.
Modify argument regex
Fix Colon use in docstring in arguments blocks now formatted correctly.
Change argument detection to last colon in line.
Added support for "Reference" as a block header.
Convert quote block to admonition blocks
Added Github admonition quote block support.
Added start line anchor to regex
Changed "```" code snippet boundary detection from startswith to regex to prevent false positives.

Rework docstring markdown render. Solves issue ml-tooling#80
Improved whitespace and newline rendering.
Accepts more native markdown syntax without garbling render.
Solves Issue ml-tooling#82

Enumerate the docstring to detect end of docstring to appropriately close literal blocks, doctest and code blocks

Update literal blocks logic and format.
Syntax is same as reStructured text
@ltan10 ltan10 force-pushed the feature/doc-to-md-overhaul branch from dbf49cc to fc350c8 Compare February 26, 2025 12:36
@ltan10 ltan10 changed the title Docstring markdown render overhaul, new features and bugfixes including no find_module AttributeError fix Docstring markdown render overhaul (preserves markdown syntax), new features and bugfixes including no find_module AttributeError fix Feb 27, 2025
@lukasmasuch
Copy link
Contributor

lukasmasuch commented Feb 28, 2025

@ltan10 Thanks for the update!! I will merge it as is but I need to apply some other fixes in the next few days to get the build/release pipeline working again.

Btw. if you like, I can also make you a maintainer in this repo since - unfortunately - I don't have a lot of time for lazydocs.

@lukasmasuch lukasmasuch merged commit 9c4e37c into ml-tooling:main Feb 28, 2025
1 of 3 checks passed
@ltan10
Copy link
Contributor Author

ltan10 commented Mar 2, 2025

@lukasmasuch No worries, it has been a useful tool. And yeah happy to help as maintainer wherever i can.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants