diff --git a/src/scicookie/hooks/post_gen_project.py b/src/scicookie/hooks/post_gen_project.py index 416c5e3a..eceb8025 100644 --- a/src/scicookie/hooks/post_gen_project.py +++ b/src/scicookie/hooks/post_gen_project.py @@ -77,6 +77,7 @@ def move_selected_doc_dir(): if DOCUMENTATION_ENGINE == "sphinx": remove_project_file(Path("docs") / "index.md") + remove_project_file(Path("docs/api") / "references.md") shutil.rmtree(DOCS_SPEC_DIR) diff --git a/src/scicookie/{{cookiecutter.project_slug}}/conda/dev.yaml b/src/scicookie/{{cookiecutter.project_slug}}/conda/dev.yaml index 0f3e22e9..855d5715 100644 --- a/src/scicookie/{{cookiecutter.project_slug}}/conda/dev.yaml +++ b/src/scicookie/{{cookiecutter.project_slug}}/conda/dev.yaml @@ -7,3 +7,6 @@ dependencies: - poetry - nodejs # used by semantic-release - shellcheck +{%- if cookiecutter.documentation_engine == 'sphinx' %} + - pandoc +{%- endif %} diff --git a/src/scicookie/{{cookiecutter.project_slug}}/docs-sphinx/conf.py b/src/scicookie/{{cookiecutter.project_slug}}/docs-sphinx/conf.py index d9dd2d36..bf09549e 100755 --- a/src/scicookie/{{cookiecutter.project_slug}}/docs-sphinx/conf.py +++ b/src/scicookie/{{cookiecutter.project_slug}}/docs-sphinx/conf.py @@ -30,17 +30,20 @@ # extensions coming with Sphinx (named "sphinx.ext.*") or your custom ones. extensions = [ "sphinx.ext.autodoc", - "sphinx.ext.viewcode", - "myst_parser" + "sphinx.ext.napoleon", + "myst_parser", + "nbsphinx" ] +nbsphinx_allow_errors = True + # Add any paths that contain templates here, relative to this directory. templates_path = ["_templates"] # The suffix(es) of source filenames. # You can specify multiple suffix as a list of string: # -source_suffix = [".rst", ".md", ".ipynb"] +source_suffix = [".rst", ".md"] # The master toctree document. master_doc = "index" @@ -69,7 +72,7 @@ # List of patterns, relative to source directory, that match files and # directories to ignore when looking for source files. # This patterns also effect to html_static_path and html_extra_path -exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"] +exclude_patterns = ["_build", "Thumbs.db", ".DS_Store", ".ipynb_checkpoints"] # The name of the Pygments (syntax highlighting) style to use. pygments_style = "sphinx" diff --git a/src/scicookie/{{cookiecutter.project_slug}}/docs-sphinx/index.rst b/src/scicookie/{{cookiecutter.project_slug}}/docs-sphinx/index.rst index acc252b2..8d536d5e 100644 --- a/src/scicookie/{{cookiecutter.project_slug}}/docs-sphinx/index.rst +++ b/src/scicookie/{{cookiecutter.project_slug}}/docs-sphinx/index.rst @@ -1,15 +1,19 @@ Welcome to {{ cookiecutter.project_name }}'s documentation! -====================================== +{{ "=" * ((cookiecutter.project_name|length) + 28) }} + .. toctree:: :maxdepth: 2 :caption: Contents: + + Introduction installation - modules - example + api/references + Example contributing changelog + Indices and tables ================== diff --git a/src/scicookie/{{cookiecutter.project_slug}}/docs-sphinx/readme.md b/src/scicookie/{{cookiecutter.project_slug}}/docs-sphinx/readme.md new file mode 100644 index 00000000..451bedae --- /dev/null +++ b/src/scicookie/{{cookiecutter.project_slug}}/docs-sphinx/readme.md @@ -0,0 +1,2 @@ +```{include} ../README.md +``` diff --git a/src/scicookie/{{cookiecutter.project_slug}}/docs-sphinx/readme.rst b/src/scicookie/{{cookiecutter.project_slug}}/docs-sphinx/readme.rst deleted file mode 100644 index bdff72a8..00000000 --- a/src/scicookie/{{cookiecutter.project_slug}}/docs-sphinx/readme.rst +++ /dev/null @@ -1 +0,0 @@ -.. include:: ../README.md diff --git a/src/scicookie/{{cookiecutter.project_slug}}/docs/api/references.rst b/src/scicookie/{{cookiecutter.project_slug}}/docs/api/references.rst new file mode 100644 index 00000000..bc813872 --- /dev/null +++ b/src/scicookie/{{cookiecutter.project_slug}}/docs/api/references.rst @@ -0,0 +1,8 @@ +API references +============== + +.. automodule:: {{cookiecutter.package_slug}} + :members: + +.. automodule:: {{cookiecutter.package_slug}}.{{cookiecutter.package_slug}} + :members: diff --git a/src/scicookie/{{cookiecutter.project_slug}}/docs/example.ipynb b/src/scicookie/{{cookiecutter.project_slug}}/docs/example.ipynb index f5f5b7a0..8231593e 100644 --- a/src/scicookie/{{cookiecutter.project_slug}}/docs/example.ipynb +++ b/src/scicookie/{{cookiecutter.project_slug}}/docs/example.ipynb @@ -23,6 +23,13 @@ "source": [ "import {{ cookiecutter.package_slug }}" ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] } ], "metadata": { @@ -41,7 +48,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.10.8" + "version": "3.10.11" } }, "nbformat": 4, diff --git a/src/scicookie/{{cookiecutter.project_slug}}/pyproject.toml b/src/scicookie/{{cookiecutter.project_slug}}/pyproject.toml index 3bbaf98d..67a8c802 100644 --- a/src/scicookie/{{cookiecutter.project_slug}}/pyproject.toml +++ b/src/scicookie/{{cookiecutter.project_slug}}/pyproject.toml @@ -106,6 +106,8 @@ Sphinx = "^6.2.1" sphinx-rtd-theme = "^1.2.2" importlib-metadata = "^6.5.1" myst-parser = "^0.19.2" +nbsphinx = "^0.9.2" +pandoc = "^2.3" {% elif cookiecutter.documentation_engine == 'jupyter-book' -%} jupyter-book = "^0.15.1" myst-parser = "^0.18.1"