From 41dc3927ff07c97c1112c027587f44b82f477a13 Mon Sep 17 00:00:00 2001 From: Sergey Shashkov Date: Mon, 13 Nov 2023 01:29:11 +0300 Subject: [PATCH] feat: mkdocs alfa version --- .github/workflows/docs.yml | 25 +++++++++++++++++++ .gitignore | 1 + docs/animation.md | 1 + docs/examples.md | 13 ++++++++++ docs/gradient.md | 4 +++ docs/index.md | 1 + docs/installation.md | 18 ++++++++++++++ docs/pt.md | 4 +++ mkdocs.yml | 50 ++++++++++++++++++++++++++++++++++++++ requirements-dev.txt | 2 ++ 10 files changed, 119 insertions(+) create mode 100644 .github/workflows/docs.yml create mode 100644 docs/animation.md create mode 100644 docs/examples.md create mode 100644 docs/gradient.md create mode 100644 docs/index.md create mode 100644 docs/installation.md create mode 100644 docs/pt.md create mode 100644 mkdocs.yml diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml new file mode 100644 index 0000000..585df9d --- /dev/null +++ b/.github/workflows/docs.yml @@ -0,0 +1,25 @@ +name: ci +on: + push: + branches: + - master + - main +permissions: + contents: write +jobs: + deploy: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v4 + with: + python-version: 3.x + - run: echo "cache_id=$(date --utc '+%V')" >> $GITHUB_ENV + - uses: actions/cache@v3 + with: + key: mkdocs-material-${{ env.cache_id }} + path: .cache + restore-keys: | + mkdocs-material- + - run: pip install mkdocs-material mkdocstrings-python + - run: mkdocs gh-deploy --force diff --git a/.gitignore b/.gitignore index 371dcf9..a444601 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,4 @@ venv/ /**/.idea/ *egg-info* .coverage +site/ diff --git a/docs/animation.md b/docs/animation.md new file mode 100644 index 0000000..fe2fc98 --- /dev/null +++ b/docs/animation.md @@ -0,0 +1 @@ +# DrawZero animations diff --git a/docs/examples.md b/docs/examples.md new file mode 100644 index 0000000..5d79cfe --- /dev/null +++ b/docs/examples.md @@ -0,0 +1,13 @@ +# DrawZero examples + + +![00_hello_world](ex_00.png) +``` title="00_hello_world.py" +--8<-- "src/drawzero/examples/00_hello_world.py" +``` + + +![01_grid_and_coordinates](ex_01.png) +``` title="01_grid_and_coordinates.py" +--8<-- "src/drawzero/examples/01_grid_and_coordinates.py" +``` diff --git a/docs/gradient.md b/docs/gradient.md new file mode 100644 index 0000000..ce8b5be --- /dev/null +++ b/docs/gradient.md @@ -0,0 +1,4 @@ +::: drawzero.utils.gradient + options: + show_bases: false + show_source: true diff --git a/docs/index.md b/docs/index.md new file mode 100644 index 0000000..da9c452 --- /dev/null +++ b/docs/index.md @@ -0,0 +1 @@ +# DrawZero diff --git a/docs/installation.md b/docs/installation.md new file mode 100644 index 0000000..4df7e90 --- /dev/null +++ b/docs/installation.md @@ -0,0 +1,18 @@ +# Installation + +In a Terminal window, type: +```shell +pip install drawzero --upgrade --user +``` + + +Or run the following program: + +```python +import os, sys +python = sys.executable +user = '--user' if 'venv' not in python and 'virtualenvs' not in python else '' +cmd = f'"{python}" -m pip install drawzero --upgrade {user}' +os.system(cmd) +from drawzero import * +``` diff --git a/docs/pt.md b/docs/pt.md new file mode 100644 index 0000000..590dc11 --- /dev/null +++ b/docs/pt.md @@ -0,0 +1,4 @@ +::: drawzero.utils.pt + options: + show_bases: false + show_source: true diff --git a/mkdocs.yml b/mkdocs.yml new file mode 100644 index 0000000..eabbb95 --- /dev/null +++ b/mkdocs.yml @@ -0,0 +1,50 @@ +site_name: DrawZero — zero boilerplate canvas drawing and animation +site_url: https://drawzero.ru +repo_url: https://github.com/ShashkovS/drawzero + +nav: + - DrawZero: index.md + - Installation: installation.md + - Examples: examples.md + - Animations: animation.md + - Code Reference: + - Pt: pt.md + - Gradient: gradient.md + +theme: + name: material + highlightjs: true + language: ru + features: + - navigation.instant + - navigation.instant.prefetch + - navigation.tracking + - navigation.expand + - navigation.path + - toc.follow + - navigation.top + - search.suggest + - search.highlight + +extra: + alternate: + - name: English + link: /en/ + homepage: https://drawzero.ru + +plugins: + - search: + lang: + - ru + - en + - mkdocstrings: + default_handler: python + +markdown_extensions: + - pymdownx.snippets + - pymdownx.highlight: + use_pygments: true + - pymdownx.superfences + +watch: + - src diff --git a/requirements-dev.txt b/requirements-dev.txt index 8895010..ef8a312 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -2,3 +2,5 @@ pytest coverage wheel twine +mkdocs-material +mkdocstrings-python