From 9132c3cd1c1712945730b600e60c1cde307b351e Mon Sep 17 00:00:00 2001 From: Corey Oordt Date: Fri, 3 May 2024 09:47:07 -0500 Subject: [PATCH 01/13] Fixed cookiecutter update incompatibilities - fixed version to 2.6.0 - fixed outdated requirements management --- .pre-commit-config.yaml | 12 +- cookie_composer/layers.py | 2 +- cookie_composer/templates/zipfile_repo.py | 3 +- cookie_composer/utils.py | 4 +- pyproject.toml | 27 +- requirements.txt | 1 - requirements/dev.txt | 317 ---------------------- requirements/docs.txt | 224 --------------- requirements/prod.txt | 130 --------- requirements/test.txt | 176 ------------ 10 files changed, 28 insertions(+), 868 deletions(-) delete mode 100644 requirements.txt delete mode 100644 requirements/dev.txt delete mode 100644 requirements/docs.txt delete mode 100644 requirements/prod.txt delete mode 100644 requirements/test.txt diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index f76317b..c50f0f6 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,17 +1,17 @@ repos: - repo: https://github.com/astral-sh/ruff-pre-commit # Ruff version. - rev: 'v0.2.0' + rev: 'v0.4.2' hooks: - id: ruff args: [--fix, --exit-non-zero-on-fix] exclude: test.* - repo: https://github.com/psf/black - rev: 24.1.1 + rev: 24.4.2 hooks: - id: black - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.5.0 + rev: v4.6.0 hooks: - id: check-added-large-files - id: check-case-conflict @@ -36,20 +36,20 @@ repos: - id: fix-encoding-pragma args: ["--remove"] - repo: https://github.com/pre-commit/mirrors-mypy - rev: v1.8.0 + rev: v1.10.0 hooks: - id: mypy exclude: test.* args: [--no-strict-optional, --ignore-missing-imports] additional_dependencies: ["pydantic", "toml", "types-all"] - repo: https://github.com/jsh9/pydoclint - rev: 0.3.9 + rev: 0.4.1 hooks: - id: pydoclint args: - "--config=pyproject.toml" - repo: https://github.com/econchick/interrogate - rev: 1.5.0 # or master if you're bold + rev: 1.7.0 # or master if you're bold hooks: - id: interrogate exclude: test.* diff --git a/cookie_composer/layers.py b/cookie_composer/layers.py index 9aa0e18..ee31e14 100644 --- a/cookie_composer/layers.py +++ b/cookie_composer/layers.py @@ -222,9 +222,9 @@ def get_template_rendered_name(template: Template, context: MutableMapping) -> s """Find and render the template's root directory's name.""" from cookiecutter.find import find_template - template_dir = find_template(template.cached_path) envvars = context.get("cookiecutter", {}).get("_jinja2_env_vars", {}) env = CustomStrictEnvironment(context=context, keep_trailing_newline=True, **envvars) + template_dir = find_template(template.cached_path, env) name_tmpl = env.from_string(template_dir.name) return name_tmpl.render(**context) diff --git a/cookie_composer/templates/zipfile_repo.py b/cookie_composer/templates/zipfile_repo.py index 411b935..f577b8e 100644 --- a/cookie_composer/templates/zipfile_repo.py +++ b/cookie_composer/templates/zipfile_repo.py @@ -7,7 +7,8 @@ from zipfile import BadZipFile, ZipFile import requests -from cookiecutter.utils import make_sure_path_exists, prompt_and_delete +from cookiecutter.prompt import prompt_and_delete +from cookiecutter.utils import make_sure_path_exists from cookie_composer.exceptions import ( EmptyZipRepositoryError, diff --git a/cookie_composer/utils.py b/cookie_composer/utils.py index bfdd933..9ec82b1 100644 --- a/cookie_composer/utils.py +++ b/cookie_composer/utils.py @@ -100,7 +100,7 @@ def remove_single_path(path: Path) -> None: if path.is_dir(): try: rmtree(path, ignore_errors=False, onerror=remove_readonly_bit) - except Exception as e: # noqa: BLE001 pragma: no-coverage + except Exception as e: # pragma: no-coverage raise IOError("Failed to remove directory.") from e elif path.is_file(): try: @@ -108,7 +108,7 @@ def remove_single_path(path: Path) -> None: except PermissionError: # pragma: no-coverage path.chmod(stat.S_IWRITE) path.unlink() - except Exception as exc: # noqa: BLE001 pragma: no-coverage + except Exception as exc: # pragma: no-coverage raise IOError("Failed to remove file.") from exc diff --git a/pyproject.toml b/pyproject.toml index 04bda94..4fb502d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -21,7 +21,7 @@ classifiers = [ ] dependencies = [ "click-log", - "cookiecutter>=2.4.0", + "cookiecutter==2.6.0", "fsspec[http]", "ghapi", "gitpython>=3.1.37", @@ -50,15 +50,22 @@ dev = [ "pip-tools", ] docs = [ - "astroid<3.0.0", # astroid 3.0.0 breaks sphinx-autodoc2 0.4.2 - "ghp-import", - "linkify-it-py", - "myst-parser", - "Sphinx>=7.2.0", - "sphinx-autodoc2", - "sphinx-click", - "sphinx-copybutton", - "sphinx-material", + "black", + "markdown-customblocks", + "mdx-truly-sane-lists", + "mkdocs", + "mkdocs-click", + "mkdocs-drawio", + "mkdocs-gen-files", + "mkdocs-git-authors-plugin", + "mkdocs-git-committers-plugin", + "mkdocs-git-revision-date-localized-plugin", + "mkdocs-include-markdown-plugin", + "mkdocs-literate-nav", + "mkdocs-material", + "mkdocstrings[python]", + "python-frontmatter", + "pyyaml", ] test = [ "coverage>=6.1.2", diff --git a/requirements.txt b/requirements.txt deleted file mode 100644 index 5eaadb8..0000000 --- a/requirements.txt +++ /dev/null @@ -1 +0,0 @@ --r requirements/prod.txt diff --git a/requirements/dev.txt b/requirements/dev.txt deleted file mode 100644 index 758d8fb..0000000 --- a/requirements/dev.txt +++ /dev/null @@ -1,317 +0,0 @@ -# -# This file is autogenerated by pip-compile with Python 3.10 -# by the following command: -# -# pip-compile --extra=dev --extra=docs --extra=test --output-file=requirements/dev.txt pyproject.toml -# -aiohttp==3.9.2 - # via fsspec -aiosignal==1.3.1 - # via aiohttp -alabaster==0.7.13 - # via sphinx -annotated-types==0.6.0 - # via pydantic -argopt==0.8.2 - # via git-fame -arrow==1.3.0 - # via cookiecutter -astroid==2.15.8 - # via - # cookie-composer (pyproject.toml) - # sphinx-autodoc2 -async-timeout==4.0.3 - # via aiohttp -attrs==23.1.0 - # via aiohttp -babel==2.13.0 - # via sphinx -beautifulsoup4==4.12.2 - # via sphinx-material -binaryornot==0.4.4 - # via cookiecutter -build==1.0.3 - # via pip-tools -bump-my-version==0.11.0 - # via cookie-composer (pyproject.toml) -certifi==2023.7.22 - # via requests -cfgv==3.4.0 - # via pre-commit -chardet==5.2.0 - # via binaryornot -charset-normalizer==3.3.0 - # via - # aiohttp - # requests -click==8.1.7 - # via - # bump-my-version - # click-log - # cookiecutter - # pip-tools - # rich-click - # sphinx-click - # typer -click-log==0.4.0 - # via cookie-composer (pyproject.toml) -cookiecutter==2.4.0 - # via cookie-composer (pyproject.toml) -coverage[toml]==7.3.2 - # via - # cookie-composer (pyproject.toml) - # pytest-cov -css-html-js-minify==2.5.5 - # via sphinx-material -distlib==0.3.7 - # via virtualenv -docutils==0.20.1 - # via - # myst-parser - # sphinx - # sphinx-click -exceptiongroup==1.1.3 - # via pytest -fastcore==1.5.29 - # via ghapi -filelock==3.12.4 - # via virtualenv -frozenlist==1.4.0 - # via - # aiohttp - # aiosignal -fsspec[http]==2023.9.2 - # via cookie-composer (pyproject.toml) -generate-changelog==0.9.2 - # via cookie-composer (pyproject.toml) -ghapi==1.0.4 - # via cookie-composer (pyproject.toml) -ghp-import==2.1.0 - # via cookie-composer (pyproject.toml) -git-fame==2.0.1 - # via cookie-composer (pyproject.toml) -gitdb==4.0.11 - # via gitpython -gitpython==3.1.41 - # via - # cookie-composer (pyproject.toml) - # generate-changelog -identify==2.5.30 - # via pre-commit -idna==3.4 - # via - # requests - # yarl -imagesize==1.4.1 - # via sphinx -immutabledict==3.0.0 - # via cookie-composer (pyproject.toml) -iniconfig==2.0.0 - # via pytest -jinja2==3.1.3 - # via - # cookiecutter - # generate-changelog - # myst-parser - # sphinx -lazy-object-proxy==1.9.0 - # via astroid -linkify-it-py==2.0.2 - # via cookie-composer (pyproject.toml) -lxml==4.9.3 - # via sphinx-material -markdown-it-py==3.0.0 - # via - # mdit-py-plugins - # myst-parser - # rich -markupsafe==2.1.3 - # via jinja2 -mdit-py-plugins==0.4.0 - # via myst-parser -mdurl==0.1.2 - # via markdown-it-py -more-itertools==10.1.0 - # via generate-changelog -multidict==6.0.4 - # via - # aiohttp - # yarl -myst-parser==2.0.0 - # via cookie-composer (pyproject.toml) -nodeenv==1.8.0 - # via pre-commit -orjson==3.9.9 - # via cookie-composer (pyproject.toml) -packaging==23.2 - # via - # build - # fastcore - # ghapi - # pytest - # sphinx -pip-tools==7.3.0 - # via cookie-composer (pyproject.toml) -platformdirs==3.11.0 - # via virtualenv -pluggy==1.3.0 - # via pytest -pre-commit==3.5.0 - # via cookie-composer (pyproject.toml) -prompt-toolkit==3.0.36 - # via questionary -pydantic==2.4.2 - # via - # bump-my-version - # cookie-composer (pyproject.toml) - # pydantic-settings -pydantic-core==2.10.1 - # via pydantic -pydantic-settings==2.0.3 - # via bump-my-version -pygments==2.16.1 - # via - # rich - # sphinx -pyproject-hooks==1.0.0 - # via build -pytest==7.4.2 - # via - # cookie-composer (pyproject.toml) - # pytest-cov - # pytest-env - # pytest-mock -pytest-cov==4.1.0 - # via cookie-composer (pyproject.toml) -pytest-env==1.0.1 - # via cookie-composer (pyproject.toml) -pytest-mock==3.12.0 - # via cookie-composer (pyproject.toml) -python-dateutil==2.8.2 - # via - # arrow - # ghp-import -python-dotenv==1.0.0 - # via pydantic-settings -python-slugify[unidecode]==8.0.1 - # via - # cookiecutter - # sphinx-material -pyyaml==6.0.1 - # via - # cookiecutter - # myst-parser - # pre-commit -questionary==2.0.1 - # via cookie-composer (pyproject.toml) -requests==2.31.0 - # via - # cookie-composer (pyproject.toml) - # cookiecutter - # fsspec - # sphinx -rich==13.6.0 - # via - # bump-my-version - # cookiecutter - # rich-click -rich-click==1.7.0 - # via - # bump-my-version - # cookie-composer (pyproject.toml) -ruamel-yaml==0.17.40 - # via - # cookie-composer (pyproject.toml) - # generate-changelog -ruamel-yaml-clib==0.2.8 - # via ruamel-yaml -six==1.16.0 - # via python-dateutil -smmap==5.0.1 - # via gitdb -snowballstemmer==2.2.0 - # via sphinx -soupsieve==2.5 - # via beautifulsoup4 -sphinx==7.2.6 - # via - # cookie-composer (pyproject.toml) - # myst-parser - # sphinx-click - # sphinx-copybutton - # sphinx-material - # sphinxcontrib-applehelp - # sphinxcontrib-devhelp - # sphinxcontrib-htmlhelp - # sphinxcontrib-qthelp - # sphinxcontrib-serializinghtml -sphinx-autodoc2==0.4.2 - # via cookie-composer (pyproject.toml) -sphinx-click==5.0.1 - # via cookie-composer (pyproject.toml) -sphinx-copybutton==0.5.2 - # via cookie-composer (pyproject.toml) -sphinx-material==0.0.36 - # via cookie-composer (pyproject.toml) -sphinxcontrib-applehelp==1.0.7 - # via sphinx -sphinxcontrib-devhelp==1.0.5 - # via sphinx -sphinxcontrib-htmlhelp==2.0.4 - # via sphinx -sphinxcontrib-jsmath==1.0.1 - # via sphinx -sphinxcontrib-qthelp==1.0.6 - # via sphinx -sphinxcontrib-serializinghtml==1.1.9 - # via sphinx -tabulate==0.9.0 - # via git-fame -text-unidecode==1.3 - # via python-slugify -toml==0.10.2 - # via cookie-composer (pyproject.toml) -tomli==2.0.1 - # via - # build - # coverage - # pip-tools - # pyproject-hooks - # pytest - # sphinx-autodoc2 -tomlkit==0.12.1 - # via bump-my-version -tqdm==4.66.1 - # via git-fame -typer==0.9.0 - # via generate-changelog -types-python-dateutil==2.8.19.14 - # via arrow -typing-extensions==4.8.0 - # via - # astroid - # pydantic - # pydantic-core - # rich-click - # sphinx-autodoc2 - # typer -uc-micro-py==1.0.2 - # via linkify-it-py -unidecode==1.3.7 - # via python-slugify -urllib3==2.0.7 - # via requests -virtualenv==20.24.5 - # via pre-commit -wcwidth==0.2.8 - # via prompt-toolkit -wheel==0.41.2 - # via pip-tools -wrapt==1.15.0 - # via astroid -yarl==1.9.2 - # via aiohttp - -# The following packages are considered to be unsafe in a requirements file: -# pip -# setuptools diff --git a/requirements/docs.txt b/requirements/docs.txt deleted file mode 100644 index 963b65e..0000000 --- a/requirements/docs.txt +++ /dev/null @@ -1,224 +0,0 @@ -# -# This file is autogenerated by pip-compile with Python 3.10 -# by the following command: -# -# pip-compile --extra=docs --output-file=requirements/docs.txt pyproject.toml -# -aiohttp==3.9.2 - # via fsspec -aiosignal==1.3.1 - # via aiohttp -alabaster==0.7.13 - # via sphinx -annotated-types==0.6.0 - # via pydantic -arrow==1.3.0 - # via cookiecutter -astroid==2.15.8 - # via - # cookie-composer (pyproject.toml) - # sphinx-autodoc2 -async-timeout==4.0.3 - # via aiohttp -attrs==23.1.0 - # via aiohttp -babel==2.13.0 - # via sphinx -beautifulsoup4==4.12.2 - # via sphinx-material -binaryornot==0.4.4 - # via cookiecutter -certifi==2023.7.22 - # via requests -chardet==5.2.0 - # via binaryornot -charset-normalizer==3.3.0 - # via - # aiohttp - # requests -click==8.1.7 - # via - # click-log - # cookiecutter - # rich-click - # sphinx-click -click-log==0.4.0 - # via cookie-composer (pyproject.toml) -cookiecutter==2.4.0 - # via cookie-composer (pyproject.toml) -css-html-js-minify==2.5.5 - # via sphinx-material -docutils==0.20.1 - # via - # myst-parser - # sphinx - # sphinx-click -fastcore==1.5.29 - # via ghapi -frozenlist==1.4.0 - # via - # aiohttp - # aiosignal -fsspec[http]==2023.9.2 - # via cookie-composer (pyproject.toml) -ghapi==1.0.4 - # via cookie-composer (pyproject.toml) -ghp-import==2.1.0 - # via cookie-composer (pyproject.toml) -gitdb==4.0.11 - # via gitpython -gitpython==3.1.41 - # via cookie-composer (pyproject.toml) -idna==3.4 - # via - # requests - # yarl -imagesize==1.4.1 - # via sphinx -immutabledict==3.0.0 - # via cookie-composer (pyproject.toml) -jinja2==3.1.3 - # via - # cookiecutter - # myst-parser - # sphinx -lazy-object-proxy==1.9.0 - # via astroid -linkify-it-py==2.0.2 - # via cookie-composer (pyproject.toml) -lxml==4.9.3 - # via sphinx-material -markdown-it-py==3.0.0 - # via - # mdit-py-plugins - # myst-parser - # rich -markupsafe==2.1.3 - # via jinja2 -mdit-py-plugins==0.4.0 - # via myst-parser -mdurl==0.1.2 - # via markdown-it-py -multidict==6.0.4 - # via - # aiohttp - # yarl -myst-parser==2.0.0 - # via cookie-composer (pyproject.toml) -orjson==3.9.9 - # via cookie-composer (pyproject.toml) -packaging==23.2 - # via - # fastcore - # ghapi - # sphinx -prompt-toolkit==3.0.36 - # via questionary -pydantic==2.4.2 - # via cookie-composer (pyproject.toml) -pydantic-core==2.10.1 - # via pydantic -pygments==2.16.1 - # via - # rich - # sphinx -python-dateutil==2.8.2 - # via - # arrow - # ghp-import -python-slugify[unidecode]==8.0.1 - # via - # cookiecutter - # sphinx-material -pyyaml==6.0.1 - # via - # cookiecutter - # myst-parser -questionary==2.0.1 - # via cookie-composer (pyproject.toml) -requests==2.31.0 - # via - # cookie-composer (pyproject.toml) - # cookiecutter - # fsspec - # sphinx -rich==13.6.0 - # via - # cookiecutter - # rich-click -rich-click==1.7.0 - # via cookie-composer (pyproject.toml) -ruamel-yaml==0.17.40 - # via cookie-composer (pyproject.toml) -ruamel-yaml-clib==0.2.8 - # via ruamel-yaml -six==1.16.0 - # via python-dateutil -smmap==5.0.1 - # via gitdb -snowballstemmer==2.2.0 - # via sphinx -soupsieve==2.5 - # via beautifulsoup4 -sphinx==7.2.6 - # via - # cookie-composer (pyproject.toml) - # myst-parser - # sphinx-click - # sphinx-copybutton - # sphinx-material - # sphinxcontrib-applehelp - # sphinxcontrib-devhelp - # sphinxcontrib-htmlhelp - # sphinxcontrib-qthelp - # sphinxcontrib-serializinghtml -sphinx-autodoc2==0.4.2 - # via cookie-composer (pyproject.toml) -sphinx-click==5.0.1 - # via cookie-composer (pyproject.toml) -sphinx-copybutton==0.5.2 - # via cookie-composer (pyproject.toml) -sphinx-material==0.0.36 - # via cookie-composer (pyproject.toml) -sphinxcontrib-applehelp==1.0.7 - # via sphinx -sphinxcontrib-devhelp==1.0.5 - # via sphinx -sphinxcontrib-htmlhelp==2.0.4 - # via sphinx -sphinxcontrib-jsmath==1.0.1 - # via sphinx -sphinxcontrib-qthelp==1.0.6 - # via sphinx -sphinxcontrib-serializinghtml==1.1.9 - # via sphinx -text-unidecode==1.3 - # via python-slugify -toml==0.10.2 - # via cookie-composer (pyproject.toml) -tomli==2.0.1 - # via sphinx-autodoc2 -types-python-dateutil==2.8.19.14 - # via arrow -typing-extensions==4.8.0 - # via - # astroid - # pydantic - # pydantic-core - # rich-click - # sphinx-autodoc2 -uc-micro-py==1.0.2 - # via linkify-it-py -unidecode==1.3.7 - # via python-slugify -urllib3==2.0.7 - # via requests -wcwidth==0.2.8 - # via prompt-toolkit -wrapt==1.15.0 - # via astroid -yarl==1.9.2 - # via aiohttp - -# The following packages are considered to be unsafe in a requirements file: -# pip diff --git a/requirements/prod.txt b/requirements/prod.txt deleted file mode 100644 index 4f1f6cb..0000000 --- a/requirements/prod.txt +++ /dev/null @@ -1,130 +0,0 @@ -# -# This file is autogenerated by pip-compile with Python 3.10 -# by the following command: -# -# pip-compile --output-file=requirements/prod.txt pyproject.toml -# -aiohttp==3.9.2 - # via fsspec -aiosignal==1.3.1 - # via aiohttp -annotated-types==0.6.0 - # via pydantic -arrow==1.3.0 - # via cookiecutter -async-timeout==4.0.3 - # via aiohttp -attrs==23.1.0 - # via aiohttp -binaryornot==0.4.4 - # via cookiecutter -certifi==2023.7.22 - # via requests -chardet==5.2.0 - # via binaryornot -charset-normalizer==3.3.0 - # via - # aiohttp - # requests -click==8.1.7 - # via - # click-log - # cookiecutter - # rich-click -click-log==0.4.0 - # via cookie-composer (pyproject.toml) -cookiecutter==2.4.0 - # via cookie-composer (pyproject.toml) -fastcore==1.5.29 - # via ghapi -frozenlist==1.4.0 - # via - # aiohttp - # aiosignal -fsspec[http]==2023.9.2 - # via cookie-composer (pyproject.toml) -ghapi==1.0.4 - # via cookie-composer (pyproject.toml) -gitdb==4.0.11 - # via gitpython -gitpython==3.1.41 - # via cookie-composer (pyproject.toml) -idna==3.4 - # via - # requests - # yarl -immutabledict==3.0.0 - # via cookie-composer (pyproject.toml) -jinja2==3.1.3 - # via cookiecutter -markdown-it-py==3.0.0 - # via rich -markupsafe==2.1.3 - # via jinja2 -mdurl==0.1.2 - # via markdown-it-py -multidict==6.0.4 - # via - # aiohttp - # yarl -orjson==3.9.9 - # via cookie-composer (pyproject.toml) -packaging==23.2 - # via - # fastcore - # ghapi -prompt-toolkit==3.0.36 - # via questionary -pydantic==2.4.2 - # via cookie-composer (pyproject.toml) -pydantic-core==2.10.1 - # via pydantic -pygments==2.16.1 - # via rich -python-dateutil==2.8.2 - # via arrow -python-slugify==8.0.1 - # via cookiecutter -pyyaml==6.0.1 - # via cookiecutter -questionary==2.0.1 - # via cookie-composer (pyproject.toml) -requests==2.31.0 - # via - # cookie-composer (pyproject.toml) - # cookiecutter - # fsspec -rich==13.6.0 - # via - # cookiecutter - # rich-click -rich-click==1.7.0 - # via cookie-composer (pyproject.toml) -ruamel-yaml==0.17.40 - # via cookie-composer (pyproject.toml) -ruamel-yaml-clib==0.2.8 - # via ruamel-yaml -six==1.16.0 - # via python-dateutil -smmap==5.0.1 - # via gitdb -text-unidecode==1.3 - # via python-slugify -toml==0.10.2 - # via cookie-composer (pyproject.toml) -types-python-dateutil==2.8.19.14 - # via arrow -typing-extensions==4.8.0 - # via - # pydantic - # pydantic-core - # rich-click -urllib3==2.0.7 - # via requests -wcwidth==0.2.8 - # via prompt-toolkit -yarl==1.9.2 - # via aiohttp - -# The following packages are considered to be unsafe in a requirements file: -# pip diff --git a/requirements/test.txt b/requirements/test.txt deleted file mode 100644 index fe35791..0000000 --- a/requirements/test.txt +++ /dev/null @@ -1,176 +0,0 @@ -# -# This file is autogenerated by pip-compile with Python 3.10 -# by the following command: -# -# pip-compile --extra=test --output-file=requirements/test.txt pyproject.toml -# -aiohttp==3.9.2 - # via fsspec -aiosignal==1.3.1 - # via aiohttp -annotated-types==0.6.0 - # via pydantic -arrow==1.3.0 - # via cookiecutter -async-timeout==4.0.3 - # via aiohttp -attrs==23.1.0 - # via aiohttp -binaryornot==0.4.4 - # via cookiecutter -certifi==2023.7.22 - # via requests -cfgv==3.4.0 - # via pre-commit -chardet==5.2.0 - # via binaryornot -charset-normalizer==3.3.0 - # via - # aiohttp - # requests -click==8.1.7 - # via - # click-log - # cookiecutter - # rich-click -click-log==0.4.0 - # via cookie-composer (pyproject.toml) -cookiecutter==2.4.0 - # via cookie-composer (pyproject.toml) -coverage[toml]==7.3.2 - # via - # cookie-composer (pyproject.toml) - # pytest-cov -distlib==0.3.7 - # via virtualenv -exceptiongroup==1.1.3 - # via pytest -fastcore==1.5.29 - # via ghapi -filelock==3.12.4 - # via virtualenv -frozenlist==1.4.0 - # via - # aiohttp - # aiosignal -fsspec[http]==2023.9.2 - # via cookie-composer (pyproject.toml) -ghapi==1.0.4 - # via cookie-composer (pyproject.toml) -gitdb==4.0.11 - # via gitpython -gitpython==3.1.41 - # via cookie-composer (pyproject.toml) -identify==2.5.30 - # via pre-commit -idna==3.4 - # via - # requests - # yarl -immutabledict==3.0.0 - # via cookie-composer (pyproject.toml) -iniconfig==2.0.0 - # via pytest -jinja2==3.1.3 - # via cookiecutter -markdown-it-py==3.0.0 - # via rich -markupsafe==2.1.3 - # via jinja2 -mdurl==0.1.2 - # via markdown-it-py -multidict==6.0.4 - # via - # aiohttp - # yarl -nodeenv==1.8.0 - # via pre-commit -orjson==3.9.9 - # via cookie-composer (pyproject.toml) -packaging==23.2 - # via - # fastcore - # ghapi - # pytest -platformdirs==3.11.0 - # via virtualenv -pluggy==1.3.0 - # via pytest -pre-commit==3.5.0 - # via cookie-composer (pyproject.toml) -prompt-toolkit==3.0.36 - # via questionary -pydantic==2.4.2 - # via cookie-composer (pyproject.toml) -pydantic-core==2.10.1 - # via pydantic -pygments==2.16.1 - # via rich -pytest==7.4.2 - # via - # cookie-composer (pyproject.toml) - # pytest-cov - # pytest-env - # pytest-mock -pytest-cov==4.1.0 - # via cookie-composer (pyproject.toml) -pytest-env==1.0.1 - # via cookie-composer (pyproject.toml) -pytest-mock==3.12.0 - # via cookie-composer (pyproject.toml) -python-dateutil==2.8.2 - # via arrow -python-slugify==8.0.1 - # via cookiecutter -pyyaml==6.0.1 - # via - # cookiecutter - # pre-commit -questionary==2.0.1 - # via cookie-composer (pyproject.toml) -requests==2.31.0 - # via - # cookie-composer (pyproject.toml) - # cookiecutter - # fsspec -rich==13.6.0 - # via - # cookiecutter - # rich-click -rich-click==1.7.0 - # via cookie-composer (pyproject.toml) -ruamel-yaml==0.17.40 - # via cookie-composer (pyproject.toml) -ruamel-yaml-clib==0.2.8 - # via ruamel-yaml -six==1.16.0 - # via python-dateutil -smmap==5.0.1 - # via gitdb -text-unidecode==1.3 - # via python-slugify -toml==0.10.2 - # via cookie-composer (pyproject.toml) -tomli==2.0.1 - # via - # coverage - # pytest -types-python-dateutil==2.8.19.14 - # via arrow -typing-extensions==4.8.0 - # via - # pydantic - # pydantic-core - # rich-click -urllib3==2.0.7 - # via requests -virtualenv==20.24.5 - # via pre-commit -wcwidth==0.2.8 - # via prompt-toolkit -yarl==1.9.2 - # via aiohttp - -# The following packages are considered to be unsafe in a requirements file: -# pip -# setuptools From b4e7b57a0709dfbf4d22e7f589252e39519b458b Mon Sep 17 00:00:00 2001 From: Corey Oordt Date: Sat, 4 May 2024 08:52:00 -0500 Subject: [PATCH 02/13] Migrated docs to use MkDocs --- .gitignore | 4 - .../_includes/example-composition.yaml | 0 .../_includes/interactive-create.txt | 0 .../_includes/rendered-composition.yaml | 0 .../_includes/tutorial-composition-1.yaml | 0 .../_includes/tutorial-composition-2.yaml | 0 .../_includes/tutorial-composition-3.yaml | 0 docs/assets/css/cards.css | 200 +++++++++++++ docs/assets/css/custom.css | 12 + docs/assets/css/field-list.css | 34 +++ docs/assets/css/mkdocstrings.css | 39 +++ .../assets}/img/authorize-composer.png | Bin .../assets}/img/authorize-done.png | Bin .../assets}/img/composer-logo.svg | 0 .../assets}/img/compositions.png | Bin .../assets}/img/device-activation.png | Bin .../_static => docs/assets}/img/layers.png | Bin .../assets}/img/sandwiches.png | Bin docs/changelog.md | 6 + docs/contributing.md | 6 + docs/gen_doc_stubs.py | 51 ++++ .../how-to/access-private-templates.md | 12 +- docs/how-to/index.md | 1 + docs/index.md | 8 + {docsrc => docs}/installation.md | 0 docs/reference/cli.md | 6 + .../topic-guides/composition-files.md | 25 +- docs/topic-guides/index.md | 1 + .../tutorial/composable-templates.md | 0 {docsrc => docs}/tutorial/compositions.md | 27 +- .../tutorial/incrementally-layering.md | 0 docs/tutorial/index.md | 1 + docsrc/Makefile | 20 -- docsrc/_static/css/custom.css | 11 - docsrc/_templates/autosummary/base.rst | 9 - docsrc/_templates/autosummary/class.rst | 11 - docsrc/_templates/autosummary/module.rst | 72 ----- docsrc/api.rst | 22 -- .../cookie_composer.authentication.rst | 61 ---- .../cookie_composer.cc_overrides.rst | 102 ------- .../cookie_composer/cookie_composer.cli.rst | 86 ------ .../cookie_composer.commands.add.rst | 46 --- .../cookie_composer.commands.authn.rst | 45 --- .../cookie_composer.commands.create.rst | 46 --- .../cookie_composer.commands.link.rst | 29 -- .../cookie_composer.commands.rst | 20 -- .../cookie_composer.commands.update.rst | 37 --- .../cookie_composer.composition.rst | 100 ------- .../cookie_composer.data_merge.rst | 147 ---------- .../cookie_composer/cookie_composer.diff.rst | 79 ----- .../cookie_composer.exceptions.rst | 101 ------- .../cookie_composer.git_commands.rst | 124 -------- .../cookie_composer/cookie_composer.io.rst | 141 --------- .../cookie_composer.layers.rst | 274 ------------------ .../cookie_composer.matching.rst | 37 --- .../cookie_composer.merge_files.ini_file.rst | 45 --- .../cookie_composer.merge_files.json_file.rst | 37 --- .../cookie_composer.merge_files.rst | 52 ---- .../cookie_composer.merge_files.toml_file.rst | 29 -- .../cookie_composer.merge_files.yaml_file.rst | 29 -- .../cookie_composer/cookie_composer.rst | 62 ---- .../cookie_composer.templates.git_repo.rst | 62 ---- .../cookie_composer.templates.rst | 19 -- .../cookie_composer.templates.source.rst | 45 --- .../cookie_composer.templates.types.rst | 221 -------------- ...cookie_composer.templates.zipfile_repo.rst | 61 ---- .../cookie_composer/cookie_composer.utils.rst | 69 ----- docsrc/apidocs/index.rst | 11 - docsrc/changelog.md | 2 - docsrc/cli.rst | 6 - docsrc/conf.py | 95 ------ docsrc/contributing.md | 2 - docsrc/how-to/index.md | 8 - docsrc/index.md | 27 -- docsrc/make.bat | 36 --- docsrc/topic-guides/index.md | 8 - docsrc/tutorial/index.md | 10 - mkdocs.yml | 117 ++++++++ .../python/material/docstring/attributes.html | 90 ++++++ .../python/material/docstring/parameters.html | 98 +++++++ .../python/material/docstring/raises.html | 72 +++++ .../python/material/docstring/returns.html | 94 ++++++ overrides/partials/comments.html | 51 ++++ 83 files changed, 905 insertions(+), 2606 deletions(-) rename {docsrc => docs}/_includes/example-composition.yaml (100%) rename {docsrc => docs}/_includes/interactive-create.txt (100%) rename {docsrc => docs}/_includes/rendered-composition.yaml (100%) rename {docsrc => docs}/_includes/tutorial-composition-1.yaml (100%) rename {docsrc => docs}/_includes/tutorial-composition-2.yaml (100%) rename {docsrc => docs}/_includes/tutorial-composition-3.yaml (100%) create mode 100644 docs/assets/css/cards.css create mode 100644 docs/assets/css/custom.css create mode 100644 docs/assets/css/field-list.css create mode 100644 docs/assets/css/mkdocstrings.css rename {docsrc/_static => docs/assets}/img/authorize-composer.png (100%) rename {docsrc/_static => docs/assets}/img/authorize-done.png (100%) rename {docsrc/_static => docs/assets}/img/composer-logo.svg (100%) rename {docsrc/_static => docs/assets}/img/compositions.png (100%) rename {docsrc/_static => docs/assets}/img/device-activation.png (100%) rename {docsrc/_static => docs/assets}/img/layers.png (100%) rename {docsrc/_static => docs/assets}/img/sandwiches.png (100%) create mode 100644 docs/changelog.md create mode 100644 docs/contributing.md create mode 100755 docs/gen_doc_stubs.py rename {docsrc => docs}/how-to/access-private-templates.md (85%) create mode 100644 docs/how-to/index.md create mode 100644 docs/index.md rename {docsrc => docs}/installation.md (100%) create mode 100644 docs/reference/cli.md rename {docsrc => docs}/topic-guides/composition-files.md (73%) create mode 100644 docs/topic-guides/index.md rename {docsrc => docs}/tutorial/composable-templates.md (100%) rename {docsrc => docs}/tutorial/compositions.md (90%) rename {docsrc => docs}/tutorial/incrementally-layering.md (100%) create mode 100644 docs/tutorial/index.md delete mode 100644 docsrc/Makefile delete mode 100644 docsrc/_static/css/custom.css delete mode 100644 docsrc/_templates/autosummary/base.rst delete mode 100644 docsrc/_templates/autosummary/class.rst delete mode 100644 docsrc/_templates/autosummary/module.rst delete mode 100644 docsrc/api.rst delete mode 100644 docsrc/apidocs/cookie_composer/cookie_composer.authentication.rst delete mode 100644 docsrc/apidocs/cookie_composer/cookie_composer.cc_overrides.rst delete mode 100644 docsrc/apidocs/cookie_composer/cookie_composer.cli.rst delete mode 100644 docsrc/apidocs/cookie_composer/cookie_composer.commands.add.rst delete mode 100644 docsrc/apidocs/cookie_composer/cookie_composer.commands.authn.rst delete mode 100644 docsrc/apidocs/cookie_composer/cookie_composer.commands.create.rst delete mode 100644 docsrc/apidocs/cookie_composer/cookie_composer.commands.link.rst delete mode 100644 docsrc/apidocs/cookie_composer/cookie_composer.commands.rst delete mode 100644 docsrc/apidocs/cookie_composer/cookie_composer.commands.update.rst delete mode 100644 docsrc/apidocs/cookie_composer/cookie_composer.composition.rst delete mode 100644 docsrc/apidocs/cookie_composer/cookie_composer.data_merge.rst delete mode 100644 docsrc/apidocs/cookie_composer/cookie_composer.diff.rst delete mode 100644 docsrc/apidocs/cookie_composer/cookie_composer.exceptions.rst delete mode 100644 docsrc/apidocs/cookie_composer/cookie_composer.git_commands.rst delete mode 100644 docsrc/apidocs/cookie_composer/cookie_composer.io.rst delete mode 100644 docsrc/apidocs/cookie_composer/cookie_composer.layers.rst delete mode 100644 docsrc/apidocs/cookie_composer/cookie_composer.matching.rst delete mode 100644 docsrc/apidocs/cookie_composer/cookie_composer.merge_files.ini_file.rst delete mode 100644 docsrc/apidocs/cookie_composer/cookie_composer.merge_files.json_file.rst delete mode 100644 docsrc/apidocs/cookie_composer/cookie_composer.merge_files.rst delete mode 100644 docsrc/apidocs/cookie_composer/cookie_composer.merge_files.toml_file.rst delete mode 100644 docsrc/apidocs/cookie_composer/cookie_composer.merge_files.yaml_file.rst delete mode 100644 docsrc/apidocs/cookie_composer/cookie_composer.rst delete mode 100644 docsrc/apidocs/cookie_composer/cookie_composer.templates.git_repo.rst delete mode 100644 docsrc/apidocs/cookie_composer/cookie_composer.templates.rst delete mode 100644 docsrc/apidocs/cookie_composer/cookie_composer.templates.source.rst delete mode 100644 docsrc/apidocs/cookie_composer/cookie_composer.templates.types.rst delete mode 100644 docsrc/apidocs/cookie_composer/cookie_composer.templates.zipfile_repo.rst delete mode 100644 docsrc/apidocs/cookie_composer/cookie_composer.utils.rst delete mode 100644 docsrc/apidocs/index.rst delete mode 100644 docsrc/changelog.md delete mode 100644 docsrc/cli.rst delete mode 100644 docsrc/conf.py delete mode 100644 docsrc/contributing.md delete mode 100644 docsrc/how-to/index.md delete mode 100644 docsrc/index.md delete mode 100644 docsrc/make.bat delete mode 100644 docsrc/topic-guides/index.md delete mode 100644 docsrc/tutorial/index.md create mode 100644 mkdocs.yml create mode 100644 overrides/mkdocstrings/python/material/docstring/attributes.html create mode 100644 overrides/mkdocstrings/python/material/docstring/parameters.html create mode 100644 overrides/mkdocstrings/python/material/docstring/raises.html create mode 100644 overrides/mkdocstrings/python/material/docstring/returns.html create mode 100644 overrides/partials/comments.html diff --git a/.gitignore b/.gitignore index 70f1629..a95eaf3 100644 --- a/.gitignore +++ b/.gitignore @@ -75,10 +75,6 @@ instance/ # Scrapy stuff: .scrapy -# Sphinx documentation -docsrc/_build/ -docs -docsrc/_autosummary # PyBuilder .pybuilder/ diff --git a/docsrc/_includes/example-composition.yaml b/docs/_includes/example-composition.yaml similarity index 100% rename from docsrc/_includes/example-composition.yaml rename to docs/_includes/example-composition.yaml diff --git a/docsrc/_includes/interactive-create.txt b/docs/_includes/interactive-create.txt similarity index 100% rename from docsrc/_includes/interactive-create.txt rename to docs/_includes/interactive-create.txt diff --git a/docsrc/_includes/rendered-composition.yaml b/docs/_includes/rendered-composition.yaml similarity index 100% rename from docsrc/_includes/rendered-composition.yaml rename to docs/_includes/rendered-composition.yaml diff --git a/docsrc/_includes/tutorial-composition-1.yaml b/docs/_includes/tutorial-composition-1.yaml similarity index 100% rename from docsrc/_includes/tutorial-composition-1.yaml rename to docs/_includes/tutorial-composition-1.yaml diff --git a/docsrc/_includes/tutorial-composition-2.yaml b/docs/_includes/tutorial-composition-2.yaml similarity index 100% rename from docsrc/_includes/tutorial-composition-2.yaml rename to docs/_includes/tutorial-composition-2.yaml diff --git a/docsrc/_includes/tutorial-composition-3.yaml b/docs/_includes/tutorial-composition-3.yaml similarity index 100% rename from docsrc/_includes/tutorial-composition-3.yaml rename to docs/_includes/tutorial-composition-3.yaml diff --git a/docs/assets/css/cards.css b/docs/assets/css/cards.css new file mode 100644 index 0000000..95d2e5c --- /dev/null +++ b/docs/assets/css/cards.css @@ -0,0 +1,200 @@ +/************* + Grid Modification +*/ + +.md-typeset .grid.wide-gap { + gap: 1rem; +} + +/************* + Cards +*/ +.card-container { + background-color: white; + color: rgba(0, 0, 0, 0.87); + border-radius: 4px; + box-shadow: rgba(0, 0, 0, 0.2) 0 2px 1px -1px, rgba(0, 0, 0, 0.14) 0 1px 1px 0, rgba(0, 0, 0, 0.12) 0 1px 3px 0; + overflow: hidden; +} + +.card-container.depth-0 { + box-shadow: none; +} + +/************* + Cards - Header +*/ + +.card-header { + padding: 16px 16px 24px; + background: var(--md-primary-fg-color); + color: var(--md-primary-bg-color); +} + +.card-header.backstage-green { + background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' width='1368' height='400' fill='none'%3e%3cmask id='a' width='1368' height='401' x='0' y='0' maskUnits='userSpaceOnUse'%3e%3cpath fill='url(%23paint0_linear)' d='M437 116C223 116 112 0 112 0h1256v400c-82 0-225-21-282-109-112-175-436-175-649-175z'/%3e%3cpath fill='url(%23paint1_linear)' d='M1368 400V282C891-29 788 40 711 161 608 324 121 372 0 361v39h1368z'/%3e%3cpath fill='url(%23paint2_linear)' d='M1368 244v156H0V94c92-24 198-46 375 0l135 41c176 51 195 109 858 109z'/%3e%3cpath fill='url(%23paint3_linear)' d='M1252 400h116c-14-7-35-14-116-16-663-14-837-128-1013-258l-85-61C98 28 46 8 0 0v400h1252z'/%3e%3c/mask%3e%3cg mask='url(%23a)'%3e%3cpath fill='white' d='M-172-98h1671v601H-172z'/%3e%3c/g%3e%3cdefs%3e%3clinearGradient id='paint0_linear' x1='602' x2='1093.5' y1='-960.5' y2='272' gradientUnits='userSpaceOnUse'%3e%3cstop stop-color='white'/%3e%3cstop offset='1' stop-color='white' stop-opacity='0'/%3e%3c/linearGradient%3e%3clinearGradient id='paint1_linear' x1='482' x2='480' y1='1058.5' y2='70.5' gradientUnits='userSpaceOnUse'%3e%3cstop stop-color='white'/%3e%3cstop offset='1' stop-color='white' stop-opacity='0'/%3e%3c/linearGradient%3e%3clinearGradient id='paint2_linear' x1='424' x2='446.1' y1='-587.5' y2='274.6' gradientUnits='userSpaceOnUse'%3e%3cstop stop-color='white'/%3e%3cstop offset='1' stop-color='white' stop-opacity='0'/%3e%3c/linearGradient%3e%3clinearGradient id='paint3_linear' x1='587' x2='349' y1='-1120.5' y2='341' gradientUnits='userSpaceOnUse'%3e%3cstop stop-color='white'/%3e%3cstop offset='1' stop-color='white' stop-opacity='0'/%3e%3c/linearGradient%3e%3c/defs%3e%3c/svg%3e"), linear-gradient(90deg, rgb(0, 91, 75), rgb(0, 91, 75)); + color: rgb(255, 255, 255); +} + +.card-header.backstage-blue { + background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' width='1368' height='400' fill='none'%3e%3cmask id='a' width='1368' height='401' x='0' y='0' maskUnits='userSpaceOnUse'%3e%3cpath fill='url(%23paint0_linear)' d='M437 116C223 116 112 0 112 0h1256v400c-82 0-225-21-282-109-112-175-436-175-649-175z'/%3e%3cpath fill='url(%23paint1_linear)' d='M1368 400V282C891-29 788 40 711 161 608 324 121 372 0 361v39h1368z'/%3e%3cpath fill='url(%23paint2_linear)' d='M1368 244v156H0V94c92-24 198-46 375 0l135 41c176 51 195 109 858 109z'/%3e%3cpath fill='url(%23paint3_linear)' d='M1252 400h116c-14-7-35-14-116-16-663-14-837-128-1013-258l-85-61C98 28 46 8 0 0v400h1252z'/%3e%3c/mask%3e%3cg mask='url(%23a)'%3e%3cpath fill='white' d='M-172-98h1671v601H-172z'/%3e%3c/g%3e%3cdefs%3e%3clinearGradient id='paint0_linear' x1='602' x2='1093.5' y1='-960.5' y2='272' gradientUnits='userSpaceOnUse'%3e%3cstop stop-color='white'/%3e%3cstop offset='1' stop-color='white' stop-opacity='0'/%3e%3c/linearGradient%3e%3clinearGradient id='paint1_linear' x1='482' x2='480' y1='1058.5' y2='70.5' gradientUnits='userSpaceOnUse'%3e%3cstop stop-color='white'/%3e%3cstop offset='1' stop-color='white' stop-opacity='0'/%3e%3c/linearGradient%3e%3clinearGradient id='paint2_linear' x1='424' x2='446.1' y1='-587.5' y2='274.6' gradientUnits='userSpaceOnUse'%3e%3cstop stop-color='white'/%3e%3cstop offset='1' stop-color='white' stop-opacity='0'/%3e%3c/linearGradient%3e%3clinearGradient id='paint3_linear' x1='587' x2='349' y1='-1120.5' y2='341' gradientUnits='userSpaceOnUse'%3e%3cstop stop-color='white'/%3e%3cstop offset='1' stop-color='white' stop-opacity='0'/%3e%3c/linearGradient%3e%3c/defs%3e%3c/svg%3e"), linear-gradient(90deg, rgb(0, 109, 143), rgb(0, 73, 161)); + color: rgb(255, 255, 255); +} + +.card-header p.subtitle { + margin: 0; + font-size: 0.8em; + font-family: "Helvetica Neue", Helvetica, Roboto, Arial, sans-serif; + font-weight: 500; + line-height: 1.57; +} + +.card-header p.title { + margin: 0; + font-size: 1.14em; + font-family: "Helvetica Neue", Helvetica, Roboto, Arial, sans-serif; + font-weight: 700; + line-height: 1.6; + margin-bottom: 2px; +} + +/************* + Cards - Media +*/ + +.card-media { + display: block; + background-size: cover; + background-repeat: no-repeat; + background-position: center; + width: 100%; + object-fit: cover; +} + +.card-media p { + margin: 0; +} + +/************* + Cards - Content +*/ + +.card-content { + padding: 16px; +} + +.card-content p { + margin: 0; +} + +.card-content p + p { + margin-top: 1em; +} + +.card-content-title { + margin-top: 0; + font-weight: 400; + font-size: 1.5rem; + line-height: 1.334; + letter-spacing: 0; + margin-bottom: 0.35em; +} + +.card-content-title p { + margin: 0; +} + +/************* + Cards - Actions +*/ + +.card-actions { + padding: 16px; +} + +.card-actions ul:not([hidden]) { + display: flex; + margin: 0; +} + +.card-actions ul { + list-style: none; + padding: 0; + margin: 0; + display: flex; + flex-wrap: wrap; + gap: 16px; +} +.card-actions.right ul { + justify-content: flex-end; +} + +.card-actions p { + margin: 0; +} + +[dir=ltr] .card-actions ul li { + margin: 0; +} + +.card-actions a { + background-color: transparent; + margin-top: 0; + vertical-align: middle; + font-weight: 500; + font-size: 0.8125rem; + line-height: 1.75; + letter-spacing: 0.02857em; + text-transform: uppercase; +} + +/************* + Cards - Tags +*/ + +.card-tags { + display: flex; + flex-wrap: wrap; + box-sizing: border-box; + padding: 16px; +} + +.card-tags ul:not([hidden]) { + display: flex; + margin: 0; +} + +.card-tags ul { + list-style: none; + padding: 0; + margin: 0; + display: flex; + flex-wrap: wrap; + gap: 16px; +} + +[dir=ltr] .card-tags ul li { + padding: 2px 8px; + margin: 0; + box-sizing: border-box; + font-size: 12px; + font-weight: 500; + color: #000; + background-color: rgba(0, 0, 0, 0.12); + border-radius: 16px; + height: 24px; + line-height: 20px; +} + +/************* + Cards - Divider +*/ + +.card-divider { + margin: 0; + padding: 0 16px; +} + +.card-divider hr { + margin: 0; +} diff --git a/docs/assets/css/custom.css b/docs/assets/css/custom.css new file mode 100644 index 0000000..2fc8741 --- /dev/null +++ b/docs/assets/css/custom.css @@ -0,0 +1,12 @@ +/* Indentation. */ +div.doc-contents:not(.first) { + padding-left: 25px; + border-left: .05rem solid var(--md-typeset-table-color); +} + +/* Normal size fonts on parameter tables */ +.md-typeset div.doc-contents table { + font-size: 1em; + width: 100%; + display: table; +} diff --git a/docs/assets/css/field-list.css b/docs/assets/css/field-list.css new file mode 100644 index 0000000..ace471b --- /dev/null +++ b/docs/assets/css/field-list.css @@ -0,0 +1,34 @@ +dl.field-list .doc-param-default, dl.doc-field-list .doc-param-default { + float: none; +} + +.field-list > dl, dl.field-list, dl.doc-field-list { + display: flex; + flex-flow: row wrap; + padding-left: 10px; +} + +.field-list > dl > dt, dl.field-list > dt, dl.doc-field-list > dt { + flex-basis: 20%; + font-weight: bold; + word-break: break-word; + padding: 10px 0; + border-bottom: 1px solid #e5e5e5; +} + +.field-list > dl > dt:after, dl.field-list > dt:after { + content: ":"; +} + +[dir=ltr] .field-list > dl > dd, dl.field-list > dd.doc-field-def, dl.doc-field-list > dd.doc-field-def { + flex-basis: 70%; + flex-grow: 1; + margin: 0; + padding: 10px 0 10px 10px; + border-bottom: 1px solid #e5e5e5; +} + +dd.doc-field-def > p:last-child { + padding-bottom: 0; + margin-bottom: 0; +} diff --git a/docs/assets/css/mkdocstrings.css b/docs/assets/css/mkdocstrings.css new file mode 100644 index 0000000..6288f53 --- /dev/null +++ b/docs/assets/css/mkdocstrings.css @@ -0,0 +1,39 @@ +/* Indentation. */ +div.doc-contents:not(.first) { + padding-left: 25px; + border-left: .05rem solid var(--md-typeset-table-color); +} + +/* Mark external links as such. */ +a.external::after, +a.autorefs-external::after { + /* https://primer.style/octicons/arrow-up-right-24 */ + mask-image: url('data:image/svg+xml,'); + -webkit-mask-image: url('data:image/svg+xml,'); + content: ' '; + + display: inline-block; + vertical-align: middle; + position: relative; + + height: 1em; + width: 1em; + background-color: var(--md-typeset-a-color); +} + +a.external:hover::after, +a.autorefs-external:hover::after { + background-color: var(--md-accent-fg-color); +} + +.doc-param-key, .doc-field-term, .doc-section-head { + font-weight: bold; +} + +.doc.doc-heading { + text-transform: none; +} + +h5.doc-heading, h6.doc-heading { + font-size: 1em; +} diff --git a/docsrc/_static/img/authorize-composer.png b/docs/assets/img/authorize-composer.png similarity index 100% rename from docsrc/_static/img/authorize-composer.png rename to docs/assets/img/authorize-composer.png diff --git a/docsrc/_static/img/authorize-done.png b/docs/assets/img/authorize-done.png similarity index 100% rename from docsrc/_static/img/authorize-done.png rename to docs/assets/img/authorize-done.png diff --git a/docsrc/_static/img/composer-logo.svg b/docs/assets/img/composer-logo.svg similarity index 100% rename from docsrc/_static/img/composer-logo.svg rename to docs/assets/img/composer-logo.svg diff --git a/docsrc/_static/img/compositions.png b/docs/assets/img/compositions.png similarity index 100% rename from docsrc/_static/img/compositions.png rename to docs/assets/img/compositions.png diff --git a/docsrc/_static/img/device-activation.png b/docs/assets/img/device-activation.png similarity index 100% rename from docsrc/_static/img/device-activation.png rename to docs/assets/img/device-activation.png diff --git a/docsrc/_static/img/layers.png b/docs/assets/img/layers.png similarity index 100% rename from docsrc/_static/img/layers.png rename to docs/assets/img/layers.png diff --git a/docsrc/_static/img/sandwiches.png b/docs/assets/img/sandwiches.png similarity index 100% rename from docsrc/_static/img/sandwiches.png rename to docs/assets/img/sandwiches.png diff --git a/docs/changelog.md b/docs/changelog.md new file mode 100644 index 0000000..6b23491 --- /dev/null +++ b/docs/changelog.md @@ -0,0 +1,6 @@ +--- +comments: true +title: "Changelog" +--- + +{% include-markdown "../CHANGELOG.md" %} diff --git a/docs/contributing.md b/docs/contributing.md new file mode 100644 index 0000000..7c04a4f --- /dev/null +++ b/docs/contributing.md @@ -0,0 +1,6 @@ +--- +comments: true +title: "Contributing" +--- + +{% include-markdown "../CONTRIBUTING.md" rewrite-relative-urls=false %} diff --git a/docs/gen_doc_stubs.py b/docs/gen_doc_stubs.py new file mode 100755 index 0000000..060e4d6 --- /dev/null +++ b/docs/gen_doc_stubs.py @@ -0,0 +1,51 @@ +#!/usr/bin/env python +""" +Generate documentation stubs for the configured package. + +Configuring this script: + + Change the `package_name` variable to the name of the package you want to generate + +Output: + + This script will generate a `reference/api` directory containing documentation stubs for the package. + It will also generate a `reference/api/SUMMARY.md` file that contains the navigation structure for the + documentation. +""" + +from pathlib import Path + +import mkdocs_gen_files + +package_name = "cookie_composer" + +nav = mkdocs_gen_files.Nav() +mod_symbol = '' + +src_root = Path(__file__).parent.parent +package_root = src_root / package_name + +for path in sorted(package_root.rglob("*.py")): + module_path = path.relative_to(src_root).with_suffix("") + doc_path = path.relative_to(src_root).with_suffix(".md") + full_doc_path = Path("reference/api", doc_path) + + parts = tuple(module_path.parts) + if parts[-1] == "__init__": + parts = parts[:-1] + doc_path = doc_path.with_name("index.md") + full_doc_path = full_doc_path.with_name("index.md") + elif parts[-1].startswith("_"): + continue + + nav_parts = [f"{mod_symbol} {part}" for part in parts] + nav[tuple(nav_parts)] = doc_path.as_posix() + + with mkdocs_gen_files.open(full_doc_path, "w") as fd: + ident = ".".join(parts) + fd.write(f"::: {ident}") + + mkdocs_gen_files.set_edit_path(full_doc_path, path) + +with mkdocs_gen_files.open("reference/api/SUMMARY.md", "w") as nav_file: + nav_file.writelines(nav.build_literate_nav()) diff --git a/docsrc/how-to/access-private-templates.md b/docs/how-to/access-private-templates.md similarity index 85% rename from docsrc/how-to/access-private-templates.md rename to docs/how-to/access-private-templates.md index 801fd12..f2c3476 100644 --- a/docsrc/how-to/access-private-templates.md +++ b/docs/how-to/access-private-templates.md @@ -2,9 +2,9 @@ Cookie composer can integrate with some third-party services in order to access private repositories. -```{note} -Currently only GitHub is supported. -``` +!!! note + Currently only GitHub is supported. + ## GitHub @@ -21,19 +21,19 @@ Copy the one-time code (`A25E-0A58` in this example), and press Enter or Return You will arrive at a page similar to this: -![Activate the device](/_static/img/device-activation.png) +![Activate the device](../assets/img/device-activation.png) Paste the code (or enter each character individually) and press the continue button. You will see an authorization page, similar to: -![Authorize cookie-composer](/_static/img/authorize-composer.png) +![Authorize cookie-composer](../assets/img/authorize-composer.png) Press the "Authorize callowayproject" button to allow cookie-composer read-only access to your repositories. Then you will see: -![All done!](/_static/img/authorize-done.png) +![All done!](../assets/img/authorize-done.png) And you can close the browser window. diff --git a/docs/how-to/index.md b/docs/how-to/index.md new file mode 100644 index 0000000..41aba0c --- /dev/null +++ b/docs/how-to/index.md @@ -0,0 +1 @@ +# How To... diff --git a/docs/index.md b/docs/index.md new file mode 100644 index 0000000..8641b84 --- /dev/null +++ b/docs/index.md @@ -0,0 +1,8 @@ +# Cookie composer + +{% + include-markdown + "../README.md" + start="" + rewrite-relative-urls=false +%} diff --git a/docsrc/installation.md b/docs/installation.md similarity index 100% rename from docsrc/installation.md rename to docs/installation.md diff --git a/docs/reference/cli.md b/docs/reference/cli.md new file mode 100644 index 0000000..a2b0f66 --- /dev/null +++ b/docs/reference/cli.md @@ -0,0 +1,6 @@ +::: mkdocs-click + :module: cookie_composer.cli + :command: cli + :prog_name: cookie-composer + :style: table + :list_subcommands: true diff --git a/docsrc/topic-guides/composition-files.md b/docs/topic-guides/composition-files.md similarity index 73% rename from docsrc/topic-guides/composition-files.md rename to docs/topic-guides/composition-files.md index f46a4d4..db108fb 100644 --- a/docsrc/topic-guides/composition-files.md +++ b/docs/topic-guides/composition-files.md @@ -4,33 +4,20 @@ Composition files are YAML documents with layer configurations. They are used fo For example, a basic composition file for generating new projects might look like: -```{literalinclude} /_includes/example-composition.yaml ---- -language: yaml -linenos: -name: example-composition-yaml -caption: package-composition.yaml ---- +```python title="Example composition" +--8<-- "example-composition.yaml" ``` When this is used to create a project: -```{literalinclude} /_includes/interactive-create.txt ---- -language: console -name: interactive-create ---- +```console title="An interactive console example" +--8<-- "interactive-create.txt" ``` The composition file saved in the new project (named `my-test-project` in this example) as `.composition.yaml` would look like: -```{literalinclude} /_includes/rendered-composition.yaml ---- -language: yaml -name: rendered-composition-yaml -linenos: -caption: .composition.yaml ---- +```console title="A rendered composition" +--8<-- "rendered-composition.yaml" ``` If you look closely you'll see that `.composition.yaml` contains the contents of `package-composition.yaml`. Internally the `.composition.yaml` file is termed a "rendered composition" because it contains all the parameters used to render this specific project. This rendered composition is used when applying updates of the templates. diff --git a/docs/topic-guides/index.md b/docs/topic-guides/index.md new file mode 100644 index 0000000..9a335ee --- /dev/null +++ b/docs/topic-guides/index.md @@ -0,0 +1 @@ +# Topic Guides diff --git a/docsrc/tutorial/composable-templates.md b/docs/tutorial/composable-templates.md similarity index 100% rename from docsrc/tutorial/composable-templates.md rename to docs/tutorial/composable-templates.md diff --git a/docsrc/tutorial/compositions.md b/docs/tutorial/compositions.md similarity index 90% rename from docsrc/tutorial/compositions.md rename to docs/tutorial/compositions.md index bcd7750..346b189 100644 --- a/docsrc/tutorial/compositions.md +++ b/docs/tutorial/compositions.md @@ -22,13 +22,8 @@ Issues to resolve: A composition is a series of template layers. We can reproduce the results of the [previous tutorial](incrementally-layering.md) using this file: -```{literalinclude} /_includes/tutorial-composition-1.yaml ---- -language: yaml -linenos: -name: tutorial-composition-1-yaml -caption: my-package-composition.yaml ---- +```yaml title="my-package-composition.yaml" +--8<-- "tutorial-composition-1.yaml" ``` We didn't change the default for the `project_slug`, `topics` or `open_source_license` prompts. You don't have to change all the prompts or include all the prompts in the composition. @@ -82,13 +77,8 @@ The composition can also improve the defaults for the template prompts by: Let's start by changing some defaults to the first template. You can find the original prompt in this template's [cookiecutter.json file.](https://github.com/rwxd/cookiecutter-github-project/blob/main/cookiecutter.json) -```{literalinclude} /_includes/tutorial-composition-2.yaml ---- -language: yaml -linenos: -name: tutorial-composition-2-yaml -caption: my-package-composition.yaml ---- +```yaml title="my-package-composition.yaml" +--8<-- "tutorial-composition-2.yaml" ``` The new defaults provide better suggestions based on previous prompt answers. @@ -99,13 +89,8 @@ The second template has several prompts that simply synonymns of promts from the Let's do that. You can find the original prompts in this template's [cookiecutter.json file.](https://github.com/kragniz/cookiecutter-pypackage-minimal/blob/master/cookiecutter.json) -```{literalinclude} /_includes/tutorial-composition-3.yaml ---- -language: yaml -linenos: -name: tutorial-composition-3-yaml -caption: my-package-composition.yaml ---- +```yaml title="my-package-composition.yaml" +--8<-- "tutorial-composition-3.yaml" ``` Now: diff --git a/docsrc/tutorial/incrementally-layering.md b/docs/tutorial/incrementally-layering.md similarity index 100% rename from docsrc/tutorial/incrementally-layering.md rename to docs/tutorial/incrementally-layering.md diff --git a/docs/tutorial/index.md b/docs/tutorial/index.md new file mode 100644 index 0000000..4f50ecc --- /dev/null +++ b/docs/tutorial/index.md @@ -0,0 +1 @@ +# Tutorial diff --git a/docsrc/Makefile b/docsrc/Makefile deleted file mode 100644 index 7ef36e2..0000000 --- a/docsrc/Makefile +++ /dev/null @@ -1,20 +0,0 @@ -# Minimal makefile for Sphinx documentation -# - -# You can set these variables from the command line. -SPHINXOPTS = -SPHINXBUILD = python -msphinx -SPHINXPROJ = bin_cookie_composer -SOURCEDIR = . -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) diff --git a/docsrc/_static/css/custom.css b/docsrc/_static/css/custom.css deleted file mode 100644 index 65abbe5..0000000 --- a/docsrc/_static/css/custom.css +++ /dev/null @@ -1,11 +0,0 @@ -dt.sig.py > .sig-prename.descclassname { - display: none; -} -.subheading { - line-height: 1.25; - margin-bottom: 0; - color: #646776; -} -.subheading + section > h1 { - margin-top: 0; -} diff --git a/docsrc/_templates/autosummary/base.rst b/docsrc/_templates/autosummary/base.rst deleted file mode 100644 index 3a6f25c..0000000 --- a/docsrc/_templates/autosummary/base.rst +++ /dev/null @@ -1,9 +0,0 @@ -.. rst-class:: subheading - -{{ fullname }} - -{{ objname | escape | underline}} - -.. currentmodule:: {{ module }} - -.. auto{{ objtype }}:: {{ objname }} diff --git a/docsrc/_templates/autosummary/class.rst b/docsrc/_templates/autosummary/class.rst deleted file mode 100644 index f01446b..0000000 --- a/docsrc/_templates/autosummary/class.rst +++ /dev/null @@ -1,11 +0,0 @@ -.. rst-class:: subheading - -{{ fullname }} - -{{ objname | escape | underline}} - -.. currentmodule:: {{ module }} - -.. autoclass:: {{ objname }} - :members: - :undoc-members: diff --git a/docsrc/_templates/autosummary/module.rst b/docsrc/_templates/autosummary/module.rst deleted file mode 100644 index db11e37..0000000 --- a/docsrc/_templates/autosummary/module.rst +++ /dev/null @@ -1,72 +0,0 @@ -.. rst-class:: subheading - -{{ fullname }} - -{{ name | escape | underline}} - -.. currentmodule:: {{ fullname }} - -.. automodule:: {{ fullname }} - {% block attributes %} - {% if attributes %} - .. rubric:: Attributes - - .. autosummary:: - :nosignatures: - {% for item in attributes %} - {{ item }} - {%- endfor %} - {% endif %} - {% endblock %} - - {% block functions %} - {% if functions %} - .. rubric:: Functions - - .. autosummary:: - :nosignatures: - :toctree: {{ name }} - {% for item in functions %} - {{ item }} - {%- endfor %} - {% endif %} - {% endblock %} - - {% block classes %} - {% if classes %} - .. rubric:: Classes - - .. autosummary:: - :nosignatures: - :toctree: {{ name }} - {% for item in classes %} - {{ item }} - {%- endfor %} - {% endif %} - {% endblock %} - - {% block exceptions %} - {% if exceptions %} - .. rubric:: Exceptions - - .. autosummary:: - :nosignatures: - :toctree: {{ name }} - {% for item in exceptions %} - {{ item }} - {%- endfor %} - {% endif %} - {% endblock %} - {% block modules -%} - {% if modules %} - - .. rubric:: Modules - - .. autosummary:: - :toctree: {{ name }} - :recursive: - {% for item in modules %} - {{ item }} - {%- endfor %} - {% endif %} - {% endblock %} diff --git a/docsrc/api.rst b/docsrc/api.rst deleted file mode 100644 index d47bf33..0000000 --- a/docsrc/api.rst +++ /dev/null @@ -1,22 +0,0 @@ -API Reference -============= - -.. currentmodule:: cookie_composer - -.. autosummary:: - :toctree: _autosummary - :nosignatures: - :recursive: - - ~commands - ~merge_files - ~authentication - ~cc_overrides - ~composition - ~data_merge - ~diff - ~exceptions - ~git_commands - ~layers - ~matching - ~utils diff --git a/docsrc/apidocs/cookie_composer/cookie_composer.authentication.rst b/docsrc/apidocs/cookie_composer/cookie_composer.authentication.rst deleted file mode 100644 index 171bbb0..0000000 --- a/docsrc/apidocs/cookie_composer/cookie_composer.authentication.rst +++ /dev/null @@ -1,61 +0,0 @@ -:py:mod:`cookie_composer.authentication` -======================================== - -.. py:module:: cookie_composer.authentication - -.. autodoc2-docstring:: cookie_composer.authentication - :allowtitles: - -Module Contents ---------------- - -Functions -~~~~~~~~~ - -.. list-table:: - :class: autosummary longtable - :align: left - - * - :py:obj:`get_hosts_file ` - - .. autodoc2-docstring:: cookie_composer.authentication.get_hosts_file - :summary: - * - :py:obj:`login_to_svc ` - - .. autodoc2-docstring:: cookie_composer.authentication.login_to_svc - :summary: - * - :py:obj:`get_cached_token ` - - .. autodoc2-docstring:: cookie_composer.authentication.get_cached_token - :summary: - * - :py:obj:`add_auth_to_url ` - - .. autodoc2-docstring:: cookie_composer.authentication.add_auth_to_url - :summary: - * - :py:obj:`github_auth_device ` - - .. autodoc2-docstring:: cookie_composer.authentication.github_auth_device - :summary: - -API -~~~ - -.. py:function:: get_hosts_file() -> pathlib.Path - :canonical: cookie_composer.authentication.get_hosts_file - - .. autodoc2-docstring:: cookie_composer.authentication.get_hosts_file - -.. py:function:: login_to_svc(service: typing.Optional[str] = None, protocol: typing.Optional[str] = None, scopes: typing.Optional[str] = None, token: typing.Optional[str] = None) -> str - :canonical: cookie_composer.authentication.login_to_svc - - .. autodoc2-docstring:: cookie_composer.authentication.login_to_svc - -.. py:function:: get_cached_token(account_name: str) -> typing.Optional[str] - :canonical: cookie_composer.authentication.get_cached_token - - .. autodoc2-docstring:: cookie_composer.authentication.get_cached_token - -.. py:function:: add_auth_to_url(url: str) -> str - :canonical: cookie_composer.authentication.add_auth_to_url - - .. autodoc2-docstring:: cookie_composer.authentication.add_auth_to_url - -.. py:function:: github_auth_device(n_polls: int = 9999) -> typing.Optional[str] - :canonical: cookie_composer.authentication.github_auth_device - - .. autodoc2-docstring:: cookie_composer.authentication.github_auth_device diff --git a/docsrc/apidocs/cookie_composer/cookie_composer.cc_overrides.rst b/docsrc/apidocs/cookie_composer/cookie_composer.cc_overrides.rst deleted file mode 100644 index 034d8e0..0000000 --- a/docsrc/apidocs/cookie_composer/cookie_composer.cc_overrides.rst +++ /dev/null @@ -1,102 +0,0 @@ -:py:mod:`cookie_composer.cc_overrides` -====================================== - -.. py:module:: cookie_composer.cc_overrides - -.. autodoc2-docstring:: cookie_composer.cc_overrides - :allowtitles: - -Module Contents ---------------- - -Classes -~~~~~~~ - -.. list-table:: - :class: autosummary longtable - :align: left - - * - :py:obj:`JsonifyContextExtension ` - - .. autodoc2-docstring:: cookie_composer.cc_overrides.JsonifyContextExtension - :summary: - * - :py:obj:`CustomStrictEnvironment ` - - .. autodoc2-docstring:: cookie_composer.cc_overrides.CustomStrictEnvironment - :summary: - -Functions -~~~~~~~~~ - -.. list-table:: - :class: autosummary longtable - :align: left - - * - :py:obj:`jsonify_context ` - - .. autodoc2-docstring:: cookie_composer.cc_overrides.jsonify_context - :summary: - * - :py:obj:`update_extensions ` - - .. autodoc2-docstring:: cookie_composer.cc_overrides.update_extensions - :summary: - * - :py:obj:`prompt_for_config ` - - .. autodoc2-docstring:: cookie_composer.cc_overrides.prompt_for_config - :summary: - * - :py:obj:`_render_dicts ` - - .. autodoc2-docstring:: cookie_composer.cc_overrides._render_dicts - :summary: - * - :py:obj:`_render_simple ` - - .. autodoc2-docstring:: cookie_composer.cc_overrides._render_simple - :summary: - -API -~~~ - -.. py:function:: jsonify_context(value: typing.Any) -> typing.MutableMapping - :canonical: cookie_composer.cc_overrides.jsonify_context - - .. autodoc2-docstring:: cookie_composer.cc_overrides.jsonify_context - -.. py:class:: JsonifyContextExtension(environment: jinja2.Environment) - :canonical: cookie_composer.cc_overrides.JsonifyContextExtension - - Bases: :py:obj:`jinja2.ext.Extension` - - .. autodoc2-docstring:: cookie_composer.cc_overrides.JsonifyContextExtension - - .. rubric:: Initialization - - .. autodoc2-docstring:: cookie_composer.cc_overrides.JsonifyContextExtension.__init__ - -.. py:class:: CustomStrictEnvironment(**kwargs) - :canonical: cookie_composer.cc_overrides.CustomStrictEnvironment - - Bases: :py:obj:`cookiecutter.environment.StrictEnvironment` - - .. autodoc2-docstring:: cookie_composer.cc_overrides.CustomStrictEnvironment - - .. rubric:: Initialization - - .. autodoc2-docstring:: cookie_composer.cc_overrides.CustomStrictEnvironment.__init__ - - .. py:method:: _read_extensions(context: typing.MutableMapping[str, typing.Any]) -> typing.List[str] - :canonical: cookie_composer.cc_overrides.CustomStrictEnvironment._read_extensions - - .. autodoc2-docstring:: cookie_composer.cc_overrides.CustomStrictEnvironment._read_extensions - -.. py:function:: update_extensions(existing_config: typing.MutableMapping[str, typing.Any], prompts: typing.MutableMapping[str, typing.Any]) -> typing.List[str] - :canonical: cookie_composer.cc_overrides.update_extensions - - .. autodoc2-docstring:: cookie_composer.cc_overrides.update_extensions - -.. py:function:: prompt_for_config(prompts: dict, aggregated_context: cookie_composer.data_merge.Context, layer_context: typing.Optional[typing.MutableMapping[str, typing.Any]] = None, no_input: bool = False) -> typing.MutableMapping[str, typing.Any] - :canonical: cookie_composer.cc_overrides.prompt_for_config - - .. autodoc2-docstring:: cookie_composer.cc_overrides.prompt_for_config - -.. py:function:: _render_dicts(context: typing.MutableMapping, env: jinja2.Environment, no_input: bool, prompts: dict) -> None - :canonical: cookie_composer.cc_overrides._render_dicts - - .. autodoc2-docstring:: cookie_composer.cc_overrides._render_dicts - -.. py:function:: _render_simple(context: typing.MutableMapping, context_prompts: dict, env: jinja2.Environment, no_input: bool, prompts: dict) -> None - :canonical: cookie_composer.cc_overrides._render_simple - - .. autodoc2-docstring:: cookie_composer.cc_overrides._render_simple diff --git a/docsrc/apidocs/cookie_composer/cookie_composer.cli.rst b/docsrc/apidocs/cookie_composer/cookie_composer.cli.rst deleted file mode 100644 index 0916d62..0000000 --- a/docsrc/apidocs/cookie_composer/cookie_composer.cli.rst +++ /dev/null @@ -1,86 +0,0 @@ -:py:mod:`cookie_composer.cli` -============================= - -.. py:module:: cookie_composer.cli - -.. autodoc2-docstring:: cookie_composer.cli - :allowtitles: - -Module Contents ---------------- - -Functions -~~~~~~~~~ - -.. list-table:: - :class: autosummary longtable - :align: left - - * - :py:obj:`cli ` - - .. autodoc2-docstring:: cookie_composer.cli.cli - :summary: - * - :py:obj:`validate_context_params ` - - .. autodoc2-docstring:: cookie_composer.cli.validate_context_params - :summary: - * - :py:obj:`create ` - - .. autodoc2-docstring:: cookie_composer.cli.create - :summary: - * - :py:obj:`add ` - - .. autodoc2-docstring:: cookie_composer.cli.add - :summary: - * - :py:obj:`update ` - - .. autodoc2-docstring:: cookie_composer.cli.update - :summary: - * - :py:obj:`link ` - - .. autodoc2-docstring:: cookie_composer.cli.link - :summary: - -Data -~~~~ - -.. list-table:: - :class: autosummary longtable - :align: left - - * - :py:obj:`logger ` - - .. autodoc2-docstring:: cookie_composer.cli.logger - :summary: - -API -~~~ - -.. py:data:: logger - :canonical: cookie_composer.cli.logger - :value: None - - .. autodoc2-docstring:: cookie_composer.cli.logger - -.. py:function:: cli() -> None - :canonical: cookie_composer.cli.cli - - .. autodoc2-docstring:: cookie_composer.cli.cli - -.. py:function:: validate_context_params(ctx: typing.Any, param: typing.Any, value: list) -> typing.Optional[collections.OrderedDict] - :canonical: cookie_composer.cli.validate_context_params - - .. autodoc2-docstring:: cookie_composer.cli.validate_context_params - -.. py:function:: create(no_input: bool, checkout: str, directory: str, overwrite_if_exists: bool, skip_if_file_exists: bool, default_config: bool, destination: pathlib.Path, accept_hooks: str, path_or_url: str, context_params: typing.Optional[typing.MutableMapping[str, typing.Any]] = None) -> None - :canonical: cookie_composer.cli.create - - .. autodoc2-docstring:: cookie_composer.cli.create - -.. py:function:: add(no_input: bool, checkout: str, directory: str, overwrite_if_exists: bool, skip_if_file_exists: bool, default_config: bool, destination: pathlib.Path, accept_hooks: str, path_or_url: str, context_params: typing.Optional[typing.MutableMapping[str, typing.Any]] = None) -> None - :canonical: cookie_composer.cli.add - - .. autodoc2-docstring:: cookie_composer.cli.add - -.. py:function:: update(no_input: bool, destination: pathlib.Path, context_params: typing.Optional[collections.OrderedDict] = None) -> None - :canonical: cookie_composer.cli.update - - .. autodoc2-docstring:: cookie_composer.cli.update - -.. py:function:: link(no_input: bool, checkout: str, directory: str, overwrite_if_exists: bool, skip_if_file_exists: bool, default_config: bool, destination: typing.Optional[pathlib.Path], path_or_url: str, context_params: typing.Optional[typing.MutableMapping[str, typing.Any]] = None) -> None - :canonical: cookie_composer.cli.link - - .. autodoc2-docstring:: cookie_composer.cli.link diff --git a/docsrc/apidocs/cookie_composer/cookie_composer.commands.add.rst b/docsrc/apidocs/cookie_composer/cookie_composer.commands.add.rst deleted file mode 100644 index c26524f..0000000 --- a/docsrc/apidocs/cookie_composer/cookie_composer.commands.add.rst +++ /dev/null @@ -1,46 +0,0 @@ -:py:mod:`cookie_composer.commands.add` -====================================== - -.. py:module:: cookie_composer.commands.add - -.. autodoc2-docstring:: cookie_composer.commands.add - :allowtitles: - -Module Contents ---------------- - -Functions -~~~~~~~~~ - -.. list-table:: - :class: autosummary longtable - :align: left - - * - :py:obj:`add_cmd ` - - .. autodoc2-docstring:: cookie_composer.commands.add.add_cmd - :summary: - -Data -~~~~ - -.. list-table:: - :class: autosummary longtable - :align: left - - * - :py:obj:`logger ` - - .. autodoc2-docstring:: cookie_composer.commands.add.logger - :summary: - -API -~~~ - -.. py:data:: logger - :canonical: cookie_composer.commands.add.logger - :value: None - - .. autodoc2-docstring:: cookie_composer.commands.add.logger - -.. py:function:: add_cmd(path_or_url: str, destination_dir: typing.Optional[pathlib.Path] = None, no_input: bool = False, checkout: typing.Optional[str] = None, directory: typing.Optional[str] = None, overwrite_if_exists: bool = False, skip_if_file_exists: bool = False, default_config: bool = False, accept_hooks: str = 'all', initial_context: typing.Optional[typing.MutableMapping[str, typing.Any]] = None) -> None - :canonical: cookie_composer.commands.add.add_cmd - - .. autodoc2-docstring:: cookie_composer.commands.add.add_cmd diff --git a/docsrc/apidocs/cookie_composer/cookie_composer.commands.authn.rst b/docsrc/apidocs/cookie_composer/cookie_composer.commands.authn.rst deleted file mode 100644 index 25d1d71..0000000 --- a/docsrc/apidocs/cookie_composer/cookie_composer.commands.authn.rst +++ /dev/null @@ -1,45 +0,0 @@ -:py:mod:`cookie_composer.commands.authn` -======================================== - -.. py:module:: cookie_composer.commands.authn - -.. autodoc2-docstring:: cookie_composer.commands.authn - :allowtitles: - -Module Contents ---------------- - -Functions -~~~~~~~~~ - -.. list-table:: - :class: autosummary longtable - :align: left - - * - :py:obj:`auth ` - - .. autodoc2-docstring:: cookie_composer.commands.authn.auth - :summary: - * - :py:obj:`login ` - - .. autodoc2-docstring:: cookie_composer.commands.authn.login - :summary: - * - :py:obj:`token ` - - .. autodoc2-docstring:: cookie_composer.commands.authn.token - :summary: - -API -~~~ - -.. py:function:: auth() -> None - :canonical: cookie_composer.commands.authn.auth - - .. autodoc2-docstring:: cookie_composer.commands.authn.auth - -.. py:function:: login(git_protocol: str, service: str, scopes: str, with_token: rich_click.File) -> None - :canonical: cookie_composer.commands.authn.login - - .. autodoc2-docstring:: cookie_composer.commands.authn.login - -.. py:function:: token(service: str) -> None - :canonical: cookie_composer.commands.authn.token - - .. autodoc2-docstring:: cookie_composer.commands.authn.token diff --git a/docsrc/apidocs/cookie_composer/cookie_composer.commands.create.rst b/docsrc/apidocs/cookie_composer/cookie_composer.commands.create.rst deleted file mode 100644 index ab3e4fe..0000000 --- a/docsrc/apidocs/cookie_composer/cookie_composer.commands.create.rst +++ /dev/null @@ -1,46 +0,0 @@ -:py:mod:`cookie_composer.commands.create` -========================================= - -.. py:module:: cookie_composer.commands.create - -.. autodoc2-docstring:: cookie_composer.commands.create - :allowtitles: - -Module Contents ---------------- - -Functions -~~~~~~~~~ - -.. list-table:: - :class: autosummary longtable - :align: left - - * - :py:obj:`create_cmd ` - - .. autodoc2-docstring:: cookie_composer.commands.create.create_cmd - :summary: - -Data -~~~~ - -.. list-table:: - :class: autosummary longtable - :align: left - - * - :py:obj:`logger ` - - .. autodoc2-docstring:: cookie_composer.commands.create.logger - :summary: - -API -~~~ - -.. py:data:: logger - :canonical: cookie_composer.commands.create.logger - :value: None - - .. autodoc2-docstring:: cookie_composer.commands.create.logger - -.. py:function:: create_cmd(path_or_url: str, output_dir: typing.Optional[pathlib.Path] = None, no_input: bool = False, checkout: typing.Optional[str] = None, directory: typing.Optional[str] = None, overwrite_if_exists: bool = False, skip_if_file_exists: bool = False, default_config: bool = False, accept_hooks: str = 'all', initial_context: typing.Optional[typing.MutableMapping[str, typing.Any]] = None) -> pathlib.Path - :canonical: cookie_composer.commands.create.create_cmd - - .. autodoc2-docstring:: cookie_composer.commands.create.create_cmd diff --git a/docsrc/apidocs/cookie_composer/cookie_composer.commands.link.rst b/docsrc/apidocs/cookie_composer/cookie_composer.commands.link.rst deleted file mode 100644 index 9b26aec..0000000 --- a/docsrc/apidocs/cookie_composer/cookie_composer.commands.link.rst +++ /dev/null @@ -1,29 +0,0 @@ -:py:mod:`cookie_composer.commands.link` -======================================= - -.. py:module:: cookie_composer.commands.link - -.. autodoc2-docstring:: cookie_composer.commands.link - :allowtitles: - -Module Contents ---------------- - -Functions -~~~~~~~~~ - -.. list-table:: - :class: autosummary longtable - :align: left - - * - :py:obj:`link_cmd ` - - .. autodoc2-docstring:: cookie_composer.commands.link.link_cmd - :summary: - -API -~~~ - -.. py:function:: link_cmd(path_or_url: str, destination_dir: typing.Optional[pathlib.Path] = None, no_input: bool = False, checkout: typing.Optional[str] = None, directory: typing.Optional[str] = None, overwrite_if_exists: bool = False, skip_if_file_exists: bool = False, default_config: bool = False, initial_context: typing.Optional[typing.MutableMapping[str, typing.Any]] = None) -> None - :canonical: cookie_composer.commands.link.link_cmd - - .. autodoc2-docstring:: cookie_composer.commands.link.link_cmd diff --git a/docsrc/apidocs/cookie_composer/cookie_composer.commands.rst b/docsrc/apidocs/cookie_composer/cookie_composer.commands.rst deleted file mode 100644 index db0f6da..0000000 --- a/docsrc/apidocs/cookie_composer/cookie_composer.commands.rst +++ /dev/null @@ -1,20 +0,0 @@ -:py:mod:`cookie_composer.commands` -================================== - -.. py:module:: cookie_composer.commands - -.. autodoc2-docstring:: cookie_composer.commands - :allowtitles: - -Submodules ----------- - -.. toctree:: - :titlesonly: - :maxdepth: 1 - - cookie_composer.commands.update - cookie_composer.commands.link - cookie_composer.commands.add - cookie_composer.commands.create - cookie_composer.commands.authn diff --git a/docsrc/apidocs/cookie_composer/cookie_composer.commands.update.rst b/docsrc/apidocs/cookie_composer/cookie_composer.commands.update.rst deleted file mode 100644 index 18003a5..0000000 --- a/docsrc/apidocs/cookie_composer/cookie_composer.commands.update.rst +++ /dev/null @@ -1,37 +0,0 @@ -:py:mod:`cookie_composer.commands.update` -========================================= - -.. py:module:: cookie_composer.commands.update - -.. autodoc2-docstring:: cookie_composer.commands.update - :allowtitles: - -Module Contents ---------------- - -Functions -~~~~~~~~~ - -.. list-table:: - :class: autosummary longtable - :align: left - - * - :py:obj:`update_cmd ` - - .. autodoc2-docstring:: cookie_composer.commands.update.update_cmd - :summary: - * - :py:obj:`update_rendered_composition_layers ` - - .. autodoc2-docstring:: cookie_composer.commands.update.update_rendered_composition_layers - :summary: - -API -~~~ - -.. py:function:: update_cmd(project_dir: typing.Optional[pathlib.Path] = None, no_input: bool = False) -> None - :canonical: cookie_composer.commands.update.update_cmd - - .. autodoc2-docstring:: cookie_composer.commands.update.update_cmd - -.. py:function:: update_rendered_composition_layers(base: cookie_composer.composition.RenderedComposition, updated_layers: typing.List[cookie_composer.layers.RenderedLayer]) -> cookie_composer.composition.RenderedComposition - :canonical: cookie_composer.commands.update.update_rendered_composition_layers - - .. autodoc2-docstring:: cookie_composer.commands.update.update_rendered_composition_layers diff --git a/docsrc/apidocs/cookie_composer/cookie_composer.composition.rst b/docsrc/apidocs/cookie_composer/cookie_composer.composition.rst deleted file mode 100644 index f0f5846..0000000 --- a/docsrc/apidocs/cookie_composer/cookie_composer.composition.rst +++ /dev/null @@ -1,100 +0,0 @@ -:py:mod:`cookie_composer.composition` -===================================== - -.. py:module:: cookie_composer.composition - -.. autodoc2-docstring:: cookie_composer.composition - :allowtitles: - -Module Contents ---------------- - -Classes -~~~~~~~ - -.. list-table:: - :class: autosummary longtable - :align: left - - * - :py:obj:`Composition ` - - .. autodoc2-docstring:: cookie_composer.composition.Composition - :summary: - * - :py:obj:`RenderedComposition ` - - .. autodoc2-docstring:: cookie_composer.composition.RenderedComposition - :summary: - -Data -~~~~ - -.. list-table:: - :class: autosummary longtable - :align: left - - * - :py:obj:`logger ` - - .. autodoc2-docstring:: cookie_composer.composition.logger - :summary: - -API -~~~ - -.. py:data:: logger - :canonical: cookie_composer.composition.logger - :value: None - - .. autodoc2-docstring:: cookie_composer.composition.logger - -.. py:class:: Composition(**data: typing.Any) - :canonical: cookie_composer.composition.Composition - - Bases: :py:obj:`pydantic.BaseModel` - - .. autodoc2-docstring:: cookie_composer.composition.Composition - - .. rubric:: Initialization - - .. autodoc2-docstring:: cookie_composer.composition.Composition.__init__ - - .. py:attribute:: layers - :canonical: cookie_composer.composition.Composition.layers - :type: typing.List[cookie_composer.layers.LayerConfig] - :value: None - - .. autodoc2-docstring:: cookie_composer.composition.Composition.layers - -.. py:class:: RenderedComposition(**data: typing.Any) - :canonical: cookie_composer.composition.RenderedComposition - - Bases: :py:obj:`pydantic.BaseModel` - - .. autodoc2-docstring:: cookie_composer.composition.RenderedComposition - - .. rubric:: Initialization - - .. autodoc2-docstring:: cookie_composer.composition.RenderedComposition.__init__ - - .. py:attribute:: layers - :canonical: cookie_composer.composition.RenderedComposition.layers - :type: typing.List[cookie_composer.layers.RenderedLayer] - :value: None - - .. autodoc2-docstring:: cookie_composer.composition.RenderedComposition.layers - - .. py:attribute:: render_dir - :canonical: cookie_composer.composition.RenderedComposition.render_dir - :type: pydantic.DirectoryPath - :value: None - - .. autodoc2-docstring:: cookie_composer.composition.RenderedComposition.render_dir - - .. py:attribute:: rendered_name - :canonical: cookie_composer.composition.RenderedComposition.rendered_name - :type: str - :value: None - - .. autodoc2-docstring:: cookie_composer.composition.RenderedComposition.rendered_name - - .. py:property:: layer_names - :canonical: cookie_composer.composition.RenderedComposition.layer_names - :type: typing.List[str] - - .. autodoc2-docstring:: cookie_composer.composition.RenderedComposition.layer_names diff --git a/docsrc/apidocs/cookie_composer/cookie_composer.data_merge.rst b/docsrc/apidocs/cookie_composer/cookie_composer.data_merge.rst deleted file mode 100644 index 4b15f0d..0000000 --- a/docsrc/apidocs/cookie_composer/cookie_composer.data_merge.rst +++ /dev/null @@ -1,147 +0,0 @@ -:py:mod:`cookie_composer.data_merge` -==================================== - -.. py:module:: cookie_composer.data_merge - -.. autodoc2-docstring:: cookie_composer.data_merge - :allowtitles: - -Module Contents ---------------- - -Classes -~~~~~~~ - -.. list-table:: - :class: autosummary longtable - :align: left - - * - :py:obj:`Context ` - - .. autodoc2-docstring:: cookie_composer.data_merge.Context - :summary: - -Functions -~~~~~~~~~ - -.. list-table:: - :class: autosummary longtable - :align: left - - * - :py:obj:`deep_merge ` - - .. autodoc2-docstring:: cookie_composer.data_merge.deep_merge - :summary: - * - :py:obj:`merge_iterables ` - - .. autodoc2-docstring:: cookie_composer.data_merge.merge_iterables - :summary: - * - :py:obj:`comprehensive_merge ` - - .. autodoc2-docstring:: cookie_composer.data_merge.comprehensive_merge - :summary: - * - :py:obj:`freeze_data ` - - .. autodoc2-docstring:: cookie_composer.data_merge.freeze_data - :summary: - * - :py:obj:`get_merge_strategy ` - - .. autodoc2-docstring:: cookie_composer.data_merge.get_merge_strategy - :summary: - -Data -~~~~ - -.. list-table:: - :class: autosummary longtable - :align: left - - * - :py:obj:`logger ` - - .. autodoc2-docstring:: cookie_composer.data_merge.logger - :summary: - * - :py:obj:`DO_NOT_MERGE ` - - .. autodoc2-docstring:: cookie_composer.data_merge.DO_NOT_MERGE - :summary: - * - :py:obj:`NESTED_OVERWRITE ` - - .. autodoc2-docstring:: cookie_composer.data_merge.NESTED_OVERWRITE - :summary: - * - :py:obj:`OVERWRITE ` - - .. autodoc2-docstring:: cookie_composer.data_merge.OVERWRITE - :summary: - * - :py:obj:`COMPREHENSIVE ` - - .. autodoc2-docstring:: cookie_composer.data_merge.COMPREHENSIVE - :summary: - -API -~~~ - -.. py:data:: logger - :canonical: cookie_composer.data_merge.logger - :value: None - - .. autodoc2-docstring:: cookie_composer.data_merge.logger - -.. py:function:: deep_merge(*dicts: dict) -> dict - :canonical: cookie_composer.data_merge.deep_merge - - .. autodoc2-docstring:: cookie_composer.data_merge.deep_merge - -.. py:function:: merge_iterables(iter1: typing.Iterable, iter2: typing.Iterable) -> set - :canonical: cookie_composer.data_merge.merge_iterables - - .. autodoc2-docstring:: cookie_composer.data_merge.merge_iterables - -.. py:function:: comprehensive_merge(*args: typing.MutableMapping) -> typing.Any - :canonical: cookie_composer.data_merge.comprehensive_merge - - .. autodoc2-docstring:: cookie_composer.data_merge.comprehensive_merge - -.. py:class:: Context(*maps) - :canonical: cookie_composer.data_merge.Context - - Bases: :py:obj:`collections.ChainMap` - - .. autodoc2-docstring:: cookie_composer.data_merge.Context - - .. rubric:: Initialization - - .. autodoc2-docstring:: cookie_composer.data_merge.Context.__init__ - - .. py:property:: is_empty - :canonical: cookie_composer.data_merge.Context.is_empty - :type: bool - - .. autodoc2-docstring:: cookie_composer.data_merge.Context.is_empty - - .. py:method:: flatten() -> typing.MutableMapping - :canonical: cookie_composer.data_merge.Context.flatten - - .. autodoc2-docstring:: cookie_composer.data_merge.Context.flatten - -.. py:function:: freeze_data(obj: typing.Any) -> typing.Any - :canonical: cookie_composer.data_merge.freeze_data - - .. autodoc2-docstring:: cookie_composer.data_merge.freeze_data - -.. py:data:: DO_NOT_MERGE - :canonical: cookie_composer.data_merge.DO_NOT_MERGE - :value: 'do-not-merge' - - .. autodoc2-docstring:: cookie_composer.data_merge.DO_NOT_MERGE - -.. py:data:: NESTED_OVERWRITE - :canonical: cookie_composer.data_merge.NESTED_OVERWRITE - :value: 'nested-overwrite' - - .. autodoc2-docstring:: cookie_composer.data_merge.NESTED_OVERWRITE - -.. py:data:: OVERWRITE - :canonical: cookie_composer.data_merge.OVERWRITE - :value: 'overwrite' - - .. autodoc2-docstring:: cookie_composer.data_merge.OVERWRITE - -.. py:data:: COMPREHENSIVE - :canonical: cookie_composer.data_merge.COMPREHENSIVE - :value: 'comprehensive' - - .. autodoc2-docstring:: cookie_composer.data_merge.COMPREHENSIVE - -.. py:function:: get_merge_strategy(path: pathlib.Path, merge_strategies: typing.Dict[str, str]) -> str - :canonical: cookie_composer.data_merge.get_merge_strategy - - .. autodoc2-docstring:: cookie_composer.data_merge.get_merge_strategy diff --git a/docsrc/apidocs/cookie_composer/cookie_composer.diff.rst b/docsrc/apidocs/cookie_composer/cookie_composer.diff.rst deleted file mode 100644 index 132082d..0000000 --- a/docsrc/apidocs/cookie_composer/cookie_composer.diff.rst +++ /dev/null @@ -1,79 +0,0 @@ -:py:mod:`cookie_composer.diff` -============================== - -.. py:module:: cookie_composer.diff - -.. autodoc2-docstring:: cookie_composer.diff - :allowtitles: - -Module Contents ---------------- - -Functions -~~~~~~~~~ - -.. list-table:: - :class: autosummary longtable - :align: left - - * - :py:obj:`_git_diff_command ` - - .. autodoc2-docstring:: cookie_composer.diff._git_diff_command - :summary: - * - :py:obj:`get_diff ` - - .. autodoc2-docstring:: cookie_composer.diff.get_diff - :summary: - * - :py:obj:`replace_diff_prefixes ` - - .. autodoc2-docstring:: cookie_composer.diff.replace_diff_prefixes - :summary: - * - :py:obj:`display_diff ` - - .. autodoc2-docstring:: cookie_composer.diff.display_diff - :summary: - -Data -~~~~ - -.. list-table:: - :class: autosummary longtable - :align: left - - * - :py:obj:`DIFF_SRC_PREFIX ` - - .. autodoc2-docstring:: cookie_composer.diff.DIFF_SRC_PREFIX - :summary: - * - :py:obj:`DIFF_DST_PREFIX ` - - .. autodoc2-docstring:: cookie_composer.diff.DIFF_DST_PREFIX - :summary: - -API -~~~ - -.. py:data:: DIFF_SRC_PREFIX - :canonical: cookie_composer.diff.DIFF_SRC_PREFIX - :value: 'upstream-template-old' - - .. autodoc2-docstring:: cookie_composer.diff.DIFF_SRC_PREFIX - -.. py:data:: DIFF_DST_PREFIX - :canonical: cookie_composer.diff.DIFF_DST_PREFIX - :value: 'upstream-template-new' - - .. autodoc2-docstring:: cookie_composer.diff.DIFF_DST_PREFIX - -.. py:function:: _git_diff_command(*args: str) -> typing.List[str] - :canonical: cookie_composer.diff._git_diff_command - - .. autodoc2-docstring:: cookie_composer.diff._git_diff_command - -.. py:function:: get_diff(repo0: pathlib.Path, repo1: pathlib.Path) -> str - :canonical: cookie_composer.diff.get_diff - - .. autodoc2-docstring:: cookie_composer.diff.get_diff - -.. py:function:: replace_diff_prefixes(diff: str, repo0_path: str, repo1_path: str) -> str - :canonical: cookie_composer.diff.replace_diff_prefixes - - .. autodoc2-docstring:: cookie_composer.diff.replace_diff_prefixes - -.. py:function:: display_diff(repo0: pathlib.Path, repo1: pathlib.Path) -> None - :canonical: cookie_composer.diff.display_diff - - .. autodoc2-docstring:: cookie_composer.diff.display_diff diff --git a/docsrc/apidocs/cookie_composer/cookie_composer.exceptions.rst b/docsrc/apidocs/cookie_composer/cookie_composer.exceptions.rst deleted file mode 100644 index 2669364..0000000 --- a/docsrc/apidocs/cookie_composer/cookie_composer.exceptions.rst +++ /dev/null @@ -1,101 +0,0 @@ -:py:mod:`cookie_composer.exceptions` -==================================== - -.. py:module:: cookie_composer.exceptions - -.. autodoc2-docstring:: cookie_composer.exceptions - :allowtitles: - -Module Contents ---------------- - -API -~~~ - -.. py:exception:: MissingCompositionFileError(path_or_url: str) - :canonical: cookie_composer.exceptions.MissingCompositionFileError - - Bases: :py:obj:`Exception` - - .. autodoc2-docstring:: cookie_composer.exceptions.MissingCompositionFileError - - .. rubric:: Initialization - - .. autodoc2-docstring:: cookie_composer.exceptions.MissingCompositionFileError.__init__ - -.. py:exception:: MergeError(origin: typing.Optional[str] = None, destination: typing.Optional[str] = None, strategy: typing.Optional[str] = None, error_message: typing.Optional[str] = '') - :canonical: cookie_composer.exceptions.MergeError - - Bases: :py:obj:`Exception` - - .. autodoc2-docstring:: cookie_composer.exceptions.MergeError - - .. rubric:: Initialization - - .. autodoc2-docstring:: cookie_composer.exceptions.MergeError.__init__ - -.. py:exception:: GitError() - :canonical: cookie_composer.exceptions.GitError - - Bases: :py:obj:`Exception` - - .. autodoc2-docstring:: cookie_composer.exceptions.GitError - - .. rubric:: Initialization - - .. autodoc2-docstring:: cookie_composer.exceptions.GitError.__init__ - -.. py:exception:: ChangesetUnicodeError() - :canonical: cookie_composer.exceptions.ChangesetUnicodeError - - Bases: :py:obj:`Exception` - - .. autodoc2-docstring:: cookie_composer.exceptions.ChangesetUnicodeError - - .. rubric:: Initialization - - .. autodoc2-docstring:: cookie_composer.exceptions.ChangesetUnicodeError.__init__ - -.. py:exception:: InvalidZipRepositoryError(message: str = '') - :canonical: cookie_composer.exceptions.InvalidZipRepositoryError - - Bases: :py:obj:`Exception` - - .. autodoc2-docstring:: cookie_composer.exceptions.InvalidZipRepositoryError - - .. rubric:: Initialization - - .. autodoc2-docstring:: cookie_composer.exceptions.InvalidZipRepositoryError.__init__ - -.. py:exception:: EmptyZipRepositoryError(url: str) - :canonical: cookie_composer.exceptions.EmptyZipRepositoryError - - Bases: :py:obj:`cookie_composer.exceptions.InvalidZipRepositoryError` - - .. autodoc2-docstring:: cookie_composer.exceptions.EmptyZipRepositoryError - - .. rubric:: Initialization - - .. autodoc2-docstring:: cookie_composer.exceptions.EmptyZipRepositoryError.__init__ - -.. py:exception:: NoZipDirectoryError(url: str) - :canonical: cookie_composer.exceptions.NoZipDirectoryError - - Bases: :py:obj:`cookie_composer.exceptions.InvalidZipRepositoryError` - - .. autodoc2-docstring:: cookie_composer.exceptions.NoZipDirectoryError - - .. rubric:: Initialization - - .. autodoc2-docstring:: cookie_composer.exceptions.NoZipDirectoryError.__init__ - -.. py:exception:: InvalidZipPasswordError() - :canonical: cookie_composer.exceptions.InvalidZipPasswordError - - Bases: :py:obj:`cookie_composer.exceptions.InvalidZipRepositoryError` - - .. autodoc2-docstring:: cookie_composer.exceptions.InvalidZipPasswordError - - .. rubric:: Initialization - - .. autodoc2-docstring:: cookie_composer.exceptions.InvalidZipPasswordError.__init__ diff --git a/docsrc/apidocs/cookie_composer/cookie_composer.git_commands.rst b/docsrc/apidocs/cookie_composer/cookie_composer.git_commands.rst deleted file mode 100644 index 050e577..0000000 --- a/docsrc/apidocs/cookie_composer/cookie_composer.git_commands.rst +++ /dev/null @@ -1,124 +0,0 @@ -:py:mod:`cookie_composer.git_commands` -====================================== - -.. py:module:: cookie_composer.git_commands - -.. autodoc2-docstring:: cookie_composer.git_commands - :allowtitles: - -Module Contents ---------------- - -Classes -~~~~~~~ - -.. list-table:: - :class: autosummary longtable - :align: left - - * - :py:obj:`TempGitWorktreeDir ` - - .. autodoc2-docstring:: cookie_composer.git_commands.TempGitWorktreeDir - :summary: - -Functions -~~~~~~~~~ - -.. list-table:: - :class: autosummary longtable - :align: left - - * - :py:obj:`get_repo ` - - .. autodoc2-docstring:: cookie_composer.git_commands.get_repo - :summary: - * - :py:obj:`clone ` - - .. autodoc2-docstring:: cookie_composer.git_commands.clone - :summary: - * - :py:obj:`branch_exists ` - - .. autodoc2-docstring:: cookie_composer.git_commands.branch_exists - :summary: - * - :py:obj:`remote_branch_exists ` - - .. autodoc2-docstring:: cookie_composer.git_commands.remote_branch_exists - :summary: - * - :py:obj:`checkout_ref ` - - .. autodoc2-docstring:: cookie_composer.git_commands.checkout_ref - :summary: - * - :py:obj:`checkout_branch ` - - .. autodoc2-docstring:: cookie_composer.git_commands.checkout_branch - :summary: - * - :py:obj:`apply_patch ` - - .. autodoc2-docstring:: cookie_composer.git_commands.apply_patch - :summary: - -Data -~~~~ - -.. list-table:: - :class: autosummary longtable - :align: left - - * - :py:obj:`logger ` - - .. autodoc2-docstring:: cookie_composer.git_commands.logger - :summary: - -API -~~~ - -.. py:data:: logger - :canonical: cookie_composer.git_commands.logger - :value: None - - .. autodoc2-docstring:: cookie_composer.git_commands.logger - -.. py:function:: get_repo(project_dir: typing.Union[str, pathlib.Path], search_parent_directories: bool = False, ensure_clean: bool = False) -> git.Repo - :canonical: cookie_composer.git_commands.get_repo - - .. autodoc2-docstring:: cookie_composer.git_commands.get_repo - -.. py:function:: clone(repo_url: str, dest_path: typing.Optional[pathlib.Path] = None) -> git.Repo - :canonical: cookie_composer.git_commands.clone - - .. autodoc2-docstring:: cookie_composer.git_commands.clone - -.. py:function:: branch_exists(repo: git.Repo, branch_name: str) -> bool - :canonical: cookie_composer.git_commands.branch_exists - - .. autodoc2-docstring:: cookie_composer.git_commands.branch_exists - -.. py:function:: remote_branch_exists(repo: git.Repo, branch_name: str, remote_name: str = 'origin') -> bool - :canonical: cookie_composer.git_commands.remote_branch_exists - - .. autodoc2-docstring:: cookie_composer.git_commands.remote_branch_exists - -.. py:function:: checkout_ref(repo: git.Repo, ref: str) -> None - :canonical: cookie_composer.git_commands.checkout_ref - - .. autodoc2-docstring:: cookie_composer.git_commands.checkout_ref - -.. py:function:: checkout_branch(repo: git.Repo, branch_name: str, remote_name: str = 'origin') -> None - :canonical: cookie_composer.git_commands.checkout_branch - - .. autodoc2-docstring:: cookie_composer.git_commands.checkout_branch - -.. py:function:: apply_patch(repo: git.Repo, diff: str) -> None - :canonical: cookie_composer.git_commands.apply_patch - - .. autodoc2-docstring:: cookie_composer.git_commands.apply_patch - -.. py:class:: TempGitWorktreeDir(worktree_path: pathlib.Path, repo_path: pathlib.Path, branch: str = 'master') - :canonical: cookie_composer.git_commands.TempGitWorktreeDir - - .. autodoc2-docstring:: cookie_composer.git_commands.TempGitWorktreeDir - - .. rubric:: Initialization - - .. autodoc2-docstring:: cookie_composer.git_commands.TempGitWorktreeDir.__init__ - - .. py:method:: __enter__() - :canonical: cookie_composer.git_commands.TempGitWorktreeDir.__enter__ - - .. autodoc2-docstring:: cookie_composer.git_commands.TempGitWorktreeDir.__enter__ - - .. py:method:: __exit__(type, value, traceback) - :canonical: cookie_composer.git_commands.TempGitWorktreeDir.__exit__ - - .. autodoc2-docstring:: cookie_composer.git_commands.TempGitWorktreeDir.__exit__ diff --git a/docsrc/apidocs/cookie_composer/cookie_composer.io.rst b/docsrc/apidocs/cookie_composer/cookie_composer.io.rst deleted file mode 100644 index a9ac501..0000000 --- a/docsrc/apidocs/cookie_composer/cookie_composer.io.rst +++ /dev/null @@ -1,141 +0,0 @@ -:py:mod:`cookie_composer.io` -============================ - -.. py:module:: cookie_composer.io - -.. autodoc2-docstring:: cookie_composer.io - :allowtitles: - -Module Contents ---------------- - -Functions -~~~~~~~~~ - -.. list-table:: - :class: autosummary longtable - :align: left - - * - :py:obj:`serialize_layer ` - - .. autodoc2-docstring:: cookie_composer.io.serialize_layer - :summary: - * - :py:obj:`deserialize_layer ` - - .. autodoc2-docstring:: cookie_composer.io.deserialize_layer - :summary: - * - :py:obj:`serialize_rendered_layer ` - - .. autodoc2-docstring:: cookie_composer.io.serialize_rendered_layer - :summary: - * - :py:obj:`deserialize_rendered_layer ` - - .. autodoc2-docstring:: cookie_composer.io.deserialize_rendered_layer - :summary: - * - :py:obj:`serialize_composition ` - - .. autodoc2-docstring:: cookie_composer.io.serialize_composition - :summary: - * - :py:obj:`deserialize_composition ` - - .. autodoc2-docstring:: cookie_composer.io.deserialize_composition - :summary: - * - :py:obj:`serialize_rendered_composition ` - - .. autodoc2-docstring:: cookie_composer.io.serialize_rendered_composition - :summary: - * - :py:obj:`deserialize_rendered_composition ` - - .. autodoc2-docstring:: cookie_composer.io.deserialize_rendered_composition - :summary: - * - :py:obj:`read_yaml ` - - .. autodoc2-docstring:: cookie_composer.io.read_yaml - :summary: - * - :py:obj:`write_yaml ` - - .. autodoc2-docstring:: cookie_composer.io.write_yaml - :summary: - * - :py:obj:`is_composition_file ` - - .. autodoc2-docstring:: cookie_composer.io.is_composition_file - :summary: - * - :py:obj:`read_composition ` - - .. autodoc2-docstring:: cookie_composer.io.read_composition - :summary: - * - :py:obj:`read_rendered_composition ` - - .. autodoc2-docstring:: cookie_composer.io.read_rendered_composition - :summary: - * - :py:obj:`write_rendered_composition ` - - .. autodoc2-docstring:: cookie_composer.io.write_rendered_composition - :summary: - * - :py:obj:`get_composition_from_path_or_url ` - - .. autodoc2-docstring:: cookie_composer.io.get_composition_from_path_or_url - :summary: - -API -~~~ - -.. py:function:: serialize_layer(layer: cookie_composer.layers.LayerConfig) -> dict - :canonical: cookie_composer.io.serialize_layer - - .. autodoc2-docstring:: cookie_composer.io.serialize_layer - -.. py:function:: deserialize_layer(layer_info: dict, local_path: typing.Optional[pathlib.Path] = None, **kwargs) -> cookie_composer.layers.LayerConfig - :canonical: cookie_composer.io.deserialize_layer - - .. autodoc2-docstring:: cookie_composer.io.deserialize_layer - -.. py:function:: serialize_rendered_layer(rendered_layer: cookie_composer.layers.RenderedLayer) -> dict - :canonical: cookie_composer.io.serialize_rendered_layer - - .. autodoc2-docstring:: cookie_composer.io.serialize_rendered_layer - -.. py:function:: deserialize_rendered_layer(rendered_layer_info: dict, location: pathlib.Path) -> cookie_composer.layers.RenderedLayer - :canonical: cookie_composer.io.deserialize_rendered_layer - - .. autodoc2-docstring:: cookie_composer.io.deserialize_rendered_layer - -.. py:function:: serialize_composition(layers: typing.List[cookie_composer.layers.LayerConfig]) -> typing.List[dict] - :canonical: cookie_composer.io.serialize_composition - - .. autodoc2-docstring:: cookie_composer.io.serialize_composition - -.. py:function:: deserialize_composition(composition_info: typing.List[dict], local_path: typing.Optional[pathlib.Path] = None, **kwargs) -> cookie_composer.composition.Composition - :canonical: cookie_composer.io.deserialize_composition - - .. autodoc2-docstring:: cookie_composer.io.deserialize_composition - -.. py:function:: serialize_rendered_composition(composition: cookie_composer.composition.RenderedComposition) -> typing.List[dict] - :canonical: cookie_composer.io.serialize_rendered_composition - - .. autodoc2-docstring:: cookie_composer.io.serialize_rendered_composition - -.. py:function:: deserialize_rendered_composition(composition_info: typing.List[dict], location: pathlib.Path) -> cookie_composer.composition.RenderedComposition - :canonical: cookie_composer.io.deserialize_rendered_composition - - .. autodoc2-docstring:: cookie_composer.io.deserialize_rendered_composition - -.. py:function:: read_yaml(path_or_url: typing.Union[str, pathlib.Path]) -> typing.List[dict] - :canonical: cookie_composer.io.read_yaml - - .. autodoc2-docstring:: cookie_composer.io.read_yaml - -.. py:function:: write_yaml(path: pathlib.Path, contents: typing.List[dict]) -> None - :canonical: cookie_composer.io.write_yaml - - .. autodoc2-docstring:: cookie_composer.io.write_yaml - -.. py:function:: is_composition_file(path_or_url: typing.Union[str, pathlib.Path]) -> bool - :canonical: cookie_composer.io.is_composition_file - - .. autodoc2-docstring:: cookie_composer.io.is_composition_file - -.. py:function:: read_composition(path_or_url: typing.Union[str, pathlib.Path], **kwargs) -> cookie_composer.composition.Composition - :canonical: cookie_composer.io.read_composition - - .. autodoc2-docstring:: cookie_composer.io.read_composition - -.. py:function:: read_rendered_composition(path: pathlib.Path) -> cookie_composer.composition.RenderedComposition - :canonical: cookie_composer.io.read_rendered_composition - - .. autodoc2-docstring:: cookie_composer.io.read_rendered_composition - -.. py:function:: write_rendered_composition(composition: cookie_composer.composition.RenderedComposition) -> None - :canonical: cookie_composer.io.write_rendered_composition - - .. autodoc2-docstring:: cookie_composer.io.write_rendered_composition - -.. py:function:: get_composition_from_path_or_url(path_or_url: str, checkout: typing.Optional[str] = None, default_config: bool = False, directory: typing.Optional[str] = None, no_input: bool = False, output_dir: typing.Optional[pathlib.Path] = None, overwrite_if_exists: bool = False, skip_if_file_exists: bool = False, initial_context: typing.Optional[typing.MutableMapping[str, typing.Any]] = None) -> cookie_composer.composition.Composition - :canonical: cookie_composer.io.get_composition_from_path_or_url - - .. autodoc2-docstring:: cookie_composer.io.get_composition_from_path_or_url diff --git a/docsrc/apidocs/cookie_composer/cookie_composer.layers.rst b/docsrc/apidocs/cookie_composer/cookie_composer.layers.rst deleted file mode 100644 index 519779d..0000000 --- a/docsrc/apidocs/cookie_composer/cookie_composer.layers.rst +++ /dev/null @@ -1,274 +0,0 @@ -:py:mod:`cookie_composer.layers` -================================ - -.. py:module:: cookie_composer.layers - -.. autodoc2-docstring:: cookie_composer.layers - :allowtitles: - -Module Contents ---------------- - -Classes -~~~~~~~ - -.. list-table:: - :class: autosummary longtable - :align: left - - * - :py:obj:`WriteStrategy ` - - .. autodoc2-docstring:: cookie_composer.layers.WriteStrategy - :summary: - * - :py:obj:`LayerConfig ` - - .. autodoc2-docstring:: cookie_composer.layers.LayerConfig - :summary: - * - :py:obj:`RenderedLayer ` - - .. autodoc2-docstring:: cookie_composer.layers.RenderedLayer - :summary: - -Functions -~~~~~~~~~ - -.. list-table:: - :class: autosummary longtable - :align: left - - * - :py:obj:`get_write_strategy ` - - .. autodoc2-docstring:: cookie_composer.layers.get_write_strategy - :summary: - * - :py:obj:`get_template_rendered_name ` - - .. autodoc2-docstring:: cookie_composer.layers.get_template_rendered_name - :summary: - * - :py:obj:`render_layer ` - - .. autodoc2-docstring:: cookie_composer.layers.render_layer - :summary: - * - :py:obj:`get_layer_context ` - - .. autodoc2-docstring:: cookie_composer.layers.get_layer_context - :summary: - * - :py:obj:`render_layers ` - - .. autodoc2-docstring:: cookie_composer.layers.render_layers - :summary: - * - :py:obj:`get_accept_hooks_per_layer ` - - .. autodoc2-docstring:: cookie_composer.layers.get_accept_hooks_per_layer - :summary: - * - :py:obj:`merge_layers ` - - .. autodoc2-docstring:: cookie_composer.layers.merge_layers - :summary: - -Data -~~~~ - -.. list-table:: - :class: autosummary longtable - :align: left - - * - :py:obj:`logger ` - - .. autodoc2-docstring:: cookie_composer.layers.logger - :summary: - -API -~~~ - -.. py:data:: logger - :canonical: cookie_composer.layers.logger - :value: None - - .. autodoc2-docstring:: cookie_composer.layers.logger - -.. py:class:: WriteStrategy - :canonical: cookie_composer.layers.WriteStrategy - - Bases: :py:obj:`enum.Enum` - - .. autodoc2-docstring:: cookie_composer.layers.WriteStrategy - - .. py:attribute:: WRITE - :canonical: cookie_composer.layers.WriteStrategy.WRITE - :value: 1 - - .. autodoc2-docstring:: cookie_composer.layers.WriteStrategy.WRITE - - .. py:attribute:: SKIP - :canonical: cookie_composer.layers.WriteStrategy.SKIP - :value: 2 - - .. autodoc2-docstring:: cookie_composer.layers.WriteStrategy.SKIP - - .. py:attribute:: MERGE - :canonical: cookie_composer.layers.WriteStrategy.MERGE - :value: 3 - - .. autodoc2-docstring:: cookie_composer.layers.WriteStrategy.MERGE - -.. py:class:: LayerConfig(**data: typing.Any) - :canonical: cookie_composer.layers.LayerConfig - - Bases: :py:obj:`pydantic.BaseModel` - - .. autodoc2-docstring:: cookie_composer.layers.LayerConfig - - .. rubric:: Initialization - - .. autodoc2-docstring:: cookie_composer.layers.LayerConfig.__init__ - - .. py:attribute:: template - :canonical: cookie_composer.layers.LayerConfig.template - :type: cookie_composer.templates.types.Template - :value: None - - .. autodoc2-docstring:: cookie_composer.layers.LayerConfig.template - - .. py:attribute:: no_input - :canonical: cookie_composer.layers.LayerConfig.no_input - :type: bool - :value: False - - .. autodoc2-docstring:: cookie_composer.layers.LayerConfig.no_input - - .. py:attribute:: initial_context - :canonical: cookie_composer.layers.LayerConfig.initial_context - :type: typing.MutableMapping[str, typing.Any] - :value: None - - .. autodoc2-docstring:: cookie_composer.layers.LayerConfig.initial_context - - .. py:attribute:: skip_hooks - :canonical: cookie_composer.layers.LayerConfig.skip_hooks - :type: bool - :value: False - - .. autodoc2-docstring:: cookie_composer.layers.LayerConfig.skip_hooks - - .. py:attribute:: skip_if_file_exists - :canonical: cookie_composer.layers.LayerConfig.skip_if_file_exists - :type: bool - :value: True - - .. autodoc2-docstring:: cookie_composer.layers.LayerConfig.skip_if_file_exists - - .. py:attribute:: skip_generation - :canonical: cookie_composer.layers.LayerConfig.skip_generation - :type: typing.List[str] - :value: None - - .. autodoc2-docstring:: cookie_composer.layers.LayerConfig.skip_generation - - .. py:attribute:: overwrite - :canonical: cookie_composer.layers.LayerConfig.overwrite - :type: typing.List[str] - :value: None - - .. autodoc2-docstring:: cookie_composer.layers.LayerConfig.overwrite - - .. py:attribute:: overwrite_exclude - :canonical: cookie_composer.layers.LayerConfig.overwrite_exclude - :type: typing.List[str] - :value: None - - .. autodoc2-docstring:: cookie_composer.layers.LayerConfig.overwrite_exclude - - .. py:attribute:: merge_strategies - :canonical: cookie_composer.layers.LayerConfig.merge_strategies - :type: typing.Dict[str, str] - :value: None - - .. autodoc2-docstring:: cookie_composer.layers.LayerConfig.merge_strategies - - .. py:property:: layer_name - :canonical: cookie_composer.layers.LayerConfig.layer_name - :type: str - - .. autodoc2-docstring:: cookie_composer.layers.LayerConfig.layer_name - -.. py:class:: RenderedLayer(**data: typing.Any) - :canonical: cookie_composer.layers.RenderedLayer - - Bases: :py:obj:`pydantic.BaseModel` - - .. autodoc2-docstring:: cookie_composer.layers.RenderedLayer - - .. rubric:: Initialization - - .. autodoc2-docstring:: cookie_composer.layers.RenderedLayer.__init__ - - .. py:attribute:: layer - :canonical: cookie_composer.layers.RenderedLayer.layer - :type: cookie_composer.layers.LayerConfig - :value: None - - .. autodoc2-docstring:: cookie_composer.layers.RenderedLayer.layer - - .. py:attribute:: location - :canonical: cookie_composer.layers.RenderedLayer.location - :type: pydantic.DirectoryPath - :value: None - - .. autodoc2-docstring:: cookie_composer.layers.RenderedLayer.location - - .. py:attribute:: rendered_context - :canonical: cookie_composer.layers.RenderedLayer.rendered_context - :type: typing.MutableMapping[str, typing.Any] - :value: None - - .. autodoc2-docstring:: cookie_composer.layers.RenderedLayer.rendered_context - - .. py:attribute:: rendered_commit - :canonical: cookie_composer.layers.RenderedLayer.rendered_commit - :type: typing.Optional[str] - :value: None - - .. autodoc2-docstring:: cookie_composer.layers.RenderedLayer.rendered_commit - - .. py:attribute:: rendered_name - :canonical: cookie_composer.layers.RenderedLayer.rendered_name - :type: typing.Optional[str] - :value: None - - .. autodoc2-docstring:: cookie_composer.layers.RenderedLayer.rendered_name - - .. py:property:: latest_commit - :canonical: cookie_composer.layers.RenderedLayer.latest_commit - :type: typing.Optional[str] - - .. autodoc2-docstring:: cookie_composer.layers.RenderedLayer.latest_commit - - .. py:method:: set_rendered_name(values: typing.Dict[str, typing.Any]) -> typing.Dict[str, typing.Any] - :canonical: cookie_composer.layers.RenderedLayer.set_rendered_name - :classmethod: - - .. autodoc2-docstring:: cookie_composer.layers.RenderedLayer.set_rendered_name - -.. py:function:: get_write_strategy(origin: pathlib.Path, destination: pathlib.Path, rendered_layer: cookie_composer.layers.RenderedLayer) -> cookie_composer.layers.WriteStrategy - :canonical: cookie_composer.layers.get_write_strategy - - .. autodoc2-docstring:: cookie_composer.layers.get_write_strategy - -.. py:function:: get_template_rendered_name(template: cookie_composer.templates.types.Template, context: typing.MutableMapping) -> str - :canonical: cookie_composer.layers.get_template_rendered_name - - .. autodoc2-docstring:: cookie_composer.layers.get_template_rendered_name - -.. py:function:: render_layer(layer_config: cookie_composer.layers.LayerConfig, render_dir: pathlib.Path, full_context: typing.Optional[cookie_composer.data_merge.Context] = None, accept_hooks: str = 'yes') -> cookie_composer.layers.RenderedLayer - :canonical: cookie_composer.layers.render_layer - - .. autodoc2-docstring:: cookie_composer.layers.render_layer - -.. py:function:: get_layer_context(layer_config: cookie_composer.layers.LayerConfig, user_config: dict, full_context: typing.Optional[cookie_composer.data_merge.Context] = None) -> cookie_composer.data_merge.Context - :canonical: cookie_composer.layers.get_layer_context - - .. autodoc2-docstring:: cookie_composer.layers.get_layer_context - -.. py:function:: render_layers(layers: typing.List[cookie_composer.layers.LayerConfig], destination: pathlib.Path, initial_context: typing.Optional[dict] = None, no_input: bool = False, accept_hooks: str = 'all') -> typing.List[cookie_composer.layers.RenderedLayer] - :canonical: cookie_composer.layers.render_layers - - .. autodoc2-docstring:: cookie_composer.layers.render_layers - -.. py:function:: get_accept_hooks_per_layer(accept_hooks: str, num_layers: int) -> list - :canonical: cookie_composer.layers.get_accept_hooks_per_layer - - .. autodoc2-docstring:: cookie_composer.layers.get_accept_hooks_per_layer - -.. py:function:: merge_layers(destination: pathlib.Path, rendered_layer: cookie_composer.layers.RenderedLayer) -> None - :canonical: cookie_composer.layers.merge_layers - - .. autodoc2-docstring:: cookie_composer.layers.merge_layers diff --git a/docsrc/apidocs/cookie_composer/cookie_composer.matching.rst b/docsrc/apidocs/cookie_composer/cookie_composer.matching.rst deleted file mode 100644 index e0de555..0000000 --- a/docsrc/apidocs/cookie_composer/cookie_composer.matching.rst +++ /dev/null @@ -1,37 +0,0 @@ -:py:mod:`cookie_composer.matching` -================================== - -.. py:module:: cookie_composer.matching - -.. autodoc2-docstring:: cookie_composer.matching - :allowtitles: - -Module Contents ---------------- - -Functions -~~~~~~~~~ - -.. list-table:: - :class: autosummary longtable - :align: left - - * - :py:obj:`rel_fnmatch ` - - .. autodoc2-docstring:: cookie_composer.matching.rel_fnmatch - :summary: - * - :py:obj:`matches_any_glob ` - - .. autodoc2-docstring:: cookie_composer.matching.matches_any_glob - :summary: - -API -~~~ - -.. py:function:: rel_fnmatch(name: str, pat: str) -> bool - :canonical: cookie_composer.matching.rel_fnmatch - - .. autodoc2-docstring:: cookie_composer.matching.rel_fnmatch - -.. py:function:: matches_any_glob(path: typing.Union[str, pathlib.Path], patterns: typing.List[str]) -> bool - :canonical: cookie_composer.matching.matches_any_glob - - .. autodoc2-docstring:: cookie_composer.matching.matches_any_glob diff --git a/docsrc/apidocs/cookie_composer/cookie_composer.merge_files.ini_file.rst b/docsrc/apidocs/cookie_composer/cookie_composer.merge_files.ini_file.rst deleted file mode 100644 index c8ef8b9..0000000 --- a/docsrc/apidocs/cookie_composer/cookie_composer.merge_files.ini_file.rst +++ /dev/null @@ -1,45 +0,0 @@ -:py:mod:`cookie_composer.merge_files.ini_file` -============================================== - -.. py:module:: cookie_composer.merge_files.ini_file - -.. autodoc2-docstring:: cookie_composer.merge_files.ini_file - :allowtitles: - -Module Contents ---------------- - -Functions -~~~~~~~~~ - -.. list-table:: - :class: autosummary longtable - :align: left - - * - :py:obj:`merge_ini_files ` - - .. autodoc2-docstring:: cookie_composer.merge_files.ini_file.merge_ini_files - :summary: - * - :py:obj:`config_to_dict ` - - .. autodoc2-docstring:: cookie_composer.merge_files.ini_file.config_to_dict - :summary: - * - :py:obj:`dict_to_config ` - - .. autodoc2-docstring:: cookie_composer.merge_files.ini_file.dict_to_config - :summary: - -API -~~~ - -.. py:function:: merge_ini_files(new_file: pathlib.Path, existing_file: pathlib.Path, merge_strategy: str) -> None - :canonical: cookie_composer.merge_files.ini_file.merge_ini_files - - .. autodoc2-docstring:: cookie_composer.merge_files.ini_file.merge_ini_files - -.. py:function:: config_to_dict(config: configparser.ConfigParser) -> dict - :canonical: cookie_composer.merge_files.ini_file.config_to_dict - - .. autodoc2-docstring:: cookie_composer.merge_files.ini_file.config_to_dict - -.. py:function:: dict_to_config(dictionary: dict) -> configparser.ConfigParser - :canonical: cookie_composer.merge_files.ini_file.dict_to_config - - .. autodoc2-docstring:: cookie_composer.merge_files.ini_file.dict_to_config diff --git a/docsrc/apidocs/cookie_composer/cookie_composer.merge_files.json_file.rst b/docsrc/apidocs/cookie_composer/cookie_composer.merge_files.json_file.rst deleted file mode 100644 index 1073036..0000000 --- a/docsrc/apidocs/cookie_composer/cookie_composer.merge_files.json_file.rst +++ /dev/null @@ -1,37 +0,0 @@ -:py:mod:`cookie_composer.merge_files.json_file` -=============================================== - -.. py:module:: cookie_composer.merge_files.json_file - -.. autodoc2-docstring:: cookie_composer.merge_files.json_file - :allowtitles: - -Module Contents ---------------- - -Functions -~~~~~~~~~ - -.. list-table:: - :class: autosummary longtable - :align: left - - * - :py:obj:`default ` - - .. autodoc2-docstring:: cookie_composer.merge_files.json_file.default - :summary: - * - :py:obj:`merge_json_files ` - - .. autodoc2-docstring:: cookie_composer.merge_files.json_file.merge_json_files - :summary: - -API -~~~ - -.. py:function:: default(obj: typing.Any) -> dict - :canonical: cookie_composer.merge_files.json_file.default - - .. autodoc2-docstring:: cookie_composer.merge_files.json_file.default - -.. py:function:: merge_json_files(new_file: pathlib.Path, existing_file: pathlib.Path, merge_strategy: str) -> None - :canonical: cookie_composer.merge_files.json_file.merge_json_files - - .. autodoc2-docstring:: cookie_composer.merge_files.json_file.merge_json_files diff --git a/docsrc/apidocs/cookie_composer/cookie_composer.merge_files.rst b/docsrc/apidocs/cookie_composer/cookie_composer.merge_files.rst deleted file mode 100644 index 1f20b32..0000000 --- a/docsrc/apidocs/cookie_composer/cookie_composer.merge_files.rst +++ /dev/null @@ -1,52 +0,0 @@ -:py:mod:`cookie_composer.merge_files` -===================================== - -.. py:module:: cookie_composer.merge_files - -.. autodoc2-docstring:: cookie_composer.merge_files - :allowtitles: - -Submodules ----------- - -.. toctree:: - :titlesonly: - :maxdepth: 1 - - cookie_composer.merge_files.toml_file - cookie_composer.merge_files.json_file - cookie_composer.merge_files.yaml_file - cookie_composer.merge_files.ini_file - -Package Contents ----------------- - -Data -~~~~ - -.. list-table:: - :class: autosummary longtable - :align: left - - * - :py:obj:`merge_function ` - - .. autodoc2-docstring:: cookie_composer.merge_files.merge_function - :summary: - * - :py:obj:`MERGE_FUNCTIONS ` - - .. autodoc2-docstring:: cookie_composer.merge_files.MERGE_FUNCTIONS - :summary: - -API -~~~ - -.. py:data:: merge_function - :canonical: cookie_composer.merge_files.merge_function - :value: None - - .. autodoc2-docstring:: cookie_composer.merge_files.merge_function - -.. py:data:: MERGE_FUNCTIONS - :canonical: cookie_composer.merge_files.MERGE_FUNCTIONS - :type: typing.Dict[str, cookie_composer.merge_files.merge_function] - :value: None - - .. autodoc2-docstring:: cookie_composer.merge_files.MERGE_FUNCTIONS diff --git a/docsrc/apidocs/cookie_composer/cookie_composer.merge_files.toml_file.rst b/docsrc/apidocs/cookie_composer/cookie_composer.merge_files.toml_file.rst deleted file mode 100644 index 9454fbe..0000000 --- a/docsrc/apidocs/cookie_composer/cookie_composer.merge_files.toml_file.rst +++ /dev/null @@ -1,29 +0,0 @@ -:py:mod:`cookie_composer.merge_files.toml_file` -=============================================== - -.. py:module:: cookie_composer.merge_files.toml_file - -.. autodoc2-docstring:: cookie_composer.merge_files.toml_file - :allowtitles: - -Module Contents ---------------- - -Functions -~~~~~~~~~ - -.. list-table:: - :class: autosummary longtable - :align: left - - * - :py:obj:`merge_toml_files ` - - .. autodoc2-docstring:: cookie_composer.merge_files.toml_file.merge_toml_files - :summary: - -API -~~~ - -.. py:function:: merge_toml_files(new_file: pathlib.Path, existing_file: pathlib.Path, merge_strategy: str) -> None - :canonical: cookie_composer.merge_files.toml_file.merge_toml_files - - .. autodoc2-docstring:: cookie_composer.merge_files.toml_file.merge_toml_files diff --git a/docsrc/apidocs/cookie_composer/cookie_composer.merge_files.yaml_file.rst b/docsrc/apidocs/cookie_composer/cookie_composer.merge_files.yaml_file.rst deleted file mode 100644 index 174aaea..0000000 --- a/docsrc/apidocs/cookie_composer/cookie_composer.merge_files.yaml_file.rst +++ /dev/null @@ -1,29 +0,0 @@ -:py:mod:`cookie_composer.merge_files.yaml_file` -=============================================== - -.. py:module:: cookie_composer.merge_files.yaml_file - -.. autodoc2-docstring:: cookie_composer.merge_files.yaml_file - :allowtitles: - -Module Contents ---------------- - -Functions -~~~~~~~~~ - -.. list-table:: - :class: autosummary longtable - :align: left - - * - :py:obj:`merge_yaml_files ` - - .. autodoc2-docstring:: cookie_composer.merge_files.yaml_file.merge_yaml_files - :summary: - -API -~~~ - -.. py:function:: merge_yaml_files(new_file: pathlib.Path, existing_file: pathlib.Path, merge_strategy: str) -> None - :canonical: cookie_composer.merge_files.yaml_file.merge_yaml_files - - .. autodoc2-docstring:: cookie_composer.merge_files.yaml_file.merge_yaml_files diff --git a/docsrc/apidocs/cookie_composer/cookie_composer.rst b/docsrc/apidocs/cookie_composer/cookie_composer.rst deleted file mode 100644 index dc3fb32..0000000 --- a/docsrc/apidocs/cookie_composer/cookie_composer.rst +++ /dev/null @@ -1,62 +0,0 @@ -:py:mod:`cookie_composer` -========================= - -.. py:module:: cookie_composer - -.. autodoc2-docstring:: cookie_composer - :allowtitles: - -Subpackages ------------ - -.. toctree:: - :titlesonly: - :maxdepth: 3 - - cookie_composer.merge_files - cookie_composer.templates - cookie_composer.commands - -Submodules ----------- - -.. toctree:: - :titlesonly: - :maxdepth: 1 - - cookie_composer.data_merge - cookie_composer.git_commands - cookie_composer.io - cookie_composer.matching - cookie_composer.cli - cookie_composer.utils - cookie_composer.cc_overrides - cookie_composer.authentication - cookie_composer.exceptions - cookie_composer.diff - cookie_composer.composition - cookie_composer.layers - -Package Contents ----------------- - -Data -~~~~ - -.. list-table:: - :class: autosummary longtable - :align: left - - * - :py:obj:`__version__ ` - - .. autodoc2-docstring:: cookie_composer.__version__ - :summary: - -API -~~~ - -.. py:data:: __version__ - :canonical: cookie_composer.__version__ - :type: str - :value: '0.11.0b1' - - .. autodoc2-docstring:: cookie_composer.__version__ diff --git a/docsrc/apidocs/cookie_composer/cookie_composer.templates.git_repo.rst b/docsrc/apidocs/cookie_composer/cookie_composer.templates.git_repo.rst deleted file mode 100644 index d28f98d..0000000 --- a/docsrc/apidocs/cookie_composer/cookie_composer.templates.git_repo.rst +++ /dev/null @@ -1,62 +0,0 @@ -:py:mod:`cookie_composer.templates.git_repo` -============================================ - -.. py:module:: cookie_composer.templates.git_repo - -.. autodoc2-docstring:: cookie_composer.templates.git_repo - :allowtitles: - -Module Contents ---------------- - -Functions -~~~~~~~~~ - -.. list-table:: - :class: autosummary longtable - :align: left - - * - :py:obj:`get_repo_name ` - - .. autodoc2-docstring:: cookie_composer.templates.git_repo.get_repo_name - :summary: - * - :py:obj:`template_repo_from_git ` - - .. autodoc2-docstring:: cookie_composer.templates.git_repo.template_repo_from_git - :summary: - * - :py:obj:`get_cached_remote ` - - .. autodoc2-docstring:: cookie_composer.templates.git_repo.get_cached_remote - :summary: - -Data -~~~~ - -.. list-table:: - :class: autosummary longtable - :align: left - - * - :py:obj:`logger ` - - .. autodoc2-docstring:: cookie_composer.templates.git_repo.logger - :summary: - -API -~~~ - -.. py:data:: logger - :canonical: cookie_composer.templates.git_repo.logger - :value: None - - .. autodoc2-docstring:: cookie_composer.templates.git_repo.logger - -.. py:function:: get_repo_name(repo_url: str, checkout: typing.Optional[str] = None) -> str - :canonical: cookie_composer.templates.git_repo.get_repo_name - - .. autodoc2-docstring:: cookie_composer.templates.git_repo.get_repo_name - -.. py:function:: template_repo_from_git(git_uri: str, locality: cookie_composer.templates.types.Locality, cache_dir: pathlib.Path, checkout: typing.Optional[str] = None) -> cookie_composer.templates.types.TemplateRepo - :canonical: cookie_composer.templates.git_repo.template_repo_from_git - - .. autodoc2-docstring:: cookie_composer.templates.git_repo.template_repo_from_git - -.. py:function:: get_cached_remote(git_uri: str, cache_dir: pathlib.Path, checkout: typing.Optional[str] = None) -> git.Repo - :canonical: cookie_composer.templates.git_repo.get_cached_remote - - .. autodoc2-docstring:: cookie_composer.templates.git_repo.get_cached_remote diff --git a/docsrc/apidocs/cookie_composer/cookie_composer.templates.rst b/docsrc/apidocs/cookie_composer/cookie_composer.templates.rst deleted file mode 100644 index abe0f7e..0000000 --- a/docsrc/apidocs/cookie_composer/cookie_composer.templates.rst +++ /dev/null @@ -1,19 +0,0 @@ -:py:mod:`cookie_composer.templates` -=================================== - -.. py:module:: cookie_composer.templates - -.. autodoc2-docstring:: cookie_composer.templates - :allowtitles: - -Submodules ----------- - -.. toctree:: - :titlesonly: - :maxdepth: 1 - - cookie_composer.templates.zipfile_repo - cookie_composer.templates.git_repo - cookie_composer.templates.types - cookie_composer.templates.source diff --git a/docsrc/apidocs/cookie_composer/cookie_composer.templates.source.rst b/docsrc/apidocs/cookie_composer/cookie_composer.templates.source.rst deleted file mode 100644 index 6ea77d6..0000000 --- a/docsrc/apidocs/cookie_composer/cookie_composer.templates.source.rst +++ /dev/null @@ -1,45 +0,0 @@ -:py:mod:`cookie_composer.templates.source` -========================================== - -.. py:module:: cookie_composer.templates.source - -.. autodoc2-docstring:: cookie_composer.templates.source - :allowtitles: - -Module Contents ---------------- - -Functions -~~~~~~~~~ - -.. list-table:: - :class: autosummary longtable - :align: left - - * - :py:obj:`identify_repo ` - - .. autodoc2-docstring:: cookie_composer.templates.source.identify_repo - :summary: - * - :py:obj:`get_template_repo ` - - .. autodoc2-docstring:: cookie_composer.templates.source.get_template_repo - :summary: - * - :py:obj:`resolve_local_path ` - - .. autodoc2-docstring:: cookie_composer.templates.source.resolve_local_path - :summary: - -API -~~~ - -.. py:function:: identify_repo(url: str, local_path: typing.Optional[pathlib.Path] = None) -> typing.Tuple[cookie_composer.templates.types.TemplateFormat, cookie_composer.templates.types.Locality] - :canonical: cookie_composer.templates.source.identify_repo - - .. autodoc2-docstring:: cookie_composer.templates.source.identify_repo - -.. py:function:: get_template_repo(url: str, local_path: typing.Optional[pathlib.Path] = None, checkout: typing.Optional[str] = None, password: typing.Optional[str] = None) -> cookie_composer.templates.types.TemplateRepo - :canonical: cookie_composer.templates.source.get_template_repo - - .. autodoc2-docstring:: cookie_composer.templates.source.get_template_repo - -.. py:function:: resolve_local_path(url: str, local_path: typing.Optional[pathlib.Path] = None) -> pathlib.Path - :canonical: cookie_composer.templates.source.resolve_local_path - - .. autodoc2-docstring:: cookie_composer.templates.source.resolve_local_path diff --git a/docsrc/apidocs/cookie_composer/cookie_composer.templates.types.rst b/docsrc/apidocs/cookie_composer/cookie_composer.templates.types.rst deleted file mode 100644 index 0ca63f3..0000000 --- a/docsrc/apidocs/cookie_composer/cookie_composer.templates.types.rst +++ /dev/null @@ -1,221 +0,0 @@ -:py:mod:`cookie_composer.templates.types` -========================================= - -.. py:module:: cookie_composer.templates.types - -.. autodoc2-docstring:: cookie_composer.templates.types - :allowtitles: - -Module Contents ---------------- - -Classes -~~~~~~~ - -.. list-table:: - :class: autosummary longtable - :align: left - - * - :py:obj:`Locality ` - - .. autodoc2-docstring:: cookie_composer.templates.types.Locality - :summary: - * - :py:obj:`TemplateFormat ` - - .. autodoc2-docstring:: cookie_composer.templates.types.TemplateFormat - :summary: - * - :py:obj:`TemplateRepo ` - - .. autodoc2-docstring:: cookie_composer.templates.types.TemplateRepo - :summary: - * - :py:obj:`Template ` - - .. autodoc2-docstring:: cookie_composer.templates.types.Template - :summary: - -Functions -~~~~~~~~~ - -.. list-table:: - :class: autosummary longtable - :align: left - - * - :py:obj:`get_template_name ` - - .. autodoc2-docstring:: cookie_composer.templates.types.get_template_name - :summary: - -API -~~~ - -.. py:class:: Locality() - :canonical: cookie_composer.templates.types.Locality - - Bases: :py:obj:`str`, :py:obj:`enum.Enum` - - .. autodoc2-docstring:: cookie_composer.templates.types.Locality - - .. rubric:: Initialization - - .. autodoc2-docstring:: cookie_composer.templates.types.Locality.__init__ - - .. py:attribute:: LOCAL - :canonical: cookie_composer.templates.types.Locality.LOCAL - :value: 'local' - - .. autodoc2-docstring:: cookie_composer.templates.types.Locality.LOCAL - - .. py:attribute:: REMOTE - :canonical: cookie_composer.templates.types.Locality.REMOTE - :value: 'remote' - - .. autodoc2-docstring:: cookie_composer.templates.types.Locality.REMOTE - -.. py:class:: TemplateFormat() - :canonical: cookie_composer.templates.types.TemplateFormat - - Bases: :py:obj:`str`, :py:obj:`enum.Enum` - - .. autodoc2-docstring:: cookie_composer.templates.types.TemplateFormat - - .. rubric:: Initialization - - .. autodoc2-docstring:: cookie_composer.templates.types.TemplateFormat.__init__ - - .. py:attribute:: ZIP - :canonical: cookie_composer.templates.types.TemplateFormat.ZIP - :value: 'zip' - - .. autodoc2-docstring:: cookie_composer.templates.types.TemplateFormat.ZIP - - .. py:attribute:: GIT - :canonical: cookie_composer.templates.types.TemplateFormat.GIT - :value: 'git' - - .. autodoc2-docstring:: cookie_composer.templates.types.TemplateFormat.GIT - - .. py:attribute:: HG - :canonical: cookie_composer.templates.types.TemplateFormat.HG - :value: 'hg' - - .. autodoc2-docstring:: cookie_composer.templates.types.TemplateFormat.HG - - .. py:attribute:: PLAIN - :canonical: cookie_composer.templates.types.TemplateFormat.PLAIN - :value: 'plain' - - .. autodoc2-docstring:: cookie_composer.templates.types.TemplateFormat.PLAIN - -.. py:class:: TemplateRepo - :canonical: cookie_composer.templates.types.TemplateRepo - - .. autodoc2-docstring:: cookie_composer.templates.types.TemplateRepo - - .. py:attribute:: source - :canonical: cookie_composer.templates.types.TemplateRepo.source - :type: str - :value: None - - .. autodoc2-docstring:: cookie_composer.templates.types.TemplateRepo.source - - .. py:attribute:: cached_source - :canonical: cookie_composer.templates.types.TemplateRepo.cached_source - :type: pathlib.Path - :value: None - - .. autodoc2-docstring:: cookie_composer.templates.types.TemplateRepo.cached_source - - .. py:attribute:: format - :canonical: cookie_composer.templates.types.TemplateRepo.format - :type: cookie_composer.templates.types.TemplateFormat - :value: None - - .. autodoc2-docstring:: cookie_composer.templates.types.TemplateRepo.format - - .. py:attribute:: locality - :canonical: cookie_composer.templates.types.TemplateRepo.locality - :type: cookie_composer.templates.types.Locality - :value: None - - .. autodoc2-docstring:: cookie_composer.templates.types.TemplateRepo.locality - - .. py:attribute:: checkout - :canonical: cookie_composer.templates.types.TemplateRepo.checkout - :type: typing.Optional[str] - :value: None - - .. autodoc2-docstring:: cookie_composer.templates.types.TemplateRepo.checkout - - .. py:attribute:: password - :canonical: cookie_composer.templates.types.TemplateRepo.password - :type: typing.Optional[str] - :value: None - - .. autodoc2-docstring:: cookie_composer.templates.types.TemplateRepo.password - - .. py:property:: current_sha - :canonical: cookie_composer.templates.types.TemplateRepo.current_sha - :type: typing.Optional[str] - - .. autodoc2-docstring:: cookie_composer.templates.types.TemplateRepo.current_sha - - .. py:property:: latest_sha - :canonical: cookie_composer.templates.types.TemplateRepo.latest_sha - :type: typing.Optional[str] - - .. autodoc2-docstring:: cookie_composer.templates.types.TemplateRepo.latest_sha - -.. py:class:: Template - :canonical: cookie_composer.templates.types.Template - - .. autodoc2-docstring:: cookie_composer.templates.types.Template - - .. py:attribute:: repo - :canonical: cookie_composer.templates.types.Template.repo - :type: cookie_composer.templates.types.TemplateRepo - :value: None - - .. autodoc2-docstring:: cookie_composer.templates.types.Template.repo - - .. py:attribute:: directory - :canonical: cookie_composer.templates.types.Template.directory - :type: str - :value: - - .. autodoc2-docstring:: cookie_composer.templates.types.Template.directory - - .. py:attribute:: _context - :canonical: cookie_composer.templates.types.Template._context - :type: typing.Optional[dict] - :value: None - - .. autodoc2-docstring:: cookie_composer.templates.types.Template._context - - .. py:method:: cleanup() -> None - :canonical: cookie_composer.templates.types.Template.cleanup - - .. autodoc2-docstring:: cookie_composer.templates.types.Template.cleanup - - .. py:property:: name - :canonical: cookie_composer.templates.types.Template.name - :type: str - - .. autodoc2-docstring:: cookie_composer.templates.types.Template.name - - .. py:property:: cached_path - :canonical: cookie_composer.templates.types.Template.cached_path - :type: pathlib.Path - - .. autodoc2-docstring:: cookie_composer.templates.types.Template.cached_path - - .. py:property:: context_file_path - :canonical: cookie_composer.templates.types.Template.context_file_path - :type: pathlib.Path - - .. autodoc2-docstring:: cookie_composer.templates.types.Template.context_file_path - - .. py:property:: context - :canonical: cookie_composer.templates.types.Template.context - :type: dict - - .. autodoc2-docstring:: cookie_composer.templates.types.Template.context - -.. py:function:: get_template_name(path_or_url: str, directory: typing.Optional[str] = None, checkout: typing.Optional[str] = None) -> str - :canonical: cookie_composer.templates.types.get_template_name - - .. autodoc2-docstring:: cookie_composer.templates.types.get_template_name diff --git a/docsrc/apidocs/cookie_composer/cookie_composer.templates.zipfile_repo.rst b/docsrc/apidocs/cookie_composer/cookie_composer.templates.zipfile_repo.rst deleted file mode 100644 index ea5634b..0000000 --- a/docsrc/apidocs/cookie_composer/cookie_composer.templates.zipfile_repo.rst +++ /dev/null @@ -1,61 +0,0 @@ -:py:mod:`cookie_composer.templates.zipfile_repo` -================================================ - -.. py:module:: cookie_composer.templates.zipfile_repo - -.. autodoc2-docstring:: cookie_composer.templates.zipfile_repo - :allowtitles: - -Module Contents ---------------- - -Functions -~~~~~~~~~ - -.. list-table:: - :class: autosummary longtable - :align: left - - * - :py:obj:`template_repo_from_zipfile ` - - .. autodoc2-docstring:: cookie_composer.templates.zipfile_repo.template_repo_from_zipfile - :summary: - * - :py:obj:`download_zipfile ` - - .. autodoc2-docstring:: cookie_composer.templates.zipfile_repo.download_zipfile - :summary: - * - :py:obj:`unzip ` - - .. autodoc2-docstring:: cookie_composer.templates.zipfile_repo.unzip - :summary: - * - :py:obj:`validate_zipfile ` - - .. autodoc2-docstring:: cookie_composer.templates.zipfile_repo.validate_zipfile - :summary: - * - :py:obj:`extract_zipfile ` - - .. autodoc2-docstring:: cookie_composer.templates.zipfile_repo.extract_zipfile - :summary: - -API -~~~ - -.. py:function:: template_repo_from_zipfile(zip_uri: str, locality: cookie_composer.templates.types.Locality, cache_dir: pathlib.Path, no_input: bool = False, password: typing.Optional[str] = None) -> cookie_composer.templates.types.TemplateRepo - :canonical: cookie_composer.templates.zipfile_repo.template_repo_from_zipfile - - .. autodoc2-docstring:: cookie_composer.templates.zipfile_repo.template_repo_from_zipfile - -.. py:function:: download_zipfile(url: str, cache_dir: pathlib.Path, no_input: bool = False) -> pathlib.Path - :canonical: cookie_composer.templates.zipfile_repo.download_zipfile - - .. autodoc2-docstring:: cookie_composer.templates.zipfile_repo.download_zipfile - -.. py:function:: unzip(zip_uri: str, is_remote: bool, cache_dir: pathlib.Path, no_input: bool = False, password: typing.Optional[str] = None) -> pathlib.Path - :canonical: cookie_composer.templates.zipfile_repo.unzip - - .. autodoc2-docstring:: cookie_composer.templates.zipfile_repo.unzip - -.. py:function:: validate_zipfile(zip_path: pathlib.Path, zip_uri: str) -> None - :canonical: cookie_composer.templates.zipfile_repo.validate_zipfile - - .. autodoc2-docstring:: cookie_composer.templates.zipfile_repo.validate_zipfile - -.. py:function:: extract_zipfile(zip_path: pathlib.Path, no_input: bool, password: typing.Optional[str] = None) -> pathlib.Path - :canonical: cookie_composer.templates.zipfile_repo.extract_zipfile - - .. autodoc2-docstring:: cookie_composer.templates.zipfile_repo.extract_zipfile diff --git a/docsrc/apidocs/cookie_composer/cookie_composer.utils.rst b/docsrc/apidocs/cookie_composer/cookie_composer.utils.rst deleted file mode 100644 index 2608928..0000000 --- a/docsrc/apidocs/cookie_composer/cookie_composer.utils.rst +++ /dev/null @@ -1,69 +0,0 @@ -:py:mod:`cookie_composer.utils` -=============================== - -.. py:module:: cookie_composer.utils - -.. autodoc2-docstring:: cookie_composer.utils - :allowtitles: - -Module Contents ---------------- - -Functions -~~~~~~~~~ - -.. list-table:: - :class: autosummary longtable - :align: left - - * - :py:obj:`get_context_for_layer ` - - .. autodoc2-docstring:: cookie_composer.utils.get_context_for_layer - :summary: - * - :py:obj:`echo ` - - .. autodoc2-docstring:: cookie_composer.utils.echo - :summary: - * - :py:obj:`get_deleted_files ` - - .. autodoc2-docstring:: cookie_composer.utils.get_deleted_files - :summary: - * - :py:obj:`remove_paths ` - - .. autodoc2-docstring:: cookie_composer.utils.remove_paths - :summary: - * - :py:obj:`remove_readonly_bit ` - - .. autodoc2-docstring:: cookie_composer.utils.remove_readonly_bit - :summary: - * - :py:obj:`remove_single_path ` - - .. autodoc2-docstring:: cookie_composer.utils.remove_single_path - :summary: - -API -~~~ - -.. py:function:: get_context_for_layer(composition: cookie_composer.composition.RenderedComposition, index: typing.Optional[int] = None) -> dict - :canonical: cookie_composer.utils.get_context_for_layer - - .. autodoc2-docstring:: cookie_composer.utils.get_context_for_layer - -.. py:function:: echo(message: typing.Optional[typing.Any] = None, file: typing.Optional[typing.IO] = None, nl: bool = True, err: bool = False, color: typing.Optional[bool] = None, **styles) -> None - :canonical: cookie_composer.utils.echo - - .. autodoc2-docstring:: cookie_composer.utils.echo - -.. py:function:: get_deleted_files(template_dir: pathlib.Path, project_dir: pathlib.Path) -> typing.Set[pathlib.Path] - :canonical: cookie_composer.utils.get_deleted_files - - .. autodoc2-docstring:: cookie_composer.utils.get_deleted_files - -.. py:function:: remove_paths(root: pathlib.Path, paths_to_remove: typing.Set[pathlib.Path]) -> None - :canonical: cookie_composer.utils.remove_paths - - .. autodoc2-docstring:: cookie_composer.utils.remove_paths - -.. py:function:: remove_readonly_bit(func: typing.Callable[[str], None], path: str, _: typing.Any) -> None - :canonical: cookie_composer.utils.remove_readonly_bit - - .. autodoc2-docstring:: cookie_composer.utils.remove_readonly_bit - -.. py:function:: remove_single_path(path: pathlib.Path) -> None - :canonical: cookie_composer.utils.remove_single_path - - .. autodoc2-docstring:: cookie_composer.utils.remove_single_path diff --git a/docsrc/apidocs/index.rst b/docsrc/apidocs/index.rst deleted file mode 100644 index b5992b2..0000000 --- a/docsrc/apidocs/index.rst +++ /dev/null @@ -1,11 +0,0 @@ -API Reference -============= - -This page contains auto-generated API reference documentation [#f1]_. - -.. toctree:: - :titlesonly: - - cookie_composer/cookie_composer - -.. [#f1] Created with `sphinx-autodoc2 `_ diff --git a/docsrc/changelog.md b/docsrc/changelog.md deleted file mode 100644 index 66efc0f..0000000 --- a/docsrc/changelog.md +++ /dev/null @@ -1,2 +0,0 @@ -```{include} ../CHANGELOG.md -``` diff --git a/docsrc/cli.rst b/docsrc/cli.rst deleted file mode 100644 index 2c27a44..0000000 --- a/docsrc/cli.rst +++ /dev/null @@ -1,6 +0,0 @@ -Command-line Interface -====================== - -.. click:: cookie_composer.cli:cli - :prog: cookie-composer - :nested: full diff --git a/docsrc/conf.py b/docsrc/conf.py deleted file mode 100644 index b3be850..0000000 --- a/docsrc/conf.py +++ /dev/null @@ -1,95 +0,0 @@ -""" -Sphinx configuration. -""" - -import os -import sys -from datetime import date - -sys.path.insert(0, os.path.abspath("..")) - -import cookie_composer - -project = "Cookie Composer" -author = "Corey Oordt" -copyright = f"{date.today():%Y}, {author}" - -version = cookie_composer.__version__ -release = cookie_composer.__version__ - -# -- General configuration --------------------------------------------- - -extensions = [ - "myst_parser", - "autodoc2", - "sphinx.ext.viewcode", - # "sphinx.ext.autosummary", - "sphinx.ext.intersphinx", - "sphinx.ext.autosectionlabel", - "sphinx.ext.napoleon", - "sphinx.ext.coverage", - "sphinx.ext.githubpages", - "sphinx_click", -] -autosectionlabel_prefix_document = True -autosectionlabel_maxdepth = 2 -autosummary_generate = True -autodoc2_packages = ["../cookie_composer"] -napoleon_attr_annotations = True -napoleon_include_special_with_doc = True -napoleon_include_private_with_doc = True -napoleon_include_init_with_doc = True -myst_enable_extensions = [ - "amsmath", - "colon_fence", - "deflist", - "dollarmath", - "linkify", - "replacements", - "smartquotes", - "substitution", - "tasklist", -] -intersphinx_mapping = { - "python": ("https://docs.python.org/3", None), -} - -templates_path = ["_templates"] -source_suffix = [".rst", ".md"] -master_doc = "index" -language = "en" -exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"] -pygments_style = "sphinx" -todo_include_todos = False -primary_domain = "py" - - -# -- Options for HTML output ------------------------------------------- - -html_title = "Cookie Composer" -html_logo = "_static/img/composer-logo.svg" -html_theme = "sphinx_material" -html_static_path = ["_static"] -html_css_files = [ - "css/custom.css", -] -html_theme_options = { - # Set the name of the project to appear in the navigation. - "nav_title": "Cookie Composer", - # Specify a base_url used to generate sitemap.xml. If not - # specified, then no sitemap will be built. - "base_url": "https://callowayproject.github.io/cookie-composer/", - # Set the color and the accent color - "color_primary": "blue", - "color_accent": "light-blue", - # Set the repo location to get a badge with stats - "repo_url": "https://github.com/callowayproject/cookie-composer/", - "repo_name": "Project", - # Visible levels of the global TOC; -1 means unlimited - "globaltoc_depth": 3, - # If False, expand all TOC entries - "globaltoc_collapse": False, - # If True, show hidden TOC entries - "globaltoc_includehidden": False, - "master_doc": True, -} diff --git a/docsrc/contributing.md b/docsrc/contributing.md deleted file mode 100644 index 78caf34..0000000 --- a/docsrc/contributing.md +++ /dev/null @@ -1,2 +0,0 @@ -```{include} ../CONTRIBUTING.md -``` diff --git a/docsrc/how-to/index.md b/docsrc/how-to/index.md deleted file mode 100644 index c064d96..0000000 --- a/docsrc/how-to/index.md +++ /dev/null @@ -1,8 +0,0 @@ -# How To... - -```{toctree} ---- -maxdepth: 2 ---- -access-private-templates -``` diff --git a/docsrc/index.md b/docsrc/index.md deleted file mode 100644 index b769f44..0000000 --- a/docsrc/index.md +++ /dev/null @@ -1,27 +0,0 @@ -# Cookie composer - -```{include} ../README.md ---- -start-after: ---- -``` - -```{toctree} ---- -hidden: ---- -installation -tutorial/index -topic-guides/index -how-to/index -cli -apidocs/index -contributing -changelog -``` - -## Indices and tables - -* {ref}`genindex` -* {ref}`modindex` -* {ref}`search` diff --git a/docsrc/make.bat b/docsrc/make.bat deleted file mode 100644 index 368fe0f..0000000 --- a/docsrc/make.bat +++ /dev/null @@ -1,36 +0,0 @@ -@ECHO OFF - -pushd %~dp0 - -REM Command file for Sphinx documentation - -if "%SPHINXBUILD%" == "" ( - set SPHINXBUILD=python -msphinx -) -set SOURCEDIR=. -set BUILDDIR=_build -set SPHINXPROJ=bin_cookie_composer - -if "%1" == "" goto help - -%SPHINXBUILD% >NUL 2>NUL -if errorlevel 9009 ( - echo. - echo.The Sphinx module was not found. Make sure you have Sphinx installed, - echo.then set the SPHINXBUILD environment variable to point to the full - echo.path of the 'sphinx-build' executable. Alternatively you may add the - echo.Sphinx directory to PATH. - echo. - echo.If you don't have Sphinx installed, grab it from - echo.http://sphinx-doc.org/ - exit /b 1 -) - -%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% -goto end - -:help -%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% - -:end -popd diff --git a/docsrc/topic-guides/index.md b/docsrc/topic-guides/index.md deleted file mode 100644 index c153e26..0000000 --- a/docsrc/topic-guides/index.md +++ /dev/null @@ -1,8 +0,0 @@ -# Topic Guides - -```{toctree} ---- -maxdepth: 2 ---- -composition-files -``` diff --git a/docsrc/tutorial/index.md b/docsrc/tutorial/index.md deleted file mode 100644 index 865699f..0000000 --- a/docsrc/tutorial/index.md +++ /dev/null @@ -1,10 +0,0 @@ -# Tutorial - -```{toctree} ---- -maxdepth: 1 ---- -incrementally-layering -compositions -composable-templates -``` diff --git a/mkdocs.yml b/mkdocs.yml new file mode 100644 index 0000000..a4cec37 --- /dev/null +++ b/mkdocs.yml @@ -0,0 +1,117 @@ +site_name: Cookie Composer +repo_url: https://github.com/callowayproject/cookie-composer +edit_uri: edit/master/docs/ +copyright: Calloway Project +watch: + - overrides +theme: + name: material + custom_dir: overrides + logo: assets/img/composer-logo.svg + favicon: assets/favicon.png + features: + - navigation.tabs + - navigation.sections + - navigation.path + - navigation.indexes + - toc.integrate + - content.action.edit + - content.action.view + - content.code.annotate + - content.tabs.link + palette: + - media: "(prefers-color-scheme: light)" + scheme: default + primary: blue grey + toggle: + icon: material/toggle-switch-off-outline + name: Switch to dark mode + - media: "(prefers-color-scheme: dark)" + scheme: slate + toggle: + icon: material/toggle-switch + name: Switch to light mode +use_directory_urls: true +markdown_extensions: + - abbr + - admonition + - attr_list + - customblocks + - def_list + - footnotes + - md_in_html + - mdx_truly_sane_lists + - mkdocs-click + - pymdownx.details + - pymdownx.emoji: + emoji_index: !!python/name:material.extensions.emoji.twemoji + emoji_generator: !!python/name:material.extensions.emoji.to_svg + - pymdownx.highlight + - pymdownx.snippets: + base_path: ["docs/_includes"] + - pymdownx.superfences: + custom_fences: + - name: mermaid + class: mermaid + format: !!python/name:pymdownx.superfences.fence_div_format + - pymdownx.tabbed: + alternate_style: true + slugify: !!python/object/apply:pymdownx.slugs.slugify + kwds: + case: lower + - smarty + - toc: + permalink: true + toc_depth: 3 + - tables + +plugins: + - search + - git-revision-date-localized + - git-authors: + show_email_address: false + exclude: + - reference/api/* + - include-markdown + - drawio + - literate-nav: + nav_file: SUMMARY.md + - gen-files: + scripts: + - docs/gen_doc_stubs.py + - mkdocstrings: + custom_templates: overrides/mkdocstrings + handlers: + python: + import: + - https://docs.python.org/3/objects.inv + - https://numpy.org/doc/stable/objects.inv + - https://pandas.pydata.org/docs/objects.inv + - https://api.python.langchain.com/en/latest/objects.inv + options: + allow_inspection: true + docstring_style: google + docstring_options: + ignore_init_summary: true + docstring_section_style: spacy + enable_inventory: true + group_by_category: true + members_order: alphabetical + merge_init_into_class: true + separate_signature: true + show_docstring_parameters: true + show_root_toc_entry: true + show_signature_annotations: true + show_source: false + show_symbol_type_heading: true + show_symbol_type_toc: true + show_category_heading: true + +extra_javascript: + - "https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-MML-AM_CHTML" + +extra_css: + - assets/css/custom.css + - assets/css/mkdocstrings.css + - assets/css/cards.css + - assets/css/field-list.css diff --git a/overrides/mkdocstrings/python/material/docstring/attributes.html b/overrides/mkdocstrings/python/material/docstring/attributes.html new file mode 100644 index 0000000..ce50d65 --- /dev/null +++ b/overrides/mkdocstrings/python/material/docstring/attributes.html @@ -0,0 +1,90 @@ +{{ log.debug("Rendering attributes section") }} + +{% import "language.html" as lang with context %} + +{% if config.docstring_section_style == "table" %} + {% block table_style scoped %} +

{{ section.title or lang.t("Attributes:") }}

+ + + + + + + + + + {% for attribute in section.value %} + + + + + + {% endfor %} + +
{{ lang.t("Name") }}{{ lang.t("Type") }}{{ lang.t("Description") }}
{{ attribute.name }} + {% if attribute.annotation %} + {% with expression = attribute.annotation %} + {% include "expression.html" with context %} + {% endwith %} + {% endif %} + +
+ {{ attribute.description|convert_markdown(heading_level, html_id) }} +
+
+ {% endblock table_style %} +{% elif config.docstring_section_style == "list" %} + {% block list_style scoped %} +

{{ section.title or lang.t("Attributes:") }}

+
    + {% for attribute in section.value %} +
  • + {{ attribute.name }} + {% if attribute.annotation %} + {% with expression = attribute.annotation %} + ({% include "expression.html" with context %}) + {% endwith %} + {% endif %} + – +
    + {{ attribute.description|convert_markdown(heading_level, html_id) }} +
    +
  • + {% endfor %} +
+ {% endblock list_style %} +{% elif config.docstring_section_style == "spacy" %} + {% block spacy_style scoped %} + + + + + + + + + {% for attribute in section.value %} + + + + + {% endfor %} + +
{{ (section.title or lang.t("ATTRIBUTE")).rstrip(":").upper() }}{{ lang.t("DESCRIPTION") }}
{{ attribute.name }} +
+ {{ attribute.description|convert_markdown(heading_level, html_id) }} +
+

+ {% if attribute.annotation %} + + TYPE: + {% with expression = attribute.annotation %} + {% include "expression.html" with context %} + {% endwith %} + + {% endif %} +

+
+ {% endblock spacy_style %} +{% endif %} diff --git a/overrides/mkdocstrings/python/material/docstring/parameters.html b/overrides/mkdocstrings/python/material/docstring/parameters.html new file mode 100644 index 0000000..ab4889e --- /dev/null +++ b/overrides/mkdocstrings/python/material/docstring/parameters.html @@ -0,0 +1,98 @@ +{{ log.debug("Rendering parameters section") }} + +{% import "language.html" as lang with context %} + +{% if config.docstring_section_style == "table" %} + {% block table_style scoped %} +

{{ section.title or lang.t("Parameters:") }}

+ + + + + + + + + + + {% for parameter in section.value %} + + + + + + + {% endfor %} + +
{{ lang.t("Name") }}{{ lang.t("Type") }}{{ lang.t("Description") }}{{ lang.t("Default") }}
{{ parameter.name }} + {% if parameter.annotation %} + {% with expression = parameter.annotation %} + {% include "expression.html" with context %} + {% endwith %} + {% endif %} + +
+ {{ parameter.description|convert_markdown(heading_level, html_id) }} +
+
+ {% if parameter.default %} + {% with expression = parameter.default %} + {% include "expression.html" with context %} + {% endwith %} + {% else %} + {{ lang.t("required") }} + {% endif %} +
+ {% endblock table_style %} +{% elif config.docstring_section_style == "list" %} + {% block list_style scoped %} +

{{ section.title or lang.t("Parameters:") }}

+
    + {% for parameter in section.value %} +
  • + {{ parameter.name }} + {% if parameter.annotation %} + {% with expression = parameter.annotation %} + ({% include "expression.html" with context %} + {%- if parameter.default %}, {{ lang.t("default:") }} + {% with expression = parameter.default %} + {% include "expression.html" with context %} + {% endwith %} + {% endif %}) + {% endwith %} + {% endif %} + – +
    + {{ parameter.description|convert_markdown(heading_level, html_id) }} +
    +
  • + {% endfor %} +
+ {% endblock list_style %} +{% elif config.docstring_section_style == "spacy" %} + {% block spacy_style scoped %} +

{{ section.title or lang.t("Parameters:") }}

+
+ {% for parameter in section.value %} +
{{ parameter.name }}
+
+
+ {{ parameter.description|convert_markdown(heading_level, html_id) }} +
+ {% if parameter.annotation %}

+ {{ lang.t("TYPE:") }} + {% with expression = parameter.annotation %} + {% include "expression.html" with context %} + {% endwith %} +

{% endif %} + {% if parameter.default %}

+ {{ lang.t("DEFAULT:") }} + {% with expression = parameter.default %} + {% include "expression.html" with context %} + {% endwith %} +

{% endif %} +
+ {% endfor %} +
+ {% endblock spacy_style %} +{% endif %} diff --git a/overrides/mkdocstrings/python/material/docstring/raises.html b/overrides/mkdocstrings/python/material/docstring/raises.html new file mode 100644 index 0000000..628e41b --- /dev/null +++ b/overrides/mkdocstrings/python/material/docstring/raises.html @@ -0,0 +1,72 @@ +{{ log.debug("Rendering raises section") }} + +{% import "language.html" as lang with context %} + +{% if config.docstring_section_style == "table" %} + {% block table_style scoped %} +

{{ section.title or lang.t("Raises:") }}

+ + + + + + + + + {% for raises in section.value %} + + + + + {% endfor %} + +
{{ lang.t("Type") }}{{ lang.t("Description") }}
+ {% if raises.annotation %} + {% with expression = raises.annotation %} + {% include "expression.html" with context %} + {% endwith %} + {% endif %} + +
+ {{ raises.description|convert_markdown(heading_level, html_id) }} +
+
+ {% endblock table_style %} +{% elif config.docstring_section_style == "list" %} + {% block list_style scoped %} +

{{ lang.t(section.title) or lang.t("Raises:") }}

+
    + {% for raises in section.value %} +
  • + {% if raises.annotation %} + {% with expression = raises.annotation %} + {% include "expression.html" with context %} + {% endwith %} + – + {% endif %} +
    + {{ raises.description|convert_markdown(heading_level, html_id) }} +
    +
  • + {% endfor %} +
+ {% endblock list_style %} +{% elif config.docstring_section_style == "spacy" %} + {% block spacy_style scoped %} +

{{ (section.title or lang.t("Raises:")) }}

+
+ {% for raises in section.value %} +
+ {% with expression = raises.annotation %} + {% include "expression.html" with context %} + {% endwith %} +
+
+
+ {{ raises.description|convert_markdown(heading_level, html_id) }} +
+
+ {% endfor %} +
+ {% endblock spacy_style %} +{% endif %} diff --git a/overrides/mkdocstrings/python/material/docstring/returns.html b/overrides/mkdocstrings/python/material/docstring/returns.html new file mode 100644 index 0000000..bd60840 --- /dev/null +++ b/overrides/mkdocstrings/python/material/docstring/returns.html @@ -0,0 +1,94 @@ +{{ log.debug("Rendering returns section") }} + +{% import "language.html" as lang with context %} + +{% if config.docstring_section_style == "table" %} + {% block table_style scoped %} + {% set name_column = section.value|selectattr("name")|any %} +

{{ section.title or lang.t("Returns:") }}

+ + + + {% if name_column %}{% endif %} + + + + + + {% for returns in section.value %} + + {% if name_column %}{% endif %} + + + + {% endfor %} + +
{{ lang.t("Name") }}{{ lang.t("Type") }}{{ lang.t("Description") }}
{% if returns.name %}{{ returns.name }}{% endif %} + {% if returns.annotation %} + {% with expression = returns.annotation %} + {% include "expression.html" with context %} + {% endwith %} + {% endif %} + +
+ {{ returns.description|convert_markdown(heading_level, html_id) }} +
+
+ {% endblock table_style %} +{% elif config.docstring_section_style == "list" %} + {% block list_style scoped %} +

{{ section.title or lang.t("Returns:") }}

+
    + {% for returns in section.value %} +
  • + {% if returns.name %}{{ returns.name }}{% endif %} + {% if returns.annotation %} + {% with expression = returns.annotation %} + {% if returns.name %} ({% endif %} + {% include "expression.html" with context %} + {% if returns.name %}){% endif %} + {% endwith %} + {% endif %} + – +
    + {{ returns.description|convert_markdown(heading_level, html_id) }} +
    +
  • + {% endfor %} +
+ {% endblock list_style %} +{% elif config.docstring_section_style == "spacy" %} + {% block spacy_style scoped %} +

{{ (section.title or lang.t("Returns:")) }}

+
+ {% for returns in section.value %} +
+ {% if returns.name %} + {{ returns.name }} + {% elif returns.annotation %} + + {% with expression = returns.annotation %} + {% include "expression.html" with context %} + {% endwith %} + + {% endif %} +
+
+
+ {{ returns.description|convert_markdown(heading_level, html_id) }} +
+ {% if returns.name and returns.annotation %} +

+ + {{ lang.t("TYPE:") }} + {% with expression = returns.annotation %} + {% include "expression.html" with context %} + {% endwith %} + +

+ {% endif %} +
+ {% endfor %} +
+ {% endblock spacy_style %} +{% endif %} diff --git a/overrides/partials/comments.html b/overrides/partials/comments.html new file mode 100644 index 0000000..b0d1dd3 --- /dev/null +++ b/overrides/partials/comments.html @@ -0,0 +1,51 @@ +{% if page.meta.comments %} +

{{ lang.t("meta.comments") }}

+ + + + +{% endif %} From 42f0392a6d0bbf71d2ed586fd3ffcfcefa72d2e6 Mon Sep 17 00:00:00 2001 From: Corey Oordt Date: Sat, 4 May 2024 09:32:51 -0500 Subject: [PATCH 03/13] Fixed docstrings and doc rendering. --- cookie_composer/authentication.py | 2 +- cookie_composer/cc_overrides.py | 6 +++--- cookie_composer/cli.py | 6 +++--- cookie_composer/commands/add.py | 2 +- cookie_composer/commands/create.py | 2 +- cookie_composer/commands/link.py | 2 +- cookie_composer/commands/update.py | 10 +++++----- cookie_composer/composition.py | 6 +++--- cookie_composer/data_merge.py | 6 +++--- cookie_composer/diff.py | 6 +++--- cookie_composer/git_commands.py | 10 +++++----- cookie_composer/io.py | 16 ++++++++-------- cookie_composer/layers.py | 16 +++++++++------- cookie_composer/matching.py | 4 ++-- cookie_composer/merge_files/__init__.py | 4 +--- cookie_composer/templates/source.py | 2 +- cookie_composer/templates/types.py | 4 ++-- cookie_composer/utils.py | 8 ++++---- mkdocs.yml | 8 +++++--- .../local_extensions/main.py | 2 +- 20 files changed, 62 insertions(+), 60 deletions(-) diff --git a/cookie_composer/authentication.py b/cookie_composer/authentication.py index 53adc8e..cf0884b 100644 --- a/cookie_composer/authentication.py +++ b/cookie_composer/authentication.py @@ -88,7 +88,7 @@ def add_auth_to_url(url: str) -> str: def github_auth_device(n_polls: int = 9999) -> Optional[str]: # pragma: no cover """ - Authenticate with GitHub, polling up to ``n_polls`` times to wait for completion. + Authenticate with GitHub, polling up to `n_polls` times to wait for completion. """ from ghapi.auth import GhDeviceAuth diff --git a/cookie_composer/cc_overrides.py b/cookie_composer/cc_overrides.py index e18a743..3486553 100644 --- a/cookie_composer/cc_overrides.py +++ b/cookie_composer/cc_overrides.py @@ -19,7 +19,7 @@ def jsonify_context(value: Any) -> MutableMapping: - """Convert a ``Context`` to a dict.""" + """Convert a `Context` to a dict.""" if isinstance(value, Context): return value.flatten() @@ -61,7 +61,7 @@ def _read_extensions(self, context: MutableMapping[str, Any]) -> List[str]: list instead. Args: - context: A ``dict`` possibly containing the ``_extensions`` key + context: A `dict` possibly containing the `_extensions` key Returns: List of extensions as str to be passed on to the Jinja2 env @@ -95,7 +95,7 @@ def prompt_for_config( prompts: A dictionary of configuration prompts and default values aggregated_context: An existing configuration to use as a basis layer_context: A dictionary of defaults defined in the layer - no_input: If ``True`` Don't prompt the user at command line for manual configuration + no_input: If `True` Don't prompt the user at command line for manual configuration Returns: A new configuration context diff --git a/cookie_composer/cli.py b/cookie_composer/cli.py index 87b9cfd..7bcc3bb 100644 --- a/cookie_composer/cli.py +++ b/cookie_composer/cli.py @@ -36,7 +36,7 @@ def validate_context_params(ctx: Any, param: Any, value: list) -> Optional[Order Convert a tuple to a dict - e.g.: ``('program_name=foobar', 'startsecs=66')`` -> ``{'program_name': 'foobar', 'startsecs': '66'}`` + e.g.: `('program_name=foobar', 'startsecs=66')` -> `{'program_name': 'foobar', 'startsecs': '66'}` Arguments: ctx: Click context (unused) @@ -44,10 +44,10 @@ def validate_context_params(ctx: Any, param: Any, value: list) -> Optional[Order value: Click parameter value Returns: - An ordered dict of the parameter values or ``None`` if no parameters. + An ordered dict of the parameter values or `None` if no parameters. Raises: - BadParameter: If the parameters are not ``key=value``. + BadParameter: If the parameters are not `key=value`. """ for string in value: if "=" not in string: diff --git a/cookie_composer/commands/add.py b/cookie_composer/commands/add.py index 1853786..5753e33 100644 --- a/cookie_composer/commands/add.py +++ b/cookie_composer/commands/add.py @@ -31,7 +31,7 @@ def add_cmd( Args: path_or_url: A URL or string to add the template or configuration destination_dir: The project directory to add the layer to - no_input: If ``True`` force each layer's ``no_input`` attribute to ``True`` + no_input: If `True` force each layer's `no_input` attribute to `True` checkout: The branch, tag or commit to check out after git clone directory: Directory within repo that holds cookiecutter.json file overwrite_if_exists: Overwrite the contents of the output directory if it already exists diff --git a/cookie_composer/commands/create.py b/cookie_composer/commands/create.py index fee7fe8..0babe4c 100644 --- a/cookie_composer/commands/create.py +++ b/cookie_composer/commands/create.py @@ -32,7 +32,7 @@ def create_cmd( Args: path_or_url: The path or url to the composition file or template output_dir: Where to generate the project - no_input: If ``True`` force each layer's ``no_input`` attribute to ``True`` + no_input: If `True` force each layer's `no_input` attribute to `True` checkout: The branch, tag or commit to check out after git clone directory: Directory within repo that holds cookiecutter.json file overwrite_if_exists: Overwrite the contents of the output directory if it already exists diff --git a/cookie_composer/commands/link.py b/cookie_composer/commands/link.py index 5ea1dc1..3731d40 100644 --- a/cookie_composer/commands/link.py +++ b/cookie_composer/commands/link.py @@ -24,7 +24,7 @@ def link_cmd( Args: path_or_url: A URL or string to add the template or configuration destination_dir: The project directory to add the layer to - no_input: If ``True`` force each layer's ``no_input`` attribute to ``True`` + no_input: If `True` force each layer's `no_input` attribute to `True` checkout: The branch, tag or commit to check out after git clone directory: Directory within repo that holds cookiecutter.json file overwrite_if_exists: Overwrite the contents of the output directory if it already exists diff --git a/cookie_composer/commands/update.py b/cookie_composer/commands/update.py index 847268c..bbd3532 100644 --- a/cookie_composer/commands/update.py +++ b/cookie_composer/commands/update.py @@ -22,7 +22,7 @@ def update_cmd(project_dir: Optional[Path] = None, no_input: bool = False) -> No Args: project_dir: The project directory to update. Defaults to current directory. - no_input: If ``True`` force each layer's ``no_input`` attribute to ``True`` + no_input: If `True` force each layer's `no_input` attribute to `True` Raises: GitError: If the destination_dir is not a git repository @@ -117,17 +117,17 @@ def update_rendered_composition_layers( base: RenderedComposition, updated_layers: List[RenderedLayer] ) -> RenderedComposition: """ - Update ``base.layers`` with ``updated_layers`` where layer names match. + Update `base.layers` with `updated_layers` where layer names match. - If, for some reason, a layer exists in ``updated_layers`` but not in ``base``, it is discarded. + If, for some reason, a layer exists in `updated_layers` but not in `base`, it is discarded. Args: base: The base composition whose layers are to be updated updated_layers: The new rendered layers Raises: - RuntimeError: If a layer's location ``render_dir`` properties don't match - RuntimeError: If the compositions' ``rendered_name`` properties don't match + RuntimeError: If a layer's location `render_dir` properties don't match + RuntimeError: If the compositions' `rendered_name` properties don't match Returns: A new composition with updated layers diff --git a/cookie_composer/composition.py b/cookie_composer/composition.py index 4aa3216..25c9216 100644 --- a/cookie_composer/composition.py +++ b/cookie_composer/composition.py @@ -26,7 +26,7 @@ class RenderedComposition(BaseModel): render_dir: DirectoryPath """The directory in which the layers were rendered. - The ``render_dir`` + ``rendered_name`` is the location of the project.""" + The `render_dir` + `rendered_name` is the location of the project.""" rendered_name: str """The name of the rendered project.""" @@ -41,11 +41,11 @@ def get_context_for_layer(composition: RenderedComposition, index: Optional[int] """ Merge the contexts for all layers up to index. - An ``index`` of ``None`` does all the layers. + An `index` of `None` does all the layers. Args: composition: The rendered composition - index: Merge the contexts of the layers up to this 0-based index. ``None`` to do all layers. + index: Merge the contexts of the layers up to this 0-based index. `None` to do all layers. Returns: The comprehensively merged context diff --git a/cookie_composer/data_merge.py b/cookie_composer/data_merge.py index 1203828..f81ce24 100644 --- a/cookie_composer/data_merge.py +++ b/cookie_composer/data_merge.py @@ -139,10 +139,10 @@ def freeze_data(obj: Any) -> Any: """Do not merge the data, use the file path to determine what to do.""" NESTED_OVERWRITE = "nested-overwrite" -"""Merge deeply nested structures and overwrite at the lowest level; A deep ``dict.update()``.""" +"""Merge deeply nested structures and overwrite at the lowest level; A deep `dict.update()`.""" OVERWRITE = "overwrite" -"""Overwrite at the top level like ``dict.update()``.""" +"""Overwrite at the top level like `dict.update()`.""" COMPREHENSIVE = "comprehensive" """Comprehensively merge the two data structures. @@ -157,7 +157,7 @@ def get_merge_strategy(path: Path, merge_strategies: Dict[str, str]) -> str: """ Return the merge strategy of the path based on the layer configured rules. - Files that are not mergable return :attr:`~cookie_composer.composition.DO_NOT_MERGE` + Files that are not mergable return [DO_NOT_MERGE][cookie_composer.data_merge.DO_NOT_MERGE]. Args: path: The file path to evaluate. diff --git a/cookie_composer/diff.py b/cookie_composer/diff.py index 8517f52..62b41f6 100644 --- a/cookie_composer/diff.py +++ b/cookie_composer/diff.py @@ -56,7 +56,7 @@ def replace_diff_prefixes(diff: str, repo0_path: str, repo1_path: str) -> str: """ Replace the changed file prefixes in the diff output. - Our ``git diff --no-index`` command will output full paths like so:: + Our `git diff --no-index` command will output full paths like so:: --- upstream-template-old/tmp/tmpmp34g21y/remote/.coveragerc +++ upstream-template-new/tmp/tmpmp34g21y/local/.coveragerc @@ -68,8 +68,8 @@ def replace_diff_prefixes(diff: str, repo0_path: str, repo1_path: str) -> str: +++ upstream-template-new/.coveragerc - NIX OPs have ``{prefix}/folder/file`` - WIN OPS have ``{prefix}/c:/folder/file`` + NIX OPs have `{prefix}/folder/file` + WIN OPS have `{prefix}/c:/folder/file` More info on git-diff can be found here: http://git-scm.com/docs/git-diff diff --git a/cookie_composer/git_commands.py b/cookie_composer/git_commands.py index 34ef7a1..720d706 100644 --- a/cookie_composer/git_commands.py +++ b/cookie_composer/git_commands.py @@ -24,8 +24,8 @@ def get_repo( Args: project_dir: The directory containing the .git folder - search_parent_directories: if ``True``, all parent directories will be searched for a valid repo as well. - ensure_clean: if ``True``, raise an error if the repo is dirty + search_parent_directories: if `True`, all parent directories will be searched for a valid repo as well. + ensure_clean: if `True`, raise an error if the repo is dirty Raises: GitError: If the directory is not a git repo @@ -77,7 +77,7 @@ def branch_exists(repo: Repo, branch_name: str) -> bool: branch_name: The name of the branch to check for Returns: - ``True`` if the branch exists + `True` if the branch exists """ return branch_name in repo.refs @@ -89,10 +89,10 @@ def remote_branch_exists(repo: Repo, branch_name: str, remote_name: str = "origi Args: repo: The repository to check branch_name: The name of the branch to check for - remote_name: The name of the remote reference. Defaults to ``origin`` + remote_name: The name of the remote reference. Defaults to `origin` Returns: - ``True`` if the branch exists in the remote repository + `True` if the branch exists in the remote repository """ if remote_name in repo.remotes: return branch_name in repo.remotes[remote_name].refs diff --git a/cookie_composer/io.py b/cookie_composer/io.py index 1c3a1bd..776bce7 100644 --- a/cookie_composer/io.py +++ b/cookie_composer/io.py @@ -28,7 +28,7 @@ def serialize_layer(layer: LayerConfig) -> dict: return layer_info -def deserialize_layer(layer_info: dict, local_path: Optional[Path] = None, **kwargs) -> LayerConfig: +def deserialize_layer(layer_info: dict, local_path: Optional[Path] = None, **kwargs: Any) -> LayerConfig: """Deserialize a layer configuration from a rendered layer.""" from cookie_composer.templates.source import get_template_repo @@ -145,20 +145,20 @@ def write_yaml(path: Path, contents: List[dict]) -> None: def is_composition_file(path_or_url: Union[str, Path]) -> bool: """ - Return ``True`` if the filename a composition file. + Return `True` if the filename a composition file. Args: path_or_url: The path or URL to check Returns: - ``True`` if the path is a configuration file. + `True` if the path is a configuration file. """ return Path(path_or_url).suffix in {".yaml", ".yml"} -def read_composition(path_or_url: Union[str, Path], **kwargs) -> Composition: +def read_composition(path_or_url: Union[str, Path], **kwargs: Any) -> Composition: """ - Read a YAML file and return a :class:`~.Composition`. + Read a YAML file and return a [Composition][cookie_composer.composition.Composition]. Args: path_or_url: The location of the configuration file @@ -176,7 +176,7 @@ def read_composition(path_or_url: Union[str, Path], **kwargs) -> Composition: def read_rendered_composition(path: Path) -> RenderedComposition: """ - Read a ``.composition.yaml`` from a rendered project. + Read a `.composition.yaml` from a rendered project. Args: path: The path to the .composition.yaml file to read @@ -214,14 +214,14 @@ def get_composition_from_path_or_url( initial_context: Optional[MutableMapping[str, Any]] = None, ) -> Composition: """ - Generate a :class:`Composition` from a path or URL. + Generate a [Composition][cookie_composer.composition.Composition] from a path or URL. Args: path_or_url: The path or url to the composition file or template checkout: The branch, tag or commit to check out after git clone default_config: Do not load a config file. Use the defaults instead directory: Directory within repo that holds cookiecutter.json file - no_input: If ``True`` force each layer's ``no_input`` attribute to ``True`` + no_input: If `True` force each layer's `no_input` attribute to `True` output_dir: Where to generate the project overwrite_if_exists: Overwrite the contents of the output directory if it already exists skip_if_file_exists: Skip the files in the corresponding directories if they already exist diff --git a/cookie_composer/layers.py b/cookie_composer/layers.py index ee31e14..0110245 100644 --- a/cookie_composer/layers.py +++ b/cookie_composer/layers.py @@ -98,11 +98,13 @@ def generate_context( Get the context for prompting the user for values. The order of precedence is: + 1. `initial_context` from the composition or command-line 2. `default_context` from the user_config 3. `raw context` from the template - Equivalent to `cookiecutter.generate.generate_context` but with the following differences: + Equivalent to [cookiecutter.generate.generate_context][] but with the following differences: + 1. Reading the raw context file is handled by the layer's template 2. The layer's initial context is treated as the `extra_context` 3. Does not namespace the context with `{"cookiecutter": ...}` @@ -161,7 +163,7 @@ def latest_commit(self) -> Optional[str]: @model_validator(mode="before") @classmethod def set_rendered_name(cls, values: Dict[str, Any]) -> Dict[str, Any]: - """Set the :attr:`~.RenderedLayer.layer_name`` to the name of the rendered template directory.""" + """Set the [cookie_composer.layers.RenderedLayer.layer_name] to the name of the rendered template directory.""" if "rendered_name" in values: return values @@ -246,7 +248,7 @@ def render_layer( render_dir: Where to render the template full_context: The extra context from all layers in the composition commit: The commit to checkout if the template is a git repo - accept_hooks: Accept pre- and post-hooks if set to ``True`` + accept_hooks: Accept pre- and post-hooks if set to `True` Returns: The rendered layer information @@ -318,7 +320,7 @@ def get_layer_context( - initial context set in the template composition (or {} if not a composition or not set) - initial context passed in by user (as set from the command line. This is merged into the layer's inital context when the layer is deserialized. See - :func:`cookie_composer.io.get_composition_from_path_or_url`) + [cookie_composer.io.get_composition_from_path_or_url][]) - context from previous layers @@ -327,7 +329,7 @@ def get_layer_context( context_for_prompting: The raw context from the cookiecutter.json file with user defaults applied initial_context: The initial context from the layer configuration full_context: A full context from previous layers. - no_input: If ``False`` do not prompt for missing values and use defaults instead. + no_input: If `False` do not prompt for missing values and use defaults instead. Returns: A dict containing the context for rendering the layer @@ -350,10 +352,10 @@ def render_layers( Render layers to a destination. Args: - layers: A list of ``LayerConfig`` to render + layers: A list of `LayerConfig` to render destination: The location to merge the rendered layers to initial_context: An initial context to pass to the rendering - no_input: If ``True`` force each layer's ``no_input`` attribute to ``True`` + no_input: If `True` force each layer's `no_input` attribute to `True` accept_hooks: How to process pre/post hooks. Returns: diff --git a/cookie_composer/matching.py b/cookie_composer/matching.py index 3b894b7..5baa206 100644 --- a/cookie_composer/matching.py +++ b/cookie_composer/matching.py @@ -6,7 +6,7 @@ def rel_fnmatch(name: str, pat: str) -> bool: - """Force a relative match of the pattern by prefixing a ``*``.""" + """Force a relative match of the pattern by prefixing a `*`.""" return fnmatch(name, pat) if pat.startswith("*") else fnmatch(name, f"*{pat}") @@ -19,6 +19,6 @@ def matches_any_glob(path: Union[str, Path], patterns: List[str]) -> bool: patterns: A list of glob patterns Returns: - ``True`` if it matches any of the patterns + `True` if it matches any of the patterns """ return any(rel_fnmatch(str(path), pat) for pat in patterns) diff --git a/cookie_composer/merge_files/__init__.py b/cookie_composer/merge_files/__init__.py index 21ceaec..5dccefc 100644 --- a/cookie_composer/merge_files/__init__.py +++ b/cookie_composer/merge_files/__init__.py @@ -3,8 +3,6 @@ The merging functions should look similar to the following: -:: - def merge_generic_files(origin: Path, destination: Path, merge_strategy: str): ''' Merge two ??? files into one. @@ -20,7 +18,7 @@ def merge_generic_files(origin: Path, destination: Path, merge_strategy: str): The function must write the file to destination. -The function must wrap any errors into a :py:exc:`~cookie_composer.exceptions.MergeError` and raise it. +The function must wrap any errors into a [MergeError][cookie_composer.exceptions.MergeError] and raise it. """ from pathlib import Path diff --git a/cookie_composer/templates/source.py b/cookie_composer/templates/source.py index a271e53..6f90128 100644 --- a/cookie_composer/templates/source.py +++ b/cookie_composer/templates/source.py @@ -44,7 +44,7 @@ def get_template_repo( password: The password to use if template is a password-protected Zip archive. Returns: - A :class:`TemplateRepo` object. + A [TemplateRepo][cookie_composer.templates.types.TemplateRepo] object. """ user_config = get_user_config() tmpl_format, locality = identify_repo(url, local_path) diff --git a/cookie_composer/templates/types.py b/cookie_composer/templates/types.py index 0f5ce9d..3748319 100644 --- a/cookie_composer/templates/types.py +++ b/cookie_composer/templates/types.py @@ -72,10 +72,10 @@ def latest_sha(self) -> Optional[str]: """ Return the latest SHA of this template's repo. - If the template is not a git repository, it will always return ``None``. + If the template is not a git repository, it will always return `None`. Returns: - The latest hexsha of the template or ``None`` if the template isn't a git repo + The latest hexsha of the template or `None` if the template isn't a git repo """ from cookie_composer.git_commands import get_repo diff --git a/cookie_composer/utils.py b/cookie_composer/utils.py index 9ec82b1..fd03376 100644 --- a/cookie_composer/utils.py +++ b/cookie_composer/utils.py @@ -13,12 +13,12 @@ def echo( nl: bool = True, err: bool = False, color: Optional[bool] = None, - **styles, + **styles: Any, ) -> None: """ A local abstraction for printing messages. - Default behavior is that of ``click.secho`` . + Default behavior is that of [click.secho][]. This is to allow user feedback without every function requiring a click dependency. Especially during testing. @@ -64,13 +64,13 @@ def get_deleted_files(template_dir: Path, project_dir: Path) -> Set[Path]: def remove_paths(root: Path, paths_to_remove: Set[Path]) -> None: """ - Remove all paths in ``paths_to_remove`` from ``root``. + Remove all paths in `paths_to_remove` from `root`. Nabbed from Cruft: https://github.com/cruft/cruft/ Args: root: The absolute path of the directory requiring path removal - paths_to_remove: The set of relative paths to remove from ``root`` + paths_to_remove: The set of relative paths to remove from `root` """ # There is some redundancy here in chmod-ing dirs and/or files differently. abs_paths_to_remove = [root / path_to_remove for path_to_remove in paths_to_remove] diff --git a/mkdocs.yml b/mkdocs.yml index a4cec37..c9273fd 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -85,9 +85,11 @@ plugins: python: import: - https://docs.python.org/3/objects.inv - - https://numpy.org/doc/stable/objects.inv - - https://pandas.pydata.org/docs/objects.inv - - https://api.python.langchain.com/en/latest/objects.inv + - https://docs.pydantic.dev/latest/objects.inv + - https://jinja.palletsprojects.com/en/3.1.x/objects.inv + - https://cookiecutter.readthedocs.io/en/stable/objects.inv + - https://gitpython.readthedocs.io/en/stable/objects.inv + - https://click.palletsprojects.com/en/8.1.x/objects.inv options: allow_inspection: true docstring_style: google diff --git a/tests/fixtures/local_extension_template/local_extensions/main.py b/tests/fixtures/local_extension_template/local_extensions/main.py index 0088832..5029245 100644 --- a/tests/fixtures/local_extension_template/local_extensions/main.py +++ b/tests/fixtures/local_extension_template/local_extensions/main.py @@ -1,4 +1,4 @@ -"""Provides a custom extension, exposing a ``foobar`` filter.""" +"""Provides a custom extension, exposing a `foobar` filter.""" from cookiecutter.utils import simple_filter from jinja2.ext import Extension From 68a86022692351fdf01c28cb7e134df79505b92b Mon Sep 17 00:00:00 2001 From: Corey Oordt Date: Sun, 5 May 2024 07:21:41 -0500 Subject: [PATCH 04/13] Updated the GitHub workflows --- .../package-and-upload-artifacts/action.yaml | 49 ++++++++ .github/actions/release/action.yaml | 39 ++++++ .../actions/setup-python-and-git/action.yaml | 23 ++++ .github/dependabot.yml | 13 ++ .github/workflows/bumpversion.yaml | 97 --------------- .github/workflows/codeql-analysis.yml | 72 ----------- .github/workflows/docs-final.yml | 31 +++++ .github/workflows/docs-preview.yml | 38 ++++++ .github/workflows/publish-docs.yaml | 25 ---- .github/workflows/publish-package.yaml | 31 ----- .github/workflows/release.yaml | 78 ++++++++++++ .github/workflows/test.yaml | 117 +++++++++++++----- .github/workflows/version-preview.yaml | 69 +++++++++++ 13 files changed, 423 insertions(+), 259 deletions(-) create mode 100644 .github/actions/package-and-upload-artifacts/action.yaml create mode 100644 .github/actions/release/action.yaml create mode 100644 .github/actions/setup-python-and-git/action.yaml create mode 100644 .github/dependabot.yml delete mode 100644 .github/workflows/bumpversion.yaml delete mode 100644 .github/workflows/codeql-analysis.yml create mode 100644 .github/workflows/docs-final.yml create mode 100644 .github/workflows/docs-preview.yml delete mode 100644 .github/workflows/publish-docs.yaml delete mode 100644 .github/workflows/publish-package.yaml create mode 100644 .github/workflows/release.yaml create mode 100644 .github/workflows/version-preview.yaml diff --git a/.github/actions/package-and-upload-artifacts/action.yaml b/.github/actions/package-and-upload-artifacts/action.yaml new file mode 100644 index 0000000..a06b83c --- /dev/null +++ b/.github/actions/package-and-upload-artifacts/action.yaml @@ -0,0 +1,49 @@ +name: Package and upload artifacts +description: Package a Python project and upload the artifacts and release notes +inputs: + tag-name: + description: 'The name of the tag for the GitHub release' + required: true +runs: + using: 'composite' + steps: + - name: Parse changelog for release notes + shell: bash + run: | + function extract_version_content() { + changelog=$1 + target_version=$2 + + awk -v target="$target_version" ' + /^## / { + if (found) exit; + version=$2; + if (version == target) found=1; + next; + } + found { print; } + ' <<< "$changelog" + } + + changelog=$(cat "CHANGELOG.md") + target_version=${{ inputs.tag-name }} + echo "TAG_NAME=$target_version" >> $GITHUB_ENV + content=$(extract_version_content "$changelog" "$target_version") + + if [ -n "$content" ]; then + echo "::notice::Found release notes for ${target_version}" + echo "$content" >> release-notes.md + else + echo "::warning::Did not find release notes for ${target_version}" + touch release-notes.md + fi + + - name: Upload release notes + uses: actions/upload-artifact@v4 + with: + name: release-notes + path: release-notes.md + + - name: Package and upload artifacts + if: ${{ env.PACKAGE == 'true' }} + uses: hynek/build-and-inspect-python-package@v2 diff --git a/.github/actions/release/action.yaml b/.github/actions/release/action.yaml new file mode 100644 index 0000000..649bb60 --- /dev/null +++ b/.github/actions/release/action.yaml @@ -0,0 +1,39 @@ +name: Release +description: Create a GitHub release and upload the package to PyPI +inputs: + pypi-api-token: + description: 'PyPI API token' + required: true + tag-name: + description: 'The name of the tag for the GitHub release' + required: true + github-token: + description: 'GitHub token' + required: true + +runs: + using: "composite" + steps: + - name: Download packages built by build-and-inspect-python-package + uses: actions/download-artifact@v4 + with: + name: Packages + path: dist + + - name: Download release notes + uses: actions/download-artifact@v4 + with: + name: release-notes + + - name: Create a GitHub release + uses: softprops/action-gh-release@v1 + with: + files: dist/* + tag_name: "${{ inputs.tag-name }}" + body_path: release-notes.md + token: ${{ inputs.github-token }} + + - name: Upload package to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 + with: + password: ${{ inputs.pypi-api-token }} diff --git a/.github/actions/setup-python-and-git/action.yaml b/.github/actions/setup-python-and-git/action.yaml new file mode 100644 index 0000000..44b7247 --- /dev/null +++ b/.github/actions/setup-python-and-git/action.yaml @@ -0,0 +1,23 @@ +name: checkout-and-setup-python +description: 'Checkout the repository and setup Python' +inputs: + python-version: + description: 'Python version to use' + required: false + default: '3.11' +runs: + using: 'composite' + steps: + - uses: actions/setup-python@v4 + name: Setup Python + with: + python-version: ${{ inputs.python-version }} + cache: 'pip' # caching pip dependencies + + - name: Git check + run: | + git config --global user.email "action@github.actions" + git config --global user.name "Testing Git" + git --version + git config --list + shell: bash diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..be006de --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,13 @@ +# Keep GitHub Actions up to date with GitHub's Dependabot... +# https://docs.github.com/en/code-security/dependabot/working-with-dependabot/keeping-your-actions-up-to-date-with-dependabot +# https://docs.github.com/en/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file#package-ecosystem +version: 2 +updates: + - package-ecosystem: github-actions + directory: / + groups: + github-actions: + patterns: + - "*" # Group all Actions updates into a single larger pull request + schedule: + interval: weekly diff --git a/.github/workflows/bumpversion.yaml b/.github/workflows/bumpversion.yaml deleted file mode 100644 index 07ec6c4..0000000 --- a/.github/workflows/bumpversion.yaml +++ /dev/null @@ -1,97 +0,0 @@ -name: Auto-bump the version -on: - pull_request: - types: [closed] - branches: [master] - workflow_dispatch: - inputs: - dry_run: - description: Don't actually do the work, just describe it - default: true - type: boolean - new_version: - description: Set the version to a specific value - required: false - type: string - verbose: - description: The amount of output detail - default: 0 - type: choice - options: - - "0" - - "1" - - "2" - -jobs: - bumpversion: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - with: - fetch-depth: 0 - token: ${{ secrets.PAT }} - - - uses: actions/setup-python@v4 - with: - python-version: '3.11' - cache: 'pip' # caching pip dependencies - - - name: Install requirements - run: | - python -m pip install generate-changelog bump-my-version build - - - name: Git check - run: | - git config --global user.email "bump-my-version@github.actions" - git config --global user.name "Testing Git" - git --version - git config --list - - - name: Generate the changelog and get the release hint - id: generate-changelog - run: | - RELEASE_KIND=$(generate-changelog --output release-hint) - echo "::notice::Suggested release type is: ${RELEASE_KIND}" - echo "RELEASE_KIND=$RELEASE_KIND" >> $GITHUB_ENV - echo "release-kind=$RELEASE_KIND" >> $GITHUB_OUTPUT - - - name: Bump Version auto - if: ${{ github.event_name != 'workflow_dispatch' }} - shell: bash - run: | - if [[ $RELEASE_KIND != "no-release" ]]; then - bump-my-version -v "$RELEASE_KIND" - git push - git push --tags - fi - - - name: Bump Version manual - if: ${{ github.event_name == 'workflow_dispatch' }} - shell: bash - env: - BUMPVERSION_DRY_RUN: ${{ inputs.dry_run }} - BUMPVERSION_NEW_VERSION: ${{ inputs.tags }} - BUMPVERSION_VERBOSE: ${{ inputs.verbose }} - run: | - PR_NUMBER=$(gh pr view --json number -q .number || echo "") - REVISION=$(git describe --tags --long | awk -F- '{print $2}') - export PR_NUMBER REVISION - case "$RELEASE_KIND" in - major|minor|patch) - bump-my-version bump "$RELEASE_KIND" - if [[ BUMPVERSION_DRY_RUN == "false" ]]; then - git push - git push --tags - fi - ;; - dev) - bump-my-version bump -v --no-tag --no-commit "dev" - python -m build - ;; - esac - - name: Publish package - if: ${{ github.event_name == 'workflow_dispatch' && success() }} - uses: pypa/gh-action-pypi-publish@v1.5.0 - with: - user: __token__ - password: ${{ secrets.PYPI_API_TOKEN }} diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml deleted file mode 100644 index f5eafe5..0000000 --- a/.github/workflows/codeql-analysis.yml +++ /dev/null @@ -1,72 +0,0 @@ -# For most projects, this workflow file will not need changing; you simply need -# to commit it to your repository. -# -# You may wish to alter this file to override the set of languages analyzed, -# or to provide custom queries or build logic. -# -# ******** NOTE ******** -# We have attempted to detect the languages in your repository. Please check -# the `language` matrix defined below to confirm you have the correct set of -# supported CodeQL languages. -# -name: "CodeQL" - -on: - push: - branches: [ master ] - pull_request: - # The branches below must be a subset of the branches above - branches: [ master ] - schedule: - - cron: '37 21 * * 5' - -jobs: - analyze: - name: Analyze - runs-on: ubuntu-latest - permissions: - actions: read - contents: read - security-events: write - - strategy: - fail-fast: false - matrix: - language: [ 'python' ] - # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ] - # Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support - - steps: - - name: Checkout repository - uses: actions/checkout@v3 - - # Initializes the CodeQL tools for scanning. - - name: Initialize CodeQL - uses: github/codeql-action/init@v2 - with: - languages: ${{ matrix.language }} - # If you wish to specify custom queries, you can do so here or in a config file. - # By default, queries listed here will override any specified in a config file. - # Prefix the list here with "+" to use these queries and those in the config file. - - # Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs - # queries: security-extended,security-and-quality - - - # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). - # If this step fails, then you should remove it and run the build manually (see below) - - name: Autobuild - uses: github/codeql-action/autobuild@v2 - - # ℹī¸ Command-line programs to run using the OS shell. - # 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun - - # If the Autobuild fails above, remove it and uncomment the following three lines. - # modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance. - - # - run: | - # echo "Run, Build Application using script" - # ./location_of_script_within_repo/buildscript.sh - - - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v2 diff --git a/.github/workflows/docs-final.yml b/.github/workflows/docs-final.yml new file mode 100644 index 0000000..71200ad --- /dev/null +++ b/.github/workflows/docs-final.yml @@ -0,0 +1,31 @@ +name: Deploy final documentation + +on: + push: + branches: [ "master" ] + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + token: ${{ secrets.PAT }} + + - name: Set up Python 3.10 + uses: actions/setup-python@v5 + with: + python-version: "3.10" + + - name: Install dependencies + run: | + git pull --all + python -m pip install ".[docs]" + + - name: Build and deploy documentation + run: | + mkdocs gh-deploy --strict -v diff --git a/.github/workflows/docs-preview.yml b/.github/workflows/docs-preview.yml new file mode 100644 index 0000000..db4fbd1 --- /dev/null +++ b/.github/workflows/docs-preview.yml @@ -0,0 +1,38 @@ +name: Deploy PR previews + +on: + pull_request: + types: + - opened + - reopened + - synchronize + - closed + +concurrency: preview-${{ github.ref }} + +jobs: + deploy-preview: + runs-on: ubuntu-20.04 + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Set up Python 3.10 + uses: actions/setup-python@v5 + with: + python-version: "3.10" + + - name: Install dependencies + run: | + python -m pip install ".[docs]" + + - name: Build documentation + run: | + mkdocs build --strict -v + + - name: Deploy preview + uses: rossjrw/pr-preview-action@v1 + with: + source-dir: ./site/ diff --git a/.github/workflows/publish-docs.yaml b/.github/workflows/publish-docs.yaml deleted file mode 100644 index d2fe14f..0000000 --- a/.github/workflows/publish-docs.yaml +++ /dev/null @@ -1,25 +0,0 @@ -# This workflow will upload a Python Package using Twine when a release is created -# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries - -name: Publish Documentation - -on: - push: - tags: - - '*' - -jobs: - publish-docs: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - name: Set up Python - uses: actions/setup-python@v3 - with: - python-version: '3.x' - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install -r requirements/docs.txt - - name: Build and publish docs - run: make pubdocs diff --git a/.github/workflows/publish-package.yaml b/.github/workflows/publish-package.yaml deleted file mode 100644 index 63174b5..0000000 --- a/.github/workflows/publish-package.yaml +++ /dev/null @@ -1,31 +0,0 @@ -# This workflow will upload a Python Package using Twine when a release is created -# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries - -name: Upload Python Package - -on: - push: - tags: - - '*' - -jobs: - publish-package: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - name: Set up Python - uses: actions/setup-python@v4 - with: - python-version: '3.11' - cache: 'pip' # caching pip dependencies - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install build - - name: Build package - run: python -m build - - name: Publish package - uses: pypa/gh-action-pypi-publish@v1.5.0 - with: - user: __token__ - password: ${{ secrets.PYPI_API_TOKEN }} diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml new file mode 100644 index 0000000..def335a --- /dev/null +++ b/.github/workflows/release.yaml @@ -0,0 +1,78 @@ +name: Bump the version on merge +on: + pull_request: + types: [closed] + branches: [master] + +jobs: + version: + permissions: + id-token: write + pull-requests: read + contents: write + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + name: Checkout the repository + with: + fetch-depth: 0 + token: ${{ secrets.PAT }} + + - name: Setup Python and Git + uses: ./.github/actions/setup-python-and-git + with: + python-version: '3.11' + + - name: Install requirements + run: | + python -m pip install generate-changelog bump-my-version + + - name: Generate the changelog and get the release hint + id: generate-changelog + run: | + RELEASE_KIND=$(generate-changelog --output release-hint) + echo "::notice::Suggested release type for this branch is: ${RELEASE_KIND}" + echo "RELEASE_KIND=$RELEASE_KIND" >> $GITHUB_ENV + echo "release-kind=$RELEASE_KIND" >> $GITHUB_OUTPUT + echo "PACKAGE=false" >> $GITHUB_ENV + + - name: Get Pull Request Number + id: pr + run: | + PR_NUMBER=$(gh pr view --json number -q .number || echo "${{ github.event.number }}") + echo "pull_request_number=${PR_NUMBER}" >> $GITHUB_OUTPUT + echo "::notice::PR_NUMBER is ${PR_NUMBER}" + echo "PR_NUMBER=$PR_NUMBER" >> $GITHUB_ENV + env: + GITHUB_TOKEN: ${{ secrets.PAT }} + + - name: Bump version + if: ${{ env.RELEASE_KIND != 'no-release' }} + shell: bash + run: | + case "$RELEASE_KIND" in + major|minor|patch) + bump-my-version bump --allow-dirty --verbose "$RELEASE_KIND" + echo "TAG_NAME=$(bump-my-version show current_version)" >> $GITHUB_ENV + git push + git push --tags + echo "PACKAGE=true" >> $GITHUB_ENV + ;; + dev) + echo "Intentionally not bumping version for dev release" + ;; + esac + + - name: Package and upload artifacts + if: ${{ env.PACKAGE == 'true' }} + uses: ./.github/actions/package-and-upload-artifacts + with: + tag-name: ${{ env.TAG_NAME }} + + - name: Create a GitHub release + if: ${{ env.PACKAGE == 'true' }} + uses: ./.github/actions/release + with: + tag-name: ${{ env.TAG_NAME }} + github-token: ${{ secrets.PAT }} + pypi-api-token: ${{ secrets.PYPI_API_TOKEN }} diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 18efdbe..a83b2d2 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -1,45 +1,94 @@ -name: Test +name: CI on: - # Trigger the workflow on push or pull request, - # but only for the main branch - push: - branches: - - master pull_request: - branches: - - master - # Also trigger on page_build, as well as release created events - page_build: - release: - types: # Does not affect page_build above. - - created + types: [opened, synchronize] + branches: [master] + +defaults: + run: + shell: bash + +env: + PYTHONUTF8: "1" jobs: - test: - runs-on: ubuntu-latest + test: strategy: fail-fast: false matrix: - python-version: [3.8, 3.9, "3.10", "3.11"] + os: + - ubuntu-latest + - windows-latest + python-version: + - "3.8" + - "3.9" + - "3.10" + - "3.11" + - "3.12" + runs-on: ${{ matrix.os }} + steps: + - uses: ./.github/actions/setup-python + with: + python-version: ${{ matrix.python-version }} + - name: Check git is working + run: | + git config --global user.email "test-git@github.actions" + git config --global user.name "Testing Git" + git --version + git config --list + - name: Install test dependencies + run: pip install '.[test]' + - name: Test + run: pytest --cov-report=xml + - name: Upload coverage to Codecov + uses: codecov/codecov-action@v3 + with: + token: ${{ secrets.CODECOV_TOKEN }} + files: test-reports/coverage.xml + flags: python-${{ matrix.python-version }} + verbose: true # optional (default = false) + env_vars: OS,PYTHON + # Upload to Test PyPI. + release-test-pypi: + name: Publish in-dev package to test.pypi.org + runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v3 - with: - python-version: ${{ matrix.python-version }} - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install -r requirements/test.txt - - name: Test with pytest - run: | - pytest - coverage lcov - - uses: codecov/codecov-action@v3 - with: - files: ./coverage.xml - flags: python-${{ matrix.python-version }} - verbose: true # optional (default = false) + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + token: ${{ secrets.PAT }} + ref: ${{ github.head_ref }} + + - uses: actions/setup-python@v4 + with: + python-version: '3.11' + cache: 'pip' # caching pip dependencies + + - name: Install requirements + shell: bash + run: | + python -m pip install --disable-pip-version-check --no-python-version-warning build + python -m pip install --disable-pip-version-check --no-python-version-warning -e . + + - name: Set dev version + shell: bash + run: | + export PR_NUMBER=$(gh pr view --json number -q .number || echo "") + echo "PR_NUMBER=$PR_NUMBER" >> $GITHUB_ENV + echo "::notice::PR_NUMBER is: ${PR_NUMBER}" + bump-my-version bump dev bumpversion/__init__.py --no-commit --no-tag --no-configured-files -v + env: + GH_TOKEN: ${{ secrets.PAT }} + + - name: Package + shell: bash + run: | + python -m build + + - name: Upload package to Test PyPI + uses: pypa/gh-action-pypi-publish@release/v1 + with: + repository-url: https://test.pypi.org/legacy/ diff --git a/.github/workflows/version-preview.yaml b/.github/workflows/version-preview.yaml new file mode 100644 index 0000000..e65a9ab --- /dev/null +++ b/.github/workflows/version-preview.yaml @@ -0,0 +1,69 @@ +name: Display the version hint +on: + pull_request: + types: [synchronize, opened, reopened, ready_for_review] + branches: [master] + +jobs: + preview-version-hint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + name: Checkout the repository + with: + fetch-depth: 0 + ref: ${{ github.event.pull_request.head.sha }} + token: ${{ secrets.PAT }} + + - name: Setup Python and Git + uses: ./.github/actions/setup-python-and-git + with: + python-version: '3.11' + + - name: Install requirements + run: | + python -m pip install generate-changelog bump-my-version + + - name: Get the release hint + id: generate-changelog + run: | + RELEASE_KIND=$(generate-changelog --output release-hint --branch-override ${{ github.base_ref }} --skip-output-pipeline) + echo "::notice::Suggested release type upon merge to ${{ github.base_ref }}: ${RELEASE_KIND}" + echo "RELEASE_KIND=$RELEASE_KIND" >> $GITHUB_ENV + echo "release-kind=$RELEASE_KIND" >> $GITHUB_OUTPUT + + - name: Get Pull Request Number + id: pr + run: | + PR_NUMBER=$(gh pr view --json number -q .number || echo "${{ github.event.number }}") + echo "pull_request_number=${PR_NUMBER}" >> $GITHUB_OUTPUT + echo "::notice::PR_NUMBER is ${PR_NUMBER}" + echo "PR_NUMBER=$PR_NUMBER" >> $GITHUB_ENV + env: + GITHUB_TOKEN: ${{ secrets.PAT }} + + - name: Bump version dry run + if: ${{ env.RELEASE_KIND != 'no-release' }} + shell: bash + run: | + # This will display a full log of what would happen if we were to bump the version. + bump-my-version bump --dry-run --verbose "$RELEASE_KIND" + + # This retrieves the current and new version numbers as a JSON-formatted string. + VERSION_INFO=$(bump-my-version show --format json --increment "$RELEASE_KIND" current_version new_version) + echo "CURRENT_VERSION=$(echo $VERSION_INFO | jq -r .current_version)" >> $GITHUB_ENV + echo "NEW_VERSION=$(echo $VERSION_INFO | jq -r .new_version)" >> $GITHUB_ENV + + - name: Set no-release information + if: ${{ env.RELEASE_KIND == 'no-release' }} + run: | + echo "CURRENT_VERSION=$(bump-my-version show current_version)" >> $GITHUB_ENV + echo "NEW_VERSION=$(bump-my-version show current_version)" >> $GITHUB_ENV + + - name: Display the version hint + uses: s-gehring/singleton-comment@v1 + with: + comment-body: | + **Version hint:** ${{ env.RELEASE_KIND }} + **Current version:** ${{ env.CURRENT_VERSION }} + **New version (when merged):** ${{ env.NEW_VERSION }} From aa8aed70a6ae66a5a0d06d2d879df9f17c26366d Mon Sep 17 00:00:00 2001 From: Corey Oordt Date: Sun, 5 May 2024 07:25:02 -0500 Subject: [PATCH 05/13] Fixed a typo in the workflows --- .github/workflows/test.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index a83b2d2..c585aed 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -29,7 +29,7 @@ jobs: - "3.12" runs-on: ${{ matrix.os }} steps: - - uses: ./.github/actions/setup-python + - uses: ./.github/actions/setup-python-and-git with: python-version: ${{ matrix.python-version }} - name: Check git is working From 95c90402f695076cc63140e6e9fb1afb7abe33c5 Mon Sep 17 00:00:00 2001 From: Corey Oordt Date: Sun, 5 May 2024 07:27:57 -0500 Subject: [PATCH 06/13] Fixed missing checkout in workflows --- .github/workflows/test.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index c585aed..c2c6d46 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -29,6 +29,7 @@ jobs: - "3.12" runs-on: ${{ matrix.os }} steps: + - uses: actions/checkout@v4 - uses: ./.github/actions/setup-python-and-git with: python-version: ${{ matrix.python-version }} From 7c59fc285a7dc831e7c1f907b8192ba69b1f7434 Mon Sep 17 00:00:00 2001 From: Corey Oordt Date: Sun, 5 May 2024 07:34:56 -0500 Subject: [PATCH 07/13] Fixed test PyPI upload --- .github/workflows/test.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index c2c6d46..e546ab0 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -72,7 +72,7 @@ jobs: shell: bash run: | python -m pip install --disable-pip-version-check --no-python-version-warning build - python -m pip install --disable-pip-version-check --no-python-version-warning -e . + python -m pip install --disable-pip-version-check --no-python-version-warning bump-my-version - name: Set dev version shell: bash @@ -80,7 +80,7 @@ jobs: export PR_NUMBER=$(gh pr view --json number -q .number || echo "") echo "PR_NUMBER=$PR_NUMBER" >> $GITHUB_ENV echo "::notice::PR_NUMBER is: ${PR_NUMBER}" - bump-my-version bump dev bumpversion/__init__.py --no-commit --no-tag --no-configured-files -v + bump-my-version bump dev --no-commit --no-tag -v env: GH_TOKEN: ${{ secrets.PAT }} From 8061547ed57c0f435c70a0a3dd7f3fd08532787e Mon Sep 17 00:00:00 2001 From: Corey Oordt Date: Sun, 5 May 2024 08:01:21 -0500 Subject: [PATCH 08/13] Added some debugging statements for windows !wip --- cookie_composer/templates/source.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cookie_composer/templates/source.py b/cookie_composer/templates/source.py index 6f90128..2b3d8b0 100644 --- a/cookie_composer/templates/source.py +++ b/cookie_composer/templates/source.py @@ -15,7 +15,8 @@ def identify_repo(url: str, local_path: Optional[Path] = None) -> Tuple[Template """Identify the repo format and locality from the URL.""" parsed_url = urlparse(url) locality = Locality.LOCAL if parsed_url.scheme in {"", "file"} else Locality.REMOTE - + print(locality) + print(parsed_url.scheme) if url.endswith(".zip"): return TemplateFormat.ZIP, locality From 9d14ae4a8290a3b563ef8b25289cfc0e4bf5ebb3 Mon Sep 17 00:00:00 2001 From: Corey Oordt Date: Sun, 5 May 2024 08:05:39 -0500 Subject: [PATCH 09/13] Fixed parseurl with windows path Was making the drive letter the scheme. --- cookie_composer/templates/source.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/cookie_composer/templates/source.py b/cookie_composer/templates/source.py index 2b3d8b0..2690c09 100644 --- a/cookie_composer/templates/source.py +++ b/cookie_composer/templates/source.py @@ -14,9 +14,8 @@ def identify_repo(url: str, local_path: Optional[Path] = None) -> Tuple[TemplateFormat, Locality]: """Identify the repo format and locality from the URL.""" parsed_url = urlparse(url) - locality = Locality.LOCAL if parsed_url.scheme in {"", "file"} else Locality.REMOTE - print(locality) - print(parsed_url.scheme) + locality = Locality.LOCAL if parsed_url.scheme in {"", "file", "a", "b", "c", "d"} else Locality.REMOTE + if url.endswith(".zip"): return TemplateFormat.ZIP, locality From 98aa8e14733ed06cbd51069d42fe4d4c52de4aea Mon Sep 17 00:00:00 2001 From: Corey Oordt Date: Sun, 5 May 2024 08:22:45 -0500 Subject: [PATCH 10/13] Fixed removing trees on windows --- cookie_composer/git_commands.py | 7 +++---- cookie_composer/templates/git_repo.py | 4 ++-- cookie_composer/templates/types.py | 7 ++++--- tests/conftest.py | 7 ++++++- tests/test_authentication.py | 5 +++++ tests/test_commands/test_update.py | 3 ++- 6 files changed, 22 insertions(+), 11 deletions(-) diff --git a/cookie_composer/git_commands.py b/cookie_composer/git_commands.py index 720d706..8984d83 100644 --- a/cookie_composer/git_commands.py +++ b/cookie_composer/git_commands.py @@ -1,7 +1,6 @@ """Functions for using git.""" import logging -import shutil import subprocess import tempfile from contextlib import contextmanager @@ -11,7 +10,7 @@ from git import GitCommandError, InvalidGitRepositoryError, NoSuchPathError, Repo from cookie_composer.exceptions import GitError -from cookie_composer.utils import echo +from cookie_composer.utils import echo, remove_single_path logger = logging.getLogger(__name__) @@ -242,6 +241,6 @@ def temp_git_worktree_dir( raise GitError(f"Could not create a worktree for {repo_path}") from e finally: # Clean up the temporary working directory. - shutil.rmtree(worktree_path) - shutil.rmtree(tmp_dir) + remove_single_path(worktree_path) + remove_single_path(tmp_dir) repo.git.worktree("prune") diff --git a/cookie_composer/templates/git_repo.py b/cookie_composer/templates/git_repo.py index 12ec6e6..ff6b255 100644 --- a/cookie_composer/templates/git_repo.py +++ b/cookie_composer/templates/git_repo.py @@ -1,7 +1,6 @@ """Utility functions for handling and fetching repo archives in git format.""" import logging -import shutil from pathlib import Path from typing import Optional @@ -10,6 +9,7 @@ from cookie_composer.git_commands import checkout_ref, clone, get_repo from cookie_composer.templates.types import Locality, TemplateFormat, TemplateRepo +from cookie_composer.utils import remove_single_path logger = logging.getLogger(__name__) @@ -80,6 +80,6 @@ def get_cached_remote(git_uri: str, cache_dir: Path, checkout: Optional[str] = N repo = clone(git_uri, repo_dir) if repo.head.is_detached and repo.head.object.hexsha != checkout: logger.info("The cached repo is not on the expected checkout, deleting and re-cloning.") - shutil.rmtree(repo_dir) + remove_single_path(repo_dir) repo = clone(git_uri, repo_dir) return repo diff --git a/cookie_composer/templates/types.py b/cookie_composer/templates/types.py index 3748319..ff51ace 100644 --- a/cookie_composer/templates/types.py +++ b/cookie_composer/templates/types.py @@ -5,7 +5,6 @@ """ import json -import shutil import tempfile from collections import OrderedDict from contextlib import contextmanager @@ -14,6 +13,8 @@ from pathlib import Path from typing import Iterator, Optional +from cookie_composer.utils import remove_single_path + class Locality(str, Enum): """The locality of a template.""" @@ -121,7 +122,7 @@ def render_source(self, output_dir: Optional[Path] = None, commit: Optional[str] zip_dir = extract_zipfile(self.cached_source, output_dir=output_dir, password=self.password) yield zip_dir - shutil.rmtree(zip_dir) + remove_single_path(zip_dir) elif self.format == TemplateFormat.PLAIN: from cookie_composer.utils import temporary_copy @@ -144,7 +145,7 @@ class Template: def cleanup(self) -> None: """Remove the cached template if it is a Zipfile.""" if self.repo.format == TemplateFormat.ZIP and self.repo.cached_source.exists(): - shutil.rmtree(self.repo.cached_source) + remove_single_path(self.repo.cached_source) @property def name(self) -> str: diff --git a/tests/conftest.py b/tests/conftest.py index 551fcb6..dd232a0 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -1,11 +1,16 @@ """Testing configuration.""" import shutil +import sys from pathlib import Path import pytest from git import Actor, Repo +from cookie_composer.utils import remove_single_path + +skip_if_windows = pytest.mark.skipif(sys.platform == "win32", reason="does not run on windows yet") + @pytest.fixture(autouse=True) def isolated_filesystem(monkeypatch, tmp_path): @@ -62,7 +67,7 @@ def default_origin(tmp_path: Path) -> Repo: tmp_repo.remotes.origin.push("remote-branch") tmp_repo.remotes.origin.push("v1.0.0") - shutil.rmtree(tmp_repo_path) + remove_single_path(tmp_repo_path) return origin diff --git a/tests/test_authentication.py b/tests/test_authentication.py index 2e15e7d..c07f58e 100644 --- a/tests/test_authentication.py +++ b/tests/test_authentication.py @@ -5,6 +5,7 @@ from typing import Optional from cookie_composer import authentication +from tests.conftest import skip_if_windows class MockPath: @@ -59,6 +60,7 @@ def create_mock_path(contents: str = "") -> MockPath: return MockPath(contents=contents) +@skip_if_windows def test_get_hosts_file(mocker): """Getting the host file should return the correct path.""" mocker.patch( @@ -71,6 +73,7 @@ def test_get_hosts_file(mocker): assert path.read_text() == "{}" +@skip_if_windows def test_login_to_svc_with_no_hosts_file(mocker): """Login to the service with no hosts file.""" mocked_path = create_mock_path("") @@ -94,6 +97,7 @@ def test_login_to_svc_with_no_hosts_file(mocker): } +@skip_if_windows def test_get_cached_token(mocker): """When the cached token exists, it gets returned.""" mocked_path = create_mock_path( @@ -104,6 +108,7 @@ def test_get_cached_token(mocker): assert authentication.get_cached_token("idon'texist") is None +@skip_if_windows def test_add_auth_to_url(mocker): """A host with a cached token returns a new URL.""" mocked_path = create_mock_path( diff --git a/tests/test_commands/test_update.py b/tests/test_commands/test_update.py index b3b5fb9..565f6fb 100644 --- a/tests/test_commands/test_update.py +++ b/tests/test_commands/test_update.py @@ -11,6 +11,7 @@ from cookie_composer.commands import update from cookie_composer.git_commands import checkout_branch, get_repo from cookie_composer.templates.types import TemplateFormat, Locality +from cookie_composer.utils import remove_single_path @pytest.fixture(scope="module") @@ -36,7 +37,7 @@ def git_template(fixtures_path: Path, tmp_path_factory) -> dict: origin = Repo.init(origin_path, bare=True) tmp_repo.create_remote("origin", str(origin_path)) tmp_repo.remotes.origin.push("master") - shutil.rmtree(tmp_repo_path) + remove_single_path(tmp_repo_path) template_updated_sha = origin.heads.master.commit.hexsha template_initial_sha = origin.heads.master.commit.parents[0].hexsha From 9ce345a0f30d24bc4eabe64a9972a18408997e44 Mon Sep 17 00:00:00 2001 From: Corey Oordt Date: Sun, 5 May 2024 08:36:53 -0500 Subject: [PATCH 11/13] Removing windows from test matrix for now !minor --- .github/workflows/test.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index e546ab0..31937d0 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -20,7 +20,7 @@ jobs: matrix: os: - ubuntu-latest - - windows-latest +# - windows-latest python-version: - "3.8" - "3.9" From 82528b95293bbe3cf63fc4dfd4f5b59b2f2a344d Mon Sep 17 00:00:00 2001 From: Corey Oordt Date: Sun, 5 May 2024 08:38:42 -0500 Subject: [PATCH 12/13] Fixed test PyPI upload !minor --- .github/workflows/test.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 31937d0..5667ce1 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -12,6 +12,9 @@ defaults: env: PYTHONUTF8: "1" +permissions: + id-token: write + jobs: test: From e7db476ce7ae898183d16563c9bf2333dab75c6e Mon Sep 17 00:00:00 2001 From: Corey Oordt Date: Sun, 5 May 2024 08:43:58 -0500 Subject: [PATCH 13/13] Fixed mkdocs error !minor --- cookie_composer/merge_files/__init__.py | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/cookie_composer/merge_files/__init__.py b/cookie_composer/merge_files/__init__.py index 5dccefc..5efc383 100644 --- a/cookie_composer/merge_files/__init__.py +++ b/cookie_composer/merge_files/__init__.py @@ -3,18 +3,9 @@ The merging functions should look similar to the following: - def merge_generic_files(origin: Path, destination: Path, merge_strategy: str): - ''' - Merge two ??? files into one. - -Raises: - MergeError: If something goes wrong - -Args: - origin: The path to the data file to merge - destination: The path to the data file to merge into and write out. - merge_strategy: How to do the merge - ''' +``` +def merge_generic_files(origin: Path, destination: Path, merge_strategy: str) -> None: +``` The function must write the file to destination.