-
Notifications
You must be signed in to change notification settings - Fork 5
Add website #134
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
adamltyson
merged 37 commits into
neuroinformatics-unit:main
from
richarddushime:sphnix-docs
Mar 12, 2025
Merged
Add website #134
Changes from 6 commits
Commits
Show all changes
37 commits
Select commit
Hold shift + click to select a range
d3c74f6
Improve doc content #58
richarddushime f882987
Github repos creation
richarddushime c20945b
Fix pre-commit issues
richarddushime acecc88
title update
richarddushime 43f7a9c
description
richarddushime 5279ba8
Fix Requested Changes
richarddushime b82c0a0
improved layout
richarddushime dc847e8
Update .github/workflows/cookiecutter_docs.yml
richarddushime 2fac121
Update docs/source/conf.py
richarddushime 7708016
Update docs/source/conf.py
richarddushime bbad1ee
Update docs/source/index.md
richarddushime bbfa393
Update docs/source/project_setup.md
richarddushime ccb30f4
Update docs/source/project_setup.md
richarddushime 13cdc82
Update docs/source/contributing.md
richarddushime 3d7ec7a
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] 067a818
Update docs/source/contributing.md
richarddushime d9d5efb
Update docs/source/contributing.md
richarddushime a860e1a
Update docs/source/contributing.md
richarddushime 1db8ebd
Update docs/source/get_started.md
richarddushime 353e9aa
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] 1c7341b
Update docs/source/index.md
richarddushime 0ffa2a8
Update docs/source/project_setup.md
richarddushime 7855823
Minor Requested changes
richarddushime 9b67998
Update README.md
richarddushime be81e07
Update README.md
richarddushime 31618c5
Update docs/source/modules.md
richarddushime 921f001
Restructuring the Navbar and Contents
richarddushime eded354
Minor Fixes
richarddushime 4a2d475
Update docs/source/index.md
richarddushime e82601c
Update docs/source/index.md
richarddushime 01b656a
Update docs/source/index.md
richarddushime 56a7686
Update docs/source/contributing.md
richarddushime 8575e62
Final
richarddushime 0717d5d
lints errors fix
richarddushime 92ccf06
lints fix
richarddushime 44323ff
Merge branch 'main' into sphnix-docs
adamltyson 865fff7
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| * text=auto eol=lf |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| name: Documentation | ||
| on: | ||
| push: | ||
| branches: [main] | ||
| tags: ['*'] | ||
richarddushime marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| jobs: | ||
| deploy-docs: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - name: Set up Python | ||
| uses: actions/setup-python@v4 | ||
| with: | ||
| python-version: '3.13' | ||
|
|
||
| - name: Install dependencies | ||
| run: | | ||
| pip install -r docs/requirements.txt | ||
|
|
||
| - name: Build docs | ||
| run: | | ||
| cd docs | ||
| make clean && make html | ||
|
|
||
| - name: Deploy to GitHub Pages | ||
| uses: peaceiris/actions-gh-pages@v3 | ||
| with: | ||
| github_token: ${{ secrets.GITHUB_TOKEN }} | ||
| publish_dir: ./docs/build/html | ||
Empty file.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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 = source | ||
| 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) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| @ECHO OFF | ||
|
|
||
| pushd %~dp0 | ||
|
|
||
| REM Command file for Sphinx documentation | ||
|
|
||
| if "%SPHINXBUILD%" == "" ( | ||
| set SPHINXBUILD=sphinx-build | ||
| ) | ||
| set SOURCEDIR=source | ||
| 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| myst-parser | ||
| pydata-sphinx-theme | ||
| sphinx |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,59 @@ | ||
| /* Top navbar */ | ||
| .navbar { | ||
| display: flex; | ||
| justify-content: space-between; | ||
| align-items: center; | ||
| padding: 0.8rem 2rem; | ||
| background: transparent; | ||
| } | ||
|
|
||
| .navbar-brand { | ||
| flex: 0 0 auto; | ||
| } | ||
|
|
||
| .navbar-center-group { | ||
| flex: 1; | ||
| display: flex; | ||
| justify-content: center; | ||
| gap: 2rem; | ||
| margin: 0 2rem; | ||
| float: right; | ||
| } | ||
|
|
||
| .navbar-nav { | ||
| display: flex; | ||
| gap: 1.5rem; | ||
| margin: 0; | ||
| padding: 0; | ||
| align-items: center; | ||
| } | ||
|
|
||
| .navbar-icons { | ||
| display: flex; | ||
| gap: 1.5rem; | ||
| align-items: center; | ||
| } | ||
|
|
||
| .navbar-brand-logo img { height: 40px; } | ||
| .nav-link { color: white !important; font-weight: 500; } | ||
| .icon-link { color: white !important; font-size: 1.2rem; } | ||
| .bd-sidebar-secondary { display: none !important; } | ||
|
|
||
| /* Mobile responsiveness */ | ||
| @media (max-width: 768px) { | ||
| .navbar { | ||
| flex-wrap: wrap; | ||
| padding: 0.8rem; | ||
| } | ||
|
|
||
| .navbar-center-group { | ||
| order: 2; | ||
| width: 100%; | ||
| margin: 1rem 0; | ||
| justify-content: center; | ||
| } | ||
|
|
||
| .navbar-brand { | ||
| order: 1; | ||
| } | ||
| } |
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
richarddushime marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| <nav class="bd-navbar navbar"> | ||
| <!-- Center: Navigation items --> | ||
| <div class="navbar-center-group"> | ||
| <ul class="nav navbar-nav"> | ||
| <li class="nav-item"> | ||
| <a class="nav-link" href="{{ pathto('index') }}">About</a> | ||
richarddushime marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| </li> | ||
| <li class="nav-item"> | ||
| <a class="nav-link" href="{{ pathto('contributing') }}">Contribute</a> | ||
| </li> | ||
| </ul> | ||
| </div> | ||
|
|
||
| </nav> | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| <div class="sidebar-header-items__center"> | ||
| <nav class="bd-links" id="bd-docs-nav" aria-label="Main navigation"> | ||
| <div class="bd-toc-item navbar-nav"> | ||
| {{ toctree(maxdepth=2, includehidden=True, collapse=False) }} | ||
| </div> | ||
| </nav> | ||
| </div> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,91 @@ | ||
| # conf.py | ||
| # Configuration file for the Sphinx documentation builder. | ||
| project = 'cookiecutter-python' | ||
| copyright = "2025, Neuroinformatics Unit" | ||
| author = 'NIU' | ||
| release = "1.0.0" | ||
|
|
||
| # -- General configuration --------------------------------------------------- | ||
| extensions = [ | ||
| "myst_parser", | ||
| "sphinx_design", | ||
| "sphinx.ext.autodoc", | ||
| "sphinx.ext.napoleon", | ||
| "sphinx.ext.githubpages", | ||
| "sphinx_autodoc_typehints", | ||
| "sphinx.ext.autosummary", | ||
| "sphinx.ext.viewcode", | ||
| "sphinx.ext.intersphinx", | ||
| "sphinx_sitemap", | ||
| "nbsphinx", | ||
| ] | ||
richarddushime marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| # Configure MyST Parser | ||
| myst_enable_extensions = [ | ||
| "colon_fence", | ||
| "deflist", | ||
| "fieldlist", | ||
| "html_admonition", | ||
| "html_image", | ||
| "linkify", | ||
| "replacements", | ||
| "smartquotes", | ||
| "substitution", | ||
| "tasklist", | ||
| "attrs_inline" | ||
| ] | ||
|
|
||
| myst_heading_anchors = 4 | ||
|
|
||
| source_suffix = { | ||
| '.md': 'markdown', | ||
| '.rst': 'restructuredtext' | ||
| } | ||
|
|
||
| templates_path = ['_templates'] | ||
| exclude_patterns = [ | ||
| "**.ipynb_checkpoints", | ||
| "**/includes/**", | ||
| ] | ||
|
|
||
| # -- HTML output options ----------------------------------------------------- | ||
| html_theme = 'pydata_sphinx_theme' | ||
| html_logo = "_static/logo.png" | ||
| html_static_path = ["_static"] | ||
| html_title = "Python Cookiecutter" | ||
| html_favicon = "_static/favicon.ico" | ||
| html_show_sourcelink = False | ||
|
|
||
| html_theme_options = { | ||
| "navbar_start": ["navbar-logo"], | ||
| "navbar_center": ["navbar.html"], | ||
| "navbar_end": ["theme-switcher", "navbar-icon-links"], | ||
| "icon_links": [ | ||
| { | ||
| "name": "GitHub", | ||
| "url": "https://github.com/neuroinformatics-unit/python-cookiecutter", | ||
| "icon": "fa-brands fa-github", | ||
| "type": "fontawesome", | ||
richarddushime marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| } | ||
| ], | ||
| "logo": { | ||
| "text": "Python Cookiecutter", | ||
| "image_light": "logo.png", | ||
| "image_dark": "logo.png", | ||
| }, | ||
| "show_nav_level": 2, | ||
| "navigation_depth": 3, | ||
| "collapse_navigation": True, | ||
| } | ||
|
|
||
| # Sitemap configuration | ||
| html_baseurl = "https://neuroinformatics-unit.github.io/python-cookiecutter/" | ||
| sitemap_url_scheme = "{link}" | ||
|
|
||
|
|
||
| html_sidebars = { | ||
| "**": ["sidebar-nav.html"] | ||
| } | ||
|
|
||
| def setup(app): | ||
| app.add_css_file("css/custom.css") | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,81 @@ | ||
| # Contributing to cookiecutter-python | ||
richarddushime marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| Thank you for considering contributing to cookiecutter-python! We welcome contributions that improve the project, whether it's code, | ||
richarddushime marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| documentation, or enhancements. | ||
richarddushime marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| Please follow the guidelines below to ensure a smooth process. | ||
|
|
||
| 1. **Fork and Clone the Repository** Fork the main repository on | ||
| GitHub, then clone your fork locally: | ||
|
|
||
| ``` sh | ||
| git clone https://github.com/<your-username>/python-cookiecutter.git | ||
| cd python-cookiecutter | ||
| ``` | ||
|
|
||
| 2. **Create a New Branch** Create and switch to a new branch for your | ||
| changes: | ||
|
|
||
| ``` sh | ||
| git checkout -b my_new_feature | ||
| ``` | ||
|
|
||
| 3. **Make Your Changes** Edit the content, code, or | ||
| documentation as needed. When you're ready, add and commit your | ||
| changes with a descriptive message: | ||
|
|
||
| ``` sh | ||
| git add . | ||
| git commit -m "Describe your changes in short here" | ||
| ``` | ||
|
|
||
| 4. **Push Your Branch and Create a Pull Request** Push the new branch | ||
| to GitHub: | ||
|
|
||
| ``` sh | ||
| git push origin --set-upstream origin my_new_feature | ||
| ``` | ||
|
|
||
| Then, open a pull request against the ``main`` branch of the main repository. This will automatically trigger a GitHub Action to verify that the builds correctly. | ||
|
|
||
| 5. **Review and Merge** If the build checks pass, assign someone to review your pull request. Once approved and merged into the ``main`` branch, another GitHub Action will build and add your changes to the ``main`` branch. | ||
|
|
||
|
|
||
| ## Documentation Local Testing | ||
|
|
||
| If you are contributing to the Documentation, Before pushing your changes, you can test locally: | ||
|
|
||
| - **First-Time Setup:** Install the required dependencies and build | ||
| the docs: | ||
|
|
||
| ``` sh | ||
| pip install -r docs/requirements.txt | ||
| sphinx-build docs/source docs/build | ||
| ``` | ||
|
|
||
| Alternatively, you can use the following commands to install the | ||
| dependencies and build the docs: | ||
|
|
||
| ``` sh | ||
| pip install -r docs/requirements.txt | ||
| cd docs | ||
| make html | ||
| ``` | ||
|
|
||
| - **Rebuilding:** Each time you update the documentation, | ||
| rebuild the docs by running: | ||
|
|
||
| ``` sh | ||
| rm -rf docs/build && sphinx-build docs/source docs/build | ||
| ``` | ||
| or | ||
|
|
||
| ```sh | ||
| cd docs | ||
| make clean && make html | ||
| ``` | ||
|
|
||
| Then, open `docs/build/index.html` in your browser to preview the changes. | ||
|
|
||
|
|
||
| Thank you for your contributions! | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| # Documentation | ||
|
|
||
| Software documentation is important for effectively communicating how to use the software to others as well as to your future self. | ||
|
|
||
| If you want to include documentation in your package, make sure to respond with `1 - Yes` when prompted during the `cookiecutter` setup. This will instantiate a `docs` folder with a skeleton documentation system, that you can build upon. | ||
|
|
||
| The documentation source files are located in the `docs/source` folder and should be written in either [reStructuredText](https://docutils.sourceforge.io/rst.html) or [markdown](https://myst-parser.readthedocs.io/en/stable/syntax/typography.html). The `index.rst` file corresponds to the main page of the documentation website. Other `.rst` or `.md` files can be included in the main page via the `toctree` directive. | ||
|
|
||
| The documentation is built using [Sphinx](https://www.sphinx-doc.org/en/master/) and the [PyData Sphinx Theme](https://pydata-sphinx-theme.readthedocs.io/en/latest/). The `docs/source/conf.py` file contains the `Sphinx` configuration. | ||
|
|
||
| ## Building the documentation locally | ||
| You can build and view the documentation website locally, on your machine. To do so, run the following commands from the root of your project: | ||
|
|
||
| ```sh | ||
| # Install the documentation build dependencies | ||
| pip install -r docs/requirements.txt | ||
| # Build the documentation | ||
| sphinx-build docs/source docs/build | ||
| ``` | ||
| This should create a `docs/build` folder. You can view the local build by opening `docs/build/index.html` in a browser. | ||
| To refresh the documentation, after making changes, remove the `docs/build` folder and re-run the above command: | ||
|
|
||
| ```sh | ||
| rm -rf docs/build | ||
| sphinx-build docs/source docs/build | ||
| ``` | ||
|
|
||
| ### Publishing the documentation | ||
| We have included an extra GitHub actions workflow in `.github/workflows/docs_build_and_deploy.yml` that will build the documentation and deploy it to [GitHub pages](https://pages.github.com/). | ||
| * The build step is triggered every time a pull request is opened or a push is made to the `main` branch. This way you can make sure that the documentation does not break before merging your changes. | ||
| * The deployment is triggered only when a tag is present (see [Automated versioning](versioning.md)). This ensures that new documentation versions are published in tandem with the release of a new package version on PyPI (see [GitHub actions workflow](github_actions_setup.md)). | ||
| * The published docs are by default hosted at `https://<github_username_or_organization>.github.io/<package_name>/`. To enable hosting, you will need to go to the settings of your repository, and under the "Pages" section, select the `gh-pages` branch as the source for your GitHub pages site. | ||
| * A popular alternative to GitHub pages for hosting the documentation is [Read the Docs](https://readthedocs.org/). To enable hosting on Read the Docs, you will need to create an account on the website and follow the instructions to link your GitHub repository to your Read the Docs account. | ||
|
|
||
| ### Docstrings and API documentation | ||
| The journey towards good documentation starts with writing docstrings for all functions in your module code. In the example `math.py` and `greetings.py` modules you will find some docstrings that you can use as a template. We have written the example docstrings following the [numpy style](https://sphinxcontrib-napoleon.readthedocs.io/en/latest/example_numpy.html) but you may also choose another widely used style, such as the [Google style](https://sphinxcontrib-napoleon.readthedocs.io/en/latest/example_google.html). | ||
|
|
||
| Once you have written docstrings for all your functions, API documentation can be automatically generated via the [Sphinx autodoc extension](https://www.sphinx-doc.org/en/master/usage/extensions/autodoc.html). We have given examples of how to do this in the `docs/source/api_index.rst` file. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| # GitHub actions workflow | ||
|
|
||
| A GitHub actions workflow (`.github/workflows/test_and_deploy.yml`) has been set up to run (on each commit/PR): | ||
| * Linting checks (pre-commit). | ||
| * Testing (only if linting checks pass) | ||
| * Release to PyPI (only if a git tag is present and if tests pass). Requires `TWINE_API_KEY` from PyPI to be set in repository secrets. | ||
|
|
||
| This automation ensures that each commit or pull request is validated and that releases are published only when all checks pass. |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.