NiklasRosenstein / pydoc-markdown

Create Python API documentation in Markdown format.
http://niklasrosenstein.github.io/pydoc-markdown/
Other
460 stars 105 forks source link

Add .pre-commit-hooks.yaml #298

Closed RomainTT closed 1 year ago

RomainTT commented 1 year ago

pre-commit is a useful tool to run some programs while making a commit. If anything goes wrong or if a file changes, the commit is aborted.

It is very nice to have a pre-commit hook for pydoc-markdown, as it can ensure one does not commit code changes without updating the documentation (in case the documentation is a versioned file too).

Of course if you don't need to update documentation in your repository when your code change, you simply don't use that pre-commit hook.

NiklasRosenstein commented 1 year ago

Hey @RomainTT , thanks for your contribution. I haven't used pre-commit yet; is this really all that's needed for another repository to use Pydoc-Markdown in their pre-commit config, including the installation of Pydoc-Markdown? 👀

RomainTT commented 1 year ago

Hey @RomainTT , thanks for your contribution. I haven't used pre-commit yet; is this really all that's needed for another repository to use Pydoc-Markdown in their pre-commit config, including the installation of Pydoc-Markdown? 👀

Yes this is all that is needed. You can use it by creating a file .pre-commit-config.yaml in your repository, with the following content :

repos:
  - repo: https://github.com/NiklasRosenstein/pydoc-markdown
    rev: develop
    hooks:
      - id: pydoc-markdown

pre-commit will clone the repository and install the Python package in a virtual environment, so it can run pydoc-markdown when a commit is done with some python files in it.

NiklasRosenstein commented 1 year ago

Thanks for the explanation, @RomainTT. Happy to merge this. 🙂