From f947ae629e112c312c9d6971e5dabc2682e9a6e7 Mon Sep 17 00:00:00 2001 From: Jusong Yu Date: Tue, 5 Dec 2023 14:50:09 +0100 Subject: [PATCH 1/2] Add docs for the cutter --- hooks/post_gen_project.py | 5 +++++ {{cookiecutter.repo_name}}/.readthedocs.yml | 19 +++++++++++++++++++ .../docs/development.md | 3 +++ {{cookiecutter.repo_name}}/docs/index.md | 16 ++++++++++++++++ .../docs/requirements.txt | 1 + {{cookiecutter.repo_name}}/docs/tutorial.md | 3 +++ {{cookiecutter.repo_name}}/mkdocs.yml | 9 +++++++++ 7 files changed, 56 insertions(+) create mode 100644 {{cookiecutter.repo_name}}/.readthedocs.yml create mode 100644 {{cookiecutter.repo_name}}/docs/development.md create mode 100644 {{cookiecutter.repo_name}}/docs/index.md create mode 100644 {{cookiecutter.repo_name}}/docs/requirements.txt create mode 100644 {{cookiecutter.repo_name}}/docs/tutorial.md create mode 100644 {{cookiecutter.repo_name}}/mkdocs.yml diff --git a/hooks/post_gen_project.py b/hooks/post_gen_project.py index 688c8b7..c642523 100644 --- a/hooks/post_gen_project.py +++ b/hooks/post_gen_project.py @@ -32,5 +32,10 @@ https://aiidalab.readthedocs.io/en/latest/app_development/publish.html +6. Import your repository to readthedocs.org to automatically build and publish your documentation, with the following instructions: + + https://readthedocs.org/dashboard/import/ for the import of your repository. + https://docs.readthedocs.io/en/stable/pull-requests.html for the configuration of pull request previews. + """ ) diff --git a/{{cookiecutter.repo_name}}/.readthedocs.yml b/{{cookiecutter.repo_name}}/.readthedocs.yml new file mode 100644 index 0000000..1d31d6e --- /dev/null +++ b/{{cookiecutter.repo_name}}/.readthedocs.yml @@ -0,0 +1,19 @@ +# Read the Docs configuration file for MkDocs projects +# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details + +# Required +version: 2 + +# Set the version of Python and other tools you might need +build: + os: ubuntu-22.04 + tools: + python: "3.11" + +mkdocs: + configuration: mkdocs.yml + +# Optionally declare the Python requirements required to build your docs +python: + install: + - requirements: docs/requirements.txt \ No newline at end of file diff --git a/{{cookiecutter.repo_name}}/docs/development.md b/{{cookiecutter.repo_name}}/docs/development.md new file mode 100644 index 0000000..25bf89f --- /dev/null +++ b/{{cookiecutter.repo_name}}/docs/development.md @@ -0,0 +1,3 @@ +# Development + +Here may go a few notes on how to contribute the development of the app. \ No newline at end of file diff --git a/{{cookiecutter.repo_name}}/docs/index.md b/{{cookiecutter.repo_name}}/docs/index.md new file mode 100644 index 0000000..0176583 --- /dev/null +++ b/{{cookiecutter.repo_name}}/docs/index.md @@ -0,0 +1,16 @@ +# Introduction + +This is the documentation for the `{{cookiecutter.repo_name}}` app. +{{ cookiecutter.short_description }} + +## Quick start + +To access the app, you should open AiiDAlab platform first by either: + +- Log into one of the [open AiiDAlab servers](https://www.aiidalab.net/deployments/). +- Run the AiiDAlab docker container directly [on your local machine](https://aiidalab.readthedocs.io/en/latest/usage/index.html#usage-run-locally). + +Once you are in the AiiDAlab platform, you can find the app in the App Store. +[Install it and launch it from there](https://aiidalab.readthedocs.io/en/latest/usage/index.html#install-a-new-app). + +Here may go with a few examples of how to use the app. \ No newline at end of file diff --git a/{{cookiecutter.repo_name}}/docs/requirements.txt b/{{cookiecutter.repo_name}}/docs/requirements.txt new file mode 100644 index 0000000..c10afc8 --- /dev/null +++ b/{{cookiecutter.repo_name}}/docs/requirements.txt @@ -0,0 +1 @@ +mkdocs-material~=9 \ No newline at end of file diff --git a/{{cookiecutter.repo_name}}/docs/tutorial.md b/{{cookiecutter.repo_name}}/docs/tutorial.md new file mode 100644 index 0000000..b8ddffe --- /dev/null +++ b/{{cookiecutter.repo_name}}/docs/tutorial.md @@ -0,0 +1,3 @@ +# Tutorial + +Here may go a few notes on how to use the app. \ No newline at end of file diff --git a/{{cookiecutter.repo_name}}/mkdocs.yml b/{{cookiecutter.repo_name}}/mkdocs.yml new file mode 100644 index 0000000..771de96 --- /dev/null +++ b/{{cookiecutter.repo_name}}/mkdocs.yml @@ -0,0 +1,9 @@ +site_name: Pseudopotential optimization +nav: + - Home: index.md + - Tutorial: tutorial.md + - Development: development.md +theme: + name: material +markdown_extensions: + - footnotes \ No newline at end of file From 527002645e9e17992f5b79129cccfd09b737cac3 Mon Sep 17 00:00:00 2001 From: Jusong Yu Date: Tue, 5 Dec 2023 14:57:22 +0100 Subject: [PATCH 2/2] pre-commit config for cutter repo itself --- .pre-commit-config.yaml | 9 +++++++++ hooks/post_gen_project.py | 2 +- ruff.toml | 19 +++++++++++++++++++ .../.pre-commit-config.yaml | 19 ++++++++----------- {{cookiecutter.repo_name}}/__init__.py | 1 + {{cookiecutter.repo_name}}/ruff.toml | 19 +++++++++++++++++++ 6 files changed, 57 insertions(+), 12 deletions(-) create mode 100644 .pre-commit-config.yaml create mode 100644 ruff.toml create mode 100644 {{cookiecutter.repo_name}}/ruff.toml diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..704b21f --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,9 @@ +repos: +- repo: https://github.com/astral-sh/ruff-pre-commit + # Ruff version. + rev: v0.1.4 + hooks: + # Run the linter. + - id: ruff + # Run the formatter. + - id: ruff-format diff --git a/hooks/post_gen_project.py b/hooks/post_gen_project.py index c642523..1e65845 100644 --- a/hooks/post_gen_project.py +++ b/hooks/post_gen_project.py @@ -1,4 +1,4 @@ -# -*- coding: utf-8 -*- +"""Post-generate hook to be run after project generation.""" print( """ diff --git a/ruff.toml b/ruff.toml new file mode 100644 index 0000000..9f4ca3d --- /dev/null +++ b/ruff.toml @@ -0,0 +1,19 @@ +target-version = "py39" + +[lint] +extend-select = [ + "UP", # pyupgrade + "D", # pydocstyle +] + +ignore = [ + "UP009", + "D205", + "D212", + "D415", + "D100", + "D103", +] + +[lint.pydocstyle] +convention = "google" \ No newline at end of file diff --git a/{{cookiecutter.repo_name}}/.pre-commit-config.yaml b/{{cookiecutter.repo_name}}/.pre-commit-config.yaml index 8893347..704b21f 100644 --- a/{{cookiecutter.repo_name}}/.pre-commit-config.yaml +++ b/{{cookiecutter.repo_name}}/.pre-commit-config.yaml @@ -1,12 +1,9 @@ repos: - - repo: https://github.com/psf/black - rev: 20.8b1 - hooks: - - id: black - language_version: python3 # Should be a command that runs python3.6+ - - - repo: https://gitlab.com/pycqa/flake8 - rev: '3.8.4' - hooks: - - id: flake8 - args: [--count, --show-source, --statistics] +- repo: https://github.com/astral-sh/ruff-pre-commit + # Ruff version. + rev: v0.1.4 + hooks: + # Run the linter. + - id: ruff + # Run the formatter. + - id: ruff-format diff --git a/{{cookiecutter.repo_name}}/__init__.py b/{{cookiecutter.repo_name}}/__init__.py index 640a604..39522bd 100644 --- a/{{cookiecutter.repo_name}}/__init__.py +++ b/{{cookiecutter.repo_name}}/__init__.py @@ -1,4 +1,5 @@ # -*- coding: utf-8 -*- + """ {{cookiecutter.app_title}} {{cookiecutter.repo_name}} diff --git a/{{cookiecutter.repo_name}}/ruff.toml b/{{cookiecutter.repo_name}}/ruff.toml new file mode 100644 index 0000000..9f4ca3d --- /dev/null +++ b/{{cookiecutter.repo_name}}/ruff.toml @@ -0,0 +1,19 @@ +target-version = "py39" + +[lint] +extend-select = [ + "UP", # pyupgrade + "D", # pydocstyle +] + +ignore = [ + "UP009", + "D205", + "D212", + "D415", + "D100", + "D103", +] + +[lint.pydocstyle] +convention = "google" \ No newline at end of file