Generowanie automatyczne dokumentacji w Sphinx

0

Posiadam spore repozytorium w pythonie.
Struktura wygląda następująco:

  • Katalog główny - README.md z opisem projektu (co robi, gdzie jest dokumentacja)
  • Plik requirments.txt - tutaj chcę wpisać co trzeba instalować jak otwiera się projekt
  • plik .gitignore
  • katalog doc - tutaj będzie dokumentacja z sphinx
  • katalog o takiej samej nazwie jak nazwa projektu z kodem źródłowym - czy tutaj powinienem dodać po prostu katalog src?

Czy sphinx powinien dodawać automatycznie wszystkie pliki .py z katalogu src i generować z nich dokumentację na podstawie docstring? Aktualnie dodaję je ręcznie

Szukam zbioru dobrych praktyk do generowania dokumentacji w projekcie z pythonie lub przykładu jak zrobić to dobrze

0

Może spróbuj wykorzystać narzędzie: https://www.sphinx-doc.org/en/master/man/sphinx-apidoc.html

0

Mam wygenerowaną dokumentację lecz nie mogę jej zacommitować do repozytorium
Korzystam z GitHub actions

# This is a basic workflow to help you get started with Actions

name: CI

# Controls when the action will run. 
on:
  # Triggers the workflow on push or pull request events but only for the master branch
  push:
    branches: [ master ]
  pull_request:
    branches: [ master ]

  # Allows you to run this workflow manually from the Actions tab
  workflow_dispatch:

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
  # This workflow contains a single job called "build"
  build:
    # The type of runner that the job will run on
    runs-on: ubuntu-latest

    # Steps represent a sequence of tasks that will be executed as part of the job
    steps:
      # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
      - uses: actions/checkout@v2

      # Runs a single command using the runners shell
      - name: Run a one-line script
        run: echo Hello, world!

      # Runs a set of commands using the runners shell
      - name: Run a multi-line script
        run: |
          echo Add other actions to build,
          echo test, and deploy your project.
      
      - name: Sphinx Build
        env:
          DRAW_IO_VERSION: "14.6.13"
        # You may pin to the exact commit or the version.
        uses: ammaraskar/[email protected]
        with:
          # The folder containing your sphinx docs.
          docs-folder: 
            doc/ # default is docs/
          # The command used to build your documentation.
          #build-command: | # optional, default is make html
          #  make clean
          #  make html
          # Run before the build command, you can use this to install system level dependencies, for example with "apt-get update -y && apt-get install -y perl"
          pre-build-command: | 
            pip install sphinx_rtd_theme
            pip install recommonmark
            apt-get update -y
            apt-get install -y sudo
            sudo apt -y install wget
            wget https://github.com/jgraph/drawio-desktop/releases/download/v${DRAW_IO_VERSION}/draw.io-amd64-${DRAW_IO_VERSION}.deb
            sudo dpkg -i draw.io-amd64-${DRAW_IO_VERSION}.deb
            drawio /doc/C4/C1.drawio /doc/C4/C1.png
            drawio /doc/C4/C2.drawio /doc/C4/C2.png
            drawio /doc/C4/C3.drawio /doc/C4/C3.png
            drawio /doc/C4/C4.drawio /doc/C4/C4.png
            
      - uses: actions/upload-artifact@v1
        with:
          name: DocumentationHTML
          path: doc/build/html/
      
      - name: Push changes
        uses: ad-m/github-push-action@master
        with:
          github_token: ${{ secrets.GITHUB_TOKEN }}
          branch: ${{ github.ref }}

Dwa ostatnie kroki powinny zacommitować i pushować do repozytorium jednak po wykonaniu nie zmienia się w repozytorium.
Czy to robię to poprawnie czy powinienem zmienić?

1 użytkowników online, w tym zalogowanych: 0, gości: 1