NiklasRosenstein / pydoc-markdown

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

Add .pre-commit-hooks.yaml #298

Closed RomainTT closed 11 months ago

RomainTT commented 12 months 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 12 months 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 11 months 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 11 months ago

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