Skip to content

Commit

Permalink
Mkdocs (#30)
Browse files Browse the repository at this point in the history
* converted docs to mkdocs
  • Loading branch information
Florian Maas authored Apr 15, 2022
1 parent 65d6dfe commit 6e1d398
Show file tree
Hide file tree
Showing 38 changed files with 756 additions and 489 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/on-merge-to-main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
- name: Documentation Test
run: |
source .venv/bin/activate
make docs-test
make docs-verify
tox:
runs-on: ubuntu-latest
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/on-pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
- name: Documentation Test
run: |
source .venv/bin/activate
make docs-test
make docs-verify
tox:
runs-on: ubuntu-latest
Expand Down
10 changes: 2 additions & 8 deletions .github/workflows/on-release-main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
- name: Documentation Test
run: |
source .venv/bin/activate
make docs-test
make docs-verify
tox:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -83,10 +83,4 @@ jobs:
- name: Generate documentation
run: |
source .venv/bin/activate
make docs-build
- name: Deploy documentation to GitHub pages
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./docs/_build
mkdocs gh-deploy
16 changes: 4 additions & 12 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -41,19 +41,11 @@ publish: ## publish a release to pypi.

build-and-publish: build publish ## Build and publish.

docs-test: ## Test Sphinx documentation.
@sphinx-build docs docs/_build -W --keep-going
docs-verify: ## Check if MkDocs build does not return warnings or errors
@mkdocs build -s

docs-clean: ## Clean the docs/_build folder
@rm -rf docs/_build/*

docs-build: ## Build the documentation
@sphinx-build docs docs/_build

docs-open: ## Open the documentation
@open docs/_build/index.html

docs: docs-clean docs-build docs-open ## Build and open the documentation
docs-serve: ## Build and serve the MkDocs documentation
@mkdocs serve

.PHONY: help

Expand Down
2 changes: 0 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,6 @@ Cookiecutter Poetry

This is a `cookiecutter <https://github.com/cookiecutter/cookiecutter>`_ repository to generate the file structure for a Python project that uses `Poetry <https://python-poetry.org/>`_ for its dependency management.

+-------------------------------+--------------------------------------------------------------------------------------------------------------------------------------+
| **Github repository** | `https://github.com/fpgmaas/cookiecutter-poetry/ <https://github.com/fpgmaas/cookiecutter-poetry/>`_ |
+-------------------------------+--------------------------------------------------------------------------------------------------------------------------------------+
| **Documentation** | `https://fpgmaas.github.io/cookiecutter-poetry/ <https://fpgmaas.github.io/cookiecutter-poetry/>`_ |
+-------------------------------+--------------------------------------------------------------------------------------------------------------------------------------+
Expand Down
Binary file removed docs/.DS_Store
Binary file not shown.
56 changes: 0 additions & 56 deletions docs/conf.py

This file was deleted.

8 changes: 0 additions & 8 deletions docs/contents.rst

This file was deleted.

1 change: 0 additions & 1 deletion docs/contributing.rst

This file was deleted.

15 changes: 0 additions & 15 deletions docs/feature_details.rst

This file was deleted.

Empty file added docs/features.md
Empty file.
41 changes: 41 additions & 0 deletions docs/features/cicd.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
---
title: CI/CD with Github actions
---

when `include_github_actions` is set to `"y"`, a `.github` directory is
added with the following structure:

.github
├── workflows
├─── run-checks
│ └── action.yml
├─── setup-poetry-env
│ └── action.yml
├── on-merge-to-main.yml
├── on-pull-request.yml
└── on-release-main.yml

`on-merge-to-main.yml` and `on-pull-request.yml` are identical except
for their trigger conditions; the first is run whenever a new commit is
made to `main` (which should
[only](https://docs.github.com/en/repositories/configuring-branches-and-merges-in-your-repository/defining-the-mergeability-of-pull-requests/about-protected-branches)
happen through merge requests, hence the name), and the latter is run
whenever a pull request is opened or updated. They call the `action.yml`
files to set-up the environment, run the tests, and check the code
formatting.

`on-release-main.yml` does all of the former whenever a new release is
made on the `main` branch. In addition, `on-release-main.yml` also
publishes the project to Pypi or Artifactory if `publish_to` is set to
`"pypi"` or `"artifactory"`, and it builds and deploys the documentation
if `sphinx_docs` is set to `"y"`. To learn more about these features,
see `Releasing to Pypi or Artifactory <./releasing>`{.interpreted-text
role="doc"} and `Documentation with Sphinx
<./sphinx>`{.interpreted-text role="doc"}

Additionally, all workflows check for compatibility with multiple Python
versions if `tox` is set to `"y"`.

## Example CI/CD Pipeline

[![Example pipeline](https://raw.githubusercontent.com/fpgmaas/cookiecutter-poetry/main/static/images/pipeline.png)](https://raw.githubusercontent.com/fpgmaas/cookiecutter-poetry/main/static/images/pipeline.png)
30 changes: 0 additions & 30 deletions docs/features/cicd.rst

This file was deleted.

20 changes: 20 additions & 0 deletions docs/features/formatting.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
title: Formatting
---

[isort](https://pycqa.github.io/isort/index.html) and
[black](https://pypi.org/project/black/) are added as development
dependencies. `black` and `isort` can be used to format the code with

``` bash
make format
```

And the code style can be checked with

``` bash
make lint
```

If `include_github_actions` is set to `"y"`, code formatting is checked
for every merge request, every merge to main, and every release.
18 changes: 0 additions & 18 deletions docs/features/formatting.rst

This file was deleted.

25 changes: 25 additions & 0 deletions docs/features/makefile.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
---
title: Makefile
---

The generated repository will have a `Makefile` available. A list of all
available commands that are available can be obtained by running
`make help` in the terminal. Initially, the following commands are
available:

```
install Install the poetry environment
format Format code using isort and black.
lint Check code formatting using isort and black.
test Test the code with pytest
build Build wheel file using poetry
clean-build clean build artifacts
publish publish a release to pypi.
build-and-publish Build and publish.
docs-generate convert docstrings to docs
docs-build Build the docs
docs-open Open the docs in the browser
docs Generate, build and open the docs.
docs-build-test Test if the documentation can be built without errors.
docs-test Test if the documentation can be generated and built without errors.
```
39 changes: 0 additions & 39 deletions docs/features/makefile.rst

This file was deleted.

23 changes: 23 additions & 0 deletions docs/features/poetry.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
---
title: Poetry
---

The generated repository will uses [Poetry](https://python-Poetry.org/)
for its dependency management. When you have created your repository
using this cookiecutter template, a Poetry environment is pre-configured
in `pyproject.toml` and `Poetry.toml`. All you need to do is add your
project-specific dependencies with

``` bash
poetry add <package>
```

and then install the environment with

``` bash
make install
```

By default, the environment is created in a `.venv` folder, so you can
easily start an interactive shell within the environment with
`poetry shell`.
19 changes: 0 additions & 19 deletions docs/features/poetry.rst

This file was deleted.

Loading

0 comments on commit 6e1d398

Please sign in to comment.