diff --git a/docs/Makefile b/docs/Makefile new file mode 100644 index 0000000..ed88099 --- /dev/null +++ b/docs/Makefile @@ -0,0 +1,20 @@ +# Minimal makefile for Sphinx documentation +# + +# You can set these variables from the command line, and also +# from the environment for the first two. +SPHINXOPTS ?= +SPHINXBUILD ?= sphinx-build +SOURCEDIR = . +BUILDDIR = build + +# Put it first so that "make" without argument is like "make help". +help: + @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) + +.PHONY: help Makefile + +# Catch-all target: route all unknown targets to Sphinx using the new +# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). +%: Makefile + @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) diff --git a/docs/conf.py b/docs/conf.py new file mode 100644 index 0000000..9c6282f --- /dev/null +++ b/docs/conf.py @@ -0,0 +1,35 @@ +# Configuration file for the Sphinx documentation builder. +# +# For the full list of built-in configuration values, see the documentation: +# https://www.sphinx-doc.org/en/master/usage/configuration.html + +# -- Project information ----------------------------------------------------- +# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information +import os +import sys +sys.path.insert(0, os.path.abspath('../src')) + +project = 'プロジェクト名を設定してください' +copyright = '2025, 作成者名を設定してください' +author = '作成者名を設定してください' +release = '1.0.0' + +# -- General configuration --------------------------------------------------- +# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration + +extensions = [ + 'sphinx.ext.autodoc', + 'sphinx.ext.napoleon', # GoogleスタイルやNumPyスタイルのdocstring対応 + 'sphinx.ext.viewcode', # ソースコードへのリンク + 'sphinx_rtd_theme'] + +templates_path = ['_templates'] +exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store'] + +language = 'ja' + +# -- Options for HTML output ------------------------------------------------- +# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output + +html_theme = 'sphinx_rtd_theme' +html_static_path = ['_static'] diff --git a/docs/index.rst b/docs/index.rst new file mode 100644 index 0000000..e17effa --- /dev/null +++ b/docs/index.rst @@ -0,0 +1,20 @@ +.. プロジェクト名を設定してください documentation master file, created by + sphinx-quickstart on Fri Dec 5 01:02:07 2025. + You can adapt this file completely to your liking, but it should at least + contain the root `toctree` directive. + +プロジェクト名を設定してください documentation +============================================== + +Add your content using ``reStructuredText`` syntax. See the +`reStructuredText `_ +documentation for details. + + +.. toctree:: + :maxdepth: 2 + :caption: Contents: + + modules + + diff --git a/docs/main.rst b/docs/main.rst new file mode 100644 index 0000000..7874bd9 --- /dev/null +++ b/docs/main.rst @@ -0,0 +1,7 @@ +main module +=========== + +.. automodule:: main + :members: + :show-inheritance: + :undoc-members: diff --git a/docs/make.bat b/docs/make.bat new file mode 100644 index 0000000..8f56beb --- /dev/null +++ b/docs/make.bat @@ -0,0 +1,35 @@ +@ECHO OFF + +pushd %~dp0 + +REM Command file for Sphinx documentation + +if "%SPHINXBUILD%" == "" ( + set SPHINXBUILD=sphinx-build +) +set SOURCEDIR=. +set BUILDDIR=build + +%SPHINXBUILD% >NUL 2>NUL +if errorlevel 9009 ( + echo. + echo.The 'sphinx-build' command was not found. Make sure you have Sphinx + echo.installed, then set the SPHINXBUILD environment variable to point + echo.to the full path of the 'sphinx-build' executable. Alternatively you + echo.may add the Sphinx directory to PATH. + echo. + echo.If you don't have Sphinx installed, grab it from + echo.https://www.sphinx-doc.org/ + exit /b 1 +) + +if "%1" == "" goto help + +%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% +goto end + +:help +%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% + +:end +popd diff --git a/docs/modules.rst b/docs/modules.rst new file mode 100644 index 0000000..320ed56 --- /dev/null +++ b/docs/modules.rst @@ -0,0 +1,9 @@ +src +=== + +.. toctree:: + :maxdepth: 4 + + main + utils + diff --git a/docs/utils.rst b/docs/utils.rst new file mode 100644 index 0000000..296e746 --- /dev/null +++ b/docs/utils.rst @@ -0,0 +1,29 @@ +utils package +============= + +Submodules +---------- + +utils.custom\_logger module +--------------------------- + +.. automodule:: utils.custom_logger + :members: + :show-inheritance: + :undoc-members: + +utils.singleton module +---------------------- + +.. automodule:: utils.singleton + :members: + :show-inheritance: + :undoc-members: + +Module contents +--------------- + +.. automodule:: utils + :members: + :show-inheritance: + :undoc-members: diff --git a/readme/python_init.md b/readme/python_init.md index 87a75e1..1423d5d 100644 --- a/readme/python_init.md +++ b/readme/python_init.md @@ -79,4 +79,29 @@ ruff check . --output-format json --output-file ruff-report.json `--output-file`は`github`など様々な形式が指定できます -コメントを生成する方法を検討が必要 \ No newline at end of file +コメントを生成する方法を検討が必要 + +## Doc + +初期設定を行う + +```sh +mkdir docs +cd docs +sphinx-quickstart +``` + +rstファイルを自動生成する + +```sh +cd docs +sphinx-apidoc -o . ../src +``` + + +Docsを自動生成する + +``` +cd docs +make html +``` diff --git a/requirements-dev.txt b/requirements-dev.txt index 18ae90a..2c47131 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -4,3 +4,8 @@ pytest-cov coverage-badge # Linting tool ruff==0.14.7 +# Docs +sphinx +sphinx-rtd-theme +autodoc + diff --git a/src/utils/__init__.py b/src/utils/__init__.py new file mode 100644 index 0000000..e69de29