From e1c7f3b407610e8a7b91a0efb2b813df804529ea Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Fri, 1 Nov 2024 02:25:01 +0000 Subject: [PATCH 1/7] chore(deps): renovate: actions/cache to 6849a64 --- .github/workflows/linting.yml | 4 ++-- .github/workflows/test.yml | 2 +- {{cookiecutter.project_slug}}/.github/workflows/docs.yml | 2 +- {{cookiecutter.project_slug}}/.github/workflows/linting.yml | 2 +- {{cookiecutter.project_slug}}/.github/workflows/tests.yml | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/linting.yml b/.github/workflows/linting.yml index 3f4839cb..ce32bd16 100644 --- a/.github/workflows/linting.yml +++ b/.github/workflows/linting.yml @@ -15,7 +15,7 @@ jobs: uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4 - name: Cache pre-commit - uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4 + uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4 with: path: ~/.cache/pre-commit key: pre-commit-${{ hashFiles('.pre-commit-config.yaml') }} @@ -38,7 +38,7 @@ jobs: uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4 - name: Cache pre-commit - uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4 + uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4 with: path: ~/.cache/pre-commit key: pre-commit-${{ hashFiles('.pre-commit-config.yaml') }} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 95f1ca22..b401fb91 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -27,7 +27,7 @@ jobs: uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4 - name: Cache tox - uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4 + uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4 with: path: .tox key: test-${{ hashFiles('pyproject.toml') }} diff --git a/{{cookiecutter.project_slug}}/.github/workflows/docs.yml b/{{cookiecutter.project_slug}}/.github/workflows/docs.yml index 5aadee67..d95e8988 100644 --- a/{{cookiecutter.project_slug}}/.github/workflows/docs.yml +++ b/{{cookiecutter.project_slug}}/.github/workflows/docs.yml @@ -14,7 +14,7 @@ jobs: uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4 - name: Cache tox - uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4 + uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4 with: path: .tox key: tox-${{ '{{' }} hashFiles('pyproject.toml') {{ '}}' }} diff --git a/{{cookiecutter.project_slug}}/.github/workflows/linting.yml b/{{cookiecutter.project_slug}}/.github/workflows/linting.yml index 88ae5976..7a56ef70 100644 --- a/{{cookiecutter.project_slug}}/.github/workflows/linting.yml +++ b/{{cookiecutter.project_slug}}/.github/workflows/linting.yml @@ -14,7 +14,7 @@ jobs: uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4 - name: Cache pre-commit - uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4 + uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4 with: path: ~/.cache/pre-commit key: pre-commit-${{ '{{' }} hashFiles('.pre-commit-config.yaml') {{ '}}' }} diff --git a/{{cookiecutter.project_slug}}/.github/workflows/tests.yml b/{{cookiecutter.project_slug}}/.github/workflows/tests.yml index ffe309eb..ff7846d5 100644 --- a/{{cookiecutter.project_slug}}/.github/workflows/tests.yml +++ b/{{cookiecutter.project_slug}}/.github/workflows/tests.yml @@ -26,7 +26,7 @@ jobs: uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4 - name: Cache tox - uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4 + uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4 with: path: .tox key: tox-${{ '{{' }}hashFiles('pyproject.toml') {{ '}}' }} From 3dd6ad5ed976e66c936dd880df5a3741be689db2 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Fri, 1 Nov 2024 03:12:18 +0000 Subject: [PATCH 2/7] chore(deps): renovate: actions/checkout to 11bd719 --- .github/workflows/links.yml | 2 +- .github/workflows/linting.yml | 4 ++-- .github/workflows/pages.yml | 2 +- .github/workflows/release.yaml | 2 +- .github/workflows/test.yml | 2 +- {{cookiecutter.project_slug}}/.github/workflows/docs.yml | 2 +- {{cookiecutter.project_slug}}/.github/workflows/linting.yml | 2 +- {{cookiecutter.project_slug}}/.github/workflows/tests.yml | 2 +- 8 files changed, 9 insertions(+), 9 deletions(-) diff --git a/.github/workflows/links.yml b/.github/workflows/links.yml index d9334c4a..e7d03d2c 100644 --- a/.github/workflows/links.yml +++ b/.github/workflows/links.yml @@ -15,7 +15,7 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4 + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 - name: Link Checker id: lychee diff --git a/.github/workflows/linting.yml b/.github/workflows/linting.yml index ce32bd16..46d3b354 100644 --- a/.github/workflows/linting.yml +++ b/.github/workflows/linting.yml @@ -12,7 +12,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout source - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4 + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 - name: Cache pre-commit uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4 @@ -35,7 +35,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout source - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4 + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 - name: Cache pre-commit uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4 diff --git a/.github/workflows/pages.yml b/.github/workflows/pages.yml index dbc015a0..a68e5c79 100644 --- a/.github/workflows/pages.yml +++ b/.github/workflows/pages.yml @@ -33,7 +33,7 @@ jobs: BUNDLE_GEMFILE: ${{ github.workspace }}/docs/Gemfile steps: - name: Checkout - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4 + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 - name: Setup Ruby uses: ruby/setup-ruby@v1 with: diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index af48d776..37ed7fbb 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -16,7 +16,7 @@ jobs: contents: write steps: - name: Checkout source - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4 + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 with: fetch-depth: 0 diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index b401fb91..61ff31fa 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -24,7 +24,7 @@ jobs: steps: - name: Checkout source - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4 + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 - name: Cache tox uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4 diff --git a/{{cookiecutter.project_slug}}/.github/workflows/docs.yml b/{{cookiecutter.project_slug}}/.github/workflows/docs.yml index d95e8988..57133ab3 100644 --- a/{{cookiecutter.project_slug}}/.github/workflows/docs.yml +++ b/{{cookiecutter.project_slug}}/.github/workflows/docs.yml @@ -11,7 +11,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout source - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4 + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 - name: Cache tox uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4 diff --git a/{{cookiecutter.project_slug}}/.github/workflows/linting.yml b/{{cookiecutter.project_slug}}/.github/workflows/linting.yml index 7a56ef70..5f974724 100644 --- a/{{cookiecutter.project_slug}}/.github/workflows/linting.yml +++ b/{{cookiecutter.project_slug}}/.github/workflows/linting.yml @@ -11,7 +11,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout source - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4 + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 - name: Cache pre-commit uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4 diff --git a/{{cookiecutter.project_slug}}/.github/workflows/tests.yml b/{{cookiecutter.project_slug}}/.github/workflows/tests.yml index ff7846d5..e5baee99 100644 --- a/{{cookiecutter.project_slug}}/.github/workflows/tests.yml +++ b/{{cookiecutter.project_slug}}/.github/workflows/tests.yml @@ -23,7 +23,7 @@ jobs: steps: - name: Checkout source - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4 + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 - name: Cache tox uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4 From d04449faa9b226f606c718ca38a92ef3ae7640fe Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Fri, 1 Nov 2024 06:59:36 +0000 Subject: [PATCH 3/7] chore(deps): renovate: actions/setup-python to 0b93645 --- .github/workflows/linting.yml | 4 ++-- .github/workflows/test.yml | 2 +- {{cookiecutter.project_slug}}/.github/workflows/docs.yml | 2 +- {{cookiecutter.project_slug}}/.github/workflows/linting.yml | 2 +- {{cookiecutter.project_slug}}/.github/workflows/tests.yml | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/linting.yml b/.github/workflows/linting.yml index 46d3b354..4facadb3 100644 --- a/.github/workflows/linting.yml +++ b/.github/workflows/linting.yml @@ -21,7 +21,7 @@ jobs: key: pre-commit-${{ hashFiles('.pre-commit-config.yaml') }} - name: Set up python - uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3 # v5 + uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5 with: python-version: "3.x" @@ -44,7 +44,7 @@ jobs: key: pre-commit-${{ hashFiles('.pre-commit-config.yaml') }} - name: Set up python - uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3 # v5 + uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5 with: python-version: "3.x" diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 61ff31fa..53a5c2ff 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -33,7 +33,7 @@ jobs: key: test-${{ hashFiles('pyproject.toml') }} - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3 # v5 + uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5 with: python-version: ${{ matrix.python-version }} cache: pip diff --git a/{{cookiecutter.project_slug}}/.github/workflows/docs.yml b/{{cookiecutter.project_slug}}/.github/workflows/docs.yml index 57133ab3..1c8c4374 100644 --- a/{{cookiecutter.project_slug}}/.github/workflows/docs.yml +++ b/{{cookiecutter.project_slug}}/.github/workflows/docs.yml @@ -20,7 +20,7 @@ jobs: key: tox-${{ '{{' }} hashFiles('pyproject.toml') {{ '}}' }} - name: Set up Python - uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3 # v5 + uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5 with: python-version: "3.x" cache: "pip" diff --git a/{{cookiecutter.project_slug}}/.github/workflows/linting.yml b/{{cookiecutter.project_slug}}/.github/workflows/linting.yml index 5f974724..44e6c644 100644 --- a/{{cookiecutter.project_slug}}/.github/workflows/linting.yml +++ b/{{cookiecutter.project_slug}}/.github/workflows/linting.yml @@ -20,7 +20,7 @@ jobs: key: pre-commit-${{ '{{' }} hashFiles('.pre-commit-config.yaml') {{ '}}' }} - name: Set up python - uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3 # v5 + uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5 with: python-version: "3.x" cache: pip diff --git a/{{cookiecutter.project_slug}}/.github/workflows/tests.yml b/{{cookiecutter.project_slug}}/.github/workflows/tests.yml index e5baee99..1ea17172 100644 --- a/{{cookiecutter.project_slug}}/.github/workflows/tests.yml +++ b/{{cookiecutter.project_slug}}/.github/workflows/tests.yml @@ -32,7 +32,7 @@ jobs: key: tox-${{ '{{' }}hashFiles('pyproject.toml') {{ '}}' }} - name: Set up python - uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3 # v5 + uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5 with: python-version: ${{ '{{' }} matrix.python-version {{ '}}' }} cache: pip From b6557e189f7db081867e269d4b04e035f9b7cf0d Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Fri, 1 Nov 2024 08:34:21 +0000 Subject: [PATCH 4/7] chore(deps): renovate: python-jsonschema/check-jsonschema to v0.29.4 --- {{cookiecutter.project_slug}}/.pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/{{cookiecutter.project_slug}}/.pre-commit-config.yaml b/{{cookiecutter.project_slug}}/.pre-commit-config.yaml index d0b9f320..94559a88 100644 --- a/{{cookiecutter.project_slug}}/.pre-commit-config.yaml +++ b/{{cookiecutter.project_slug}}/.pre-commit-config.yaml @@ -41,7 +41,7 @@ repos: - --fix=lf - id: trailing-whitespace - repo: https://github.com/python-jsonschema/check-jsonschema - rev: 0.29.3 + rev: 0.29.4 hooks: # Schemas taken from https://www.schemastore.org/json/ - id: check-jsonschema From 49b1469665bb75ca834138a881cb03b85f5c4b1b Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Fri, 1 Nov 2024 10:48:09 +0000 Subject: [PATCH 5/7] chore(deps): renovate: astral-sh/ruff-pre-commit to v0.7.1 --- {{cookiecutter.project_slug}}/.pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/{{cookiecutter.project_slug}}/.pre-commit-config.yaml b/{{cookiecutter.project_slug}}/.pre-commit-config.yaml index 94559a88..0905f4d0 100644 --- a/{{cookiecutter.project_slug}}/.pre-commit-config.yaml +++ b/{{cookiecutter.project_slug}}/.pre-commit-config.yaml @@ -1,6 +1,6 @@ repos: - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.6.8 + rev: v0.7.1 hooks: - id: ruff - id: ruff-format From ca0a8488ef93c2b7654e6558e3763e1d5672bdd9 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Fri, 1 Nov 2024 13:08:49 +0000 Subject: [PATCH 6/7] chore(deps): renovate: pre-commit/mirrors-mypy to v1.13.0 --- {{cookiecutter.project_slug}}/.pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/{{cookiecutter.project_slug}}/.pre-commit-config.yaml b/{{cookiecutter.project_slug}}/.pre-commit-config.yaml index 0905f4d0..78e7d133 100644 --- a/{{cookiecutter.project_slug}}/.pre-commit-config.yaml +++ b/{{cookiecutter.project_slug}}/.pre-commit-config.yaml @@ -19,7 +19,7 @@ repos: hooks: - id: toml-sort-fix - repo: https://github.com/pre-commit/mirrors-mypy - rev: v1.11.2 + rev: v1.13.0 hooks: - id: mypy - repo: https://github.com/pre-commit/mirrors-prettier From 30efb516ce779a28fc1348efa71b56fcfbedc12c Mon Sep 17 00:00:00 2001 From: David Stansby Date: Fri, 1 Nov 2024 13:44:24 +0000 Subject: [PATCH 7/7] Add regression test for generated package data (#432) Co-authored-by: Patrick J. Roddy --- .github/workflows/links.yml | 11 +- .pre-commit-config.yaml | 2 +- .../.github/ISSUE_TEMPLATE/bug_report.yml | 63 + .../.github/ISSUE_TEMPLATE/config.yml | 2 + .../.github/ISSUE_TEMPLATE/documentation.yml | 27 + .../ISSUE_TEMPLATE/feature_request.yml | 34 + .../.github/ISSUE_TEMPLATE/question.yml | 24 + .../.github/workflows/docs.yml | 46 + .../.github/workflows/linting.yml | 33 + .../.github/workflows/tests.yml | 42 + tests/data/test_package_generation/.gitignore | 163 ++ .../.markdownlint.yaml | 2 + .../.pre-commit-config.yaml | 51 + .../data/test_package_generation/CITATION.cff | 10 + tests/data/test_package_generation/LICENSE.md | 20 + tests/data/test_package_generation/README.md | 126 + .../test_package_generation/docs/LICENSE.md | 3 + .../data/test_package_generation/docs/api.md | 3 + .../test_package_generation/docs/index.md | 3 + tests/data/test_package_generation/mkdocs.yml | 63 + .../test_package_generation/pyproject.toml | 138 + .../schemas/github-issue-forms.json | 2377 +++++++++++++++++ .../src/cookiecutter_test/__init__.py | 18 + .../tests/test_dummy.py | 6 + tests/test_package_generation.py | 101 +- 25 files changed, 3322 insertions(+), 46 deletions(-) create mode 100644 tests/data/test_package_generation/.github/ISSUE_TEMPLATE/bug_report.yml create mode 100644 tests/data/test_package_generation/.github/ISSUE_TEMPLATE/config.yml create mode 100644 tests/data/test_package_generation/.github/ISSUE_TEMPLATE/documentation.yml create mode 100644 tests/data/test_package_generation/.github/ISSUE_TEMPLATE/feature_request.yml create mode 100644 tests/data/test_package_generation/.github/ISSUE_TEMPLATE/question.yml create mode 100644 tests/data/test_package_generation/.github/workflows/docs.yml create mode 100644 tests/data/test_package_generation/.github/workflows/linting.yml create mode 100644 tests/data/test_package_generation/.github/workflows/tests.yml create mode 100644 tests/data/test_package_generation/.gitignore create mode 100644 tests/data/test_package_generation/.markdownlint.yaml create mode 100644 tests/data/test_package_generation/.pre-commit-config.yaml create mode 100644 tests/data/test_package_generation/CITATION.cff create mode 100644 tests/data/test_package_generation/LICENSE.md create mode 100644 tests/data/test_package_generation/README.md create mode 100644 tests/data/test_package_generation/docs/LICENSE.md create mode 100644 tests/data/test_package_generation/docs/api.md create mode 100644 tests/data/test_package_generation/docs/index.md create mode 100644 tests/data/test_package_generation/mkdocs.yml create mode 100644 tests/data/test_package_generation/pyproject.toml create mode 100644 tests/data/test_package_generation/schemas/github-issue-forms.json create mode 100644 tests/data/test_package_generation/src/cookiecutter_test/__init__.py create mode 100644 tests/data/test_package_generation/tests/test_dummy.py diff --git a/.github/workflows/links.yml b/.github/workflows/links.yml index e7d03d2c..b1b3b468 100644 --- a/.github/workflows/links.yml +++ b/.github/workflows/links.yml @@ -29,9 +29,14 @@ jobs: # Ignore the whole of the project slug README since the links are # necessarily not real links - i.e. demos and to be filled by # cookiecutter values. - args: - "--verbose --exclude https://forum.image.sc/ --exclude http://www.gnu.org --exclude http://fsf.org --exclude docs/pages - --exclude-path '{{cookiecutter.project_slug}}/README.md' -- ." + args: "--verbose + --exclude https://forum.image.sc/ + --exclude http://www.gnu.org + --exclude http://fsf.org + --exclude docs/pages + --exclude-path '{{cookiecutter.project_slug}}/README.md' + --exclude-path 'tests/data' + -- ." fail: true jobSummary: true env: diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 8541cb80..ae600025 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,4 +1,4 @@ -exclude: ^{{cookiecutter.project_slug}}/ +exclude: ^{{cookiecutter.project_slug}}/|^tests/data/test_package_generation/ repos: - repo: https://github.com/astral-sh/ruff-pre-commit rev: v0.7.1 diff --git a/tests/data/test_package_generation/.github/ISSUE_TEMPLATE/bug_report.yml b/tests/data/test_package_generation/.github/ISSUE_TEMPLATE/bug_report.yml new file mode 100644 index 00000000..073866e0 --- /dev/null +++ b/tests/data/test_package_generation/.github/ISSUE_TEMPLATE/bug_report.yml @@ -0,0 +1,63 @@ +--- +name: Bug Report +description: Create a Report to Help us Improve +labels: + - bug +body: + - id: describe + type: textarea + attributes: + label: Describe the Bug + description: A clear and concise description of what the bug is. + validations: + required: true + - id: reproduce + type: textarea + attributes: + label: To Reproduce + description: >- + A minimal working example of code to reproduce the unexpected behaviour, + this will render as `Python` code so no need for backticks. + value: |- + import cookiecutter_test + + ... + render: Python + validations: + required: true + - id: expected + type: textarea + attributes: + label: Expected Behaviour + description: >- + A clear and concise description of what you expected to happen. + validations: + required: true + - id: actual + type: textarea + attributes: + label: Actual Behaviour + description: >- + Be a specific and detailed as you can. Paste any output or stack traces + of errors you receive. + validations: + required: true + - id: version + type: input + attributes: + label: Version In Use + description: |- + Can be found by + ```sh + python -c "import cookiecutter_test; print(cookiecutter_test.__version__)" + ``` + validations: + required: true + - id: additional + type: textarea + attributes: + label: Additional Context + value: |- + - Python version: + - Operating system: + render: Markdown diff --git a/tests/data/test_package_generation/.github/ISSUE_TEMPLATE/config.yml b/tests/data/test_package_generation/.github/ISSUE_TEMPLATE/config.yml new file mode 100644 index 00000000..bd9dfe4e --- /dev/null +++ b/tests/data/test_package_generation/.github/ISSUE_TEMPLATE/config.yml @@ -0,0 +1,2 @@ +--- +blank_issues_enabled: false diff --git a/tests/data/test_package_generation/.github/ISSUE_TEMPLATE/documentation.yml b/tests/data/test_package_generation/.github/ISSUE_TEMPLATE/documentation.yml new file mode 100644 index 00000000..582c191c --- /dev/null +++ b/tests/data/test_package_generation/.github/ISSUE_TEMPLATE/documentation.yml @@ -0,0 +1,27 @@ +--- +name: Documentation +description: How Can We Improve the Documentation +labels: + - documentation +body: + - id: section + type: textarea + attributes: + label: Which Section of the Documentation Needs Improving? + description: Please provide a link (if it is a specific page). + validations: + required: true + - id: problem + type: textarea + attributes: + label: What Can be Improved About This Section + description: Is it incomplete, incorrect or difficult to understand? + validations: + required: true + - id: suggestions + type: textarea + attributes: + label: How to Improve This Section + description: >- + Do you have any specific suggestions we could take to improve the + documentation? diff --git a/tests/data/test_package_generation/.github/ISSUE_TEMPLATE/feature_request.yml b/tests/data/test_package_generation/.github/ISSUE_TEMPLATE/feature_request.yml new file mode 100644 index 00000000..8e1ad7fe --- /dev/null +++ b/tests/data/test_package_generation/.github/ISSUE_TEMPLATE/feature_request.yml @@ -0,0 +1,34 @@ +--- +name: Feature Request +description: Suggest a Way to Improve This Project +labels: + - enhancement +body: + - id: problem + type: textarea + attributes: + label: Is Your Feature Request Related to a Problem? Please Describe + description: A clear and concise description of what the problem is. + placeholder: I'm always frustrated when [...] + validations: + required: true + - id: solution + type: textarea + attributes: + label: Describe the Solution You'd Like + description: A clear and concise description of what you want to happen. + validations: + required: true + - id: alternatives + type: textarea + attributes: + label: Describe Alternatives You've Considered + description: >- + A clear and concise description of any alternative solutions or features + you've considered. + - id: additional + type: textarea + attributes: + label: Additional Context + description: >- + Add any other context or screenshots about the feature request here. diff --git a/tests/data/test_package_generation/.github/ISSUE_TEMPLATE/question.yml b/tests/data/test_package_generation/.github/ISSUE_TEMPLATE/question.yml new file mode 100644 index 00000000..a2bef2ea --- /dev/null +++ b/tests/data/test_package_generation/.github/ISSUE_TEMPLATE/question.yml @@ -0,0 +1,24 @@ +--- +name: Question +description: General Questions About Using Cookiecutter Test +labels: + - question +body: + - id: topic + type: dropdown + attributes: + label: What is the Topic of Your Question + description: Please indicate the topic in the title of your question. + options: + - Documentation + - Installation + - Usage + - Other + validations: + required: true + - id: question + type: textarea + attributes: + label: Add Your Question Below + validations: + required: true diff --git a/tests/data/test_package_generation/.github/workflows/docs.yml b/tests/data/test_package_generation/.github/workflows/docs.yml new file mode 100644 index 00000000..40c7cf05 --- /dev/null +++ b/tests/data/test_package_generation/.github/workflows/docs.yml @@ -0,0 +1,46 @@ +name: Documentation + +on: + push: + branches: + - main + pull_request: + +jobs: + docs: + runs-on: ubuntu-latest + steps: + - name: Checkout source + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 + + - name: Cache tox + uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4 + with: + path: .tox + key: tox-${{ hashFiles('pyproject.toml') }} + + - name: Set up Python + uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5 + with: + python-version: "3.x" + cache: "pip" + cache-dependency-path: "pyproject.toml" + + - name: Install tox + run: python -m pip install tox + - name: Build HTML documentation with tox + run: tox -e docs + + # Automatically deploy documentation to a GitHub Pages website on pushing to main. + # Requires configuring the repository to deploy GitHub pages from a branch + # gh-pages (https://tinyurl.com/gh-pages-from-branch), which will be created the + # first time this workflow step is run. + - name: Publish documentation on GitHub pages + if: success() && github.event_name != 'pull_request' + uses: peaceiris/actions-gh-pages@4f9cc6602d3f66b9c108549d475ec49e8ef4d45e # v4 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_dir: site + publish_branch: gh-pages + user_name: "github-actions[bot]" + user_email: "github-actions[bot]@users.noreply.github.com" diff --git a/tests/data/test_package_generation/.github/workflows/linting.yml b/tests/data/test_package_generation/.github/workflows/linting.yml new file mode 100644 index 00000000..63688bff --- /dev/null +++ b/tests/data/test_package_generation/.github/workflows/linting.yml @@ -0,0 +1,33 @@ +name: Linting + +on: + push: + branches: + - main + pull_request: + +jobs: + linting: + runs-on: ubuntu-latest + steps: + - name: Checkout source + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 + + - name: Cache pre-commit + uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4 + with: + path: ~/.cache/pre-commit + key: pre-commit-${{ hashFiles('.pre-commit-config.yaml') }} + + - name: Set up python + uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5 + with: + python-version: "3.x" + cache: pip + cache-dependency-path: pyproject.toml + + - name: Install dependencies + run: python -m pip install pre-commit + + - name: Run pre-commit + run: pre-commit run --all-files --color always --verbose diff --git a/tests/data/test_package_generation/.github/workflows/tests.yml b/tests/data/test_package_generation/.github/workflows/tests.yml new file mode 100644 index 00000000..1e5ecd3a --- /dev/null +++ b/tests/data/test_package_generation/.github/workflows/tests.yml @@ -0,0 +1,42 @@ +name: Tests + +on: + push: + branches: + - main + pull_request: + paths-ignore: + - "**.md" + +jobs: + tests: + runs-on: ubuntu-latest + strategy: + matrix: + python-version: + - "3.11" + - "3.12" + - "3.13" + + steps: + - name: Checkout source + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 + + - name: Cache tox + uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4 + with: + path: .tox + key: tox-${{hashFiles('pyproject.toml') }} + + - name: Set up python + uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5 + with: + python-version: ${{ matrix.python-version }} + cache: pip + cache-dependency-path: pyproject.toml + + - name: Install dependencies + run: python -m pip install tox tox-gh + + - name: Test with tox + run: tox run diff --git a/tests/data/test_package_generation/.gitignore b/tests/data/test_package_generation/.gitignore new file mode 100644 index 00000000..6a566013 --- /dev/null +++ b/tests/data/test_package_generation/.gitignore @@ -0,0 +1,163 @@ +# Byte-compiled / optimized / DLL files +__pycache__/ +*.py[cod] +*$py.class + +# C extensions +*.so + +# Distribution / packaging +.Python +build/ +develop-eggs/ +dist/ +downloads/ +eggs/ +.eggs/ +lib/ +lib64/ +parts/ +sdist/ +var/ +wheels/ +share/python-wheels/ +*.egg-info/ +.installed.cfg +*.egg +MANIFEST + +# PyInstaller +# Usually these files are written by a python script from a template +# before PyInstaller builds the exe, so as to inject date/other infos into it. +*.manifest +*.spec + +# Installer logs +pip-log.txt +pip-delete-this-directory.txt + +# Unit test / coverage reports +htmlcov/ +.tox/ +.nox/ +.coverage +.coverage.* +.cache +nosetests.xml +coverage.xml +*.cover +*.py,cover +.hypothesis/ +.pytest_cache/ +cover/ + +# Translations +*.mo +*.pot + +# Django stuff: +*.log +local_settings.py +db.sqlite3 +db.sqlite3-journal + +# Flask stuff: +instance/ +.webassets-cache + +# Scrapy stuff: +.scrapy + +# Sphinx documentation +docs/_build/ + +# PyBuilder +.pybuilder/ +target/ + +# Jupyter Notebook +.ipynb_checkpoints + +# IPython +profile_default/ +ipython_config.py + +# pyenv +# For a library or package, you might want to ignore these files since the code is +# intended to run in multiple environments; otherwise, check them in: +# .python-version + +# pipenv +# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. +# However, in case of collaboration, if having platform-specific dependencies or dependencies +# having no cross-platform support, pipenv may install dependencies that don't work, or not +# install all needed dependencies. +#Pipfile.lock + +# poetry +# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control. +# This is especially recommended for binary packages to ensure reproducibility, and is more +# commonly ignored for libraries. +# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control +#poetry.lock + +# pdm +# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control. +#pdm.lock +# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it +# in version control. +# https://pdm.fming.dev/#use-with-ide +.pdm.toml + +# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm +__pypackages__/ + +# Celery stuff +celerybeat-schedule +celerybeat.pid + +# SageMath parsed files +*.sage.py + +# Environments +.env +.venv +env/ +venv/ +ENV/ +env.bak/ +venv.bak/ + +# Spyder project settings +.spyderproject +.spyproject + +# Rope project settings +.ropeproject + +# mkdocs documentation +/site + +# mypy +.mypy_cache/ +.dmypy.json +dmypy.json + +# Pyre type checker +.pyre/ + +# pytype static type analyzer +.pytype/ + +# Cython debug symbols +cython_debug/ + +# PyCharm +# JetBrains specific template is maintained in a separate JetBrains.gitignore that can +# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore +# and can be added to the global gitignore or merged into this file. For a more nuclear +# option (not recommended) you can uncomment the following to ignore the entire idea folder. +#.idea/ + +# package version +_version.py diff --git a/tests/data/test_package_generation/.markdownlint.yaml b/tests/data/test_package_generation/.markdownlint.yaml new file mode 100644 index 00000000..02907b2b --- /dev/null +++ b/tests/data/test_package_generation/.markdownlint.yaml @@ -0,0 +1,2 @@ +--- +MD013: false diff --git a/tests/data/test_package_generation/.pre-commit-config.yaml b/tests/data/test_package_generation/.pre-commit-config.yaml new file mode 100644 index 00000000..78e7d133 --- /dev/null +++ b/tests/data/test_package_generation/.pre-commit-config.yaml @@ -0,0 +1,51 @@ +repos: + - repo: https://github.com/astral-sh/ruff-pre-commit + rev: v0.7.1 + hooks: + - id: ruff + - id: ruff-format + - repo: https://github.com/igorshubovych/markdownlint-cli + rev: v0.42.0 + hooks: + - id: markdownlint-fix + args: + - --dot + - repo: https://github.com/Lucas-C/pre-commit-hooks + rev: v1.5.5 + hooks: + - id: forbid-tabs + - repo: https://github.com/pappasam/toml-sort + rev: v0.23.1 + hooks: + - id: toml-sort-fix + - repo: https://github.com/pre-commit/mirrors-mypy + rev: v1.13.0 + hooks: + - id: mypy + - repo: https://github.com/pre-commit/mirrors-prettier + rev: v3.1.0 + hooks: + - id: prettier + args: + - --quote-props=as-needed + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v4.6.0 + hooks: + - id: check-case-conflict + - id: check-docstring-first + - id: check-merge-conflict + - id: check-toml + - id: end-of-file-fixer + - id: mixed-line-ending + args: + - --fix=lf + - id: trailing-whitespace + - repo: https://github.com/python-jsonschema/check-jsonschema + rev: 0.29.4 + hooks: + # Schemas taken from https://www.schemastore.org/json/ + - id: check-jsonschema + name: "Validate GitHub issue templates" + files: ^\.github/ISSUE_TEMPLATE/.*\.yml$ + exclude: ^\.github/ISSUE_TEMPLATE/config\.yml$ + args: ["--verbose", "--schemafile", "schemas/github-issue-forms.json"] diff --git a/tests/data/test_package_generation/CITATION.cff b/tests/data/test_package_generation/CITATION.cff new file mode 100644 index 00000000..1cae98c2 --- /dev/null +++ b/tests/data/test_package_generation/CITATION.cff @@ -0,0 +1,10 @@ +cff-version: 1.2.0 +message: "If you use this software, please cite it as below." +type: software +authors: + - family-names: "Ator" + given-names: "Eva Lu" + email: "eva.lu.ator@ucl.ac.uk" +repository-code: "https://github.com/test-user/cookiecutter-test" +title: "Cookiecutter Test: description" +license: "MIT" diff --git a/tests/data/test_package_generation/LICENSE.md b/tests/data/test_package_generation/LICENSE.md new file mode 100644 index 00000000..8bb20613 --- /dev/null +++ b/tests/data/test_package_generation/LICENSE.md @@ -0,0 +1,20 @@ +# MIT License + +Copyright (c) 2024 Eva Lu Ator + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/tests/data/test_package_generation/README.md b/tests/data/test_package_generation/README.md new file mode 100644 index 00000000..61661359 --- /dev/null +++ b/tests/data/test_package_generation/README.md @@ -0,0 +1,126 @@ +# Cookiecutter Test + +[![pre-commit](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit&logoColor=white)](https://github.com/pre-commit/pre-commit) +[![Tests status][tests-badge]][tests-link] +[![Linting status][linting-badge]][linting-link] +[![Documentation status][documentation-badge]][documentation-link] +[![License][license-badge]](./LICENSE.md) + + +[tests-badge]: https://github.com/test-user/cookiecutter-test/actions/workflows/tests.yml/badge.svg +[tests-link]: https://github.com/test-user/cookiecutter-test/actions/workflows/tests.yml +[linting-badge]: https://github.com/test-user/cookiecutter-test/actions/workflows/linting.yml/badge.svg +[linting-link]: https://github.com/test-user/cookiecutter-test/actions/workflows/linting.yml +[documentation-badge]: https://github.com/test-user/cookiecutter-test/actions/workflows/docs.yml/badge.svg +[documentation-link]: https://github.com/test-user/cookiecutter-test/actions/workflows/docs.yml +[license-badge]: https://img.shields.io/badge/License-MIT-yellow.svg + + +description + +This project is developed in collaboration with the +[Centre for Advanced Research Computing](https://ucl.ac.uk/arc), University +College London. + +## About + +### Project Team + +Eva Lu Ator ([eva.lu.ator@ucl.ac.uk](mailto:eva.lu.ator@ucl.ac.uk)) + + + +### Research Software Engineering Contact + +Centre for Advanced Research Computing, University College London +([arc.collaborations@ucl.ac.uk](mailto:arc.collaborations@ucl.ac.uk)) + +## Built With + + + +- [Framework 1](https://something.com) +- [Framework 2](https://something.com) +- [Framework 3](https://something.com) + +## Getting Started + +### Prerequisites + + + +`cookiecutter-test` requires Python 3.11–3.13. + +### Installation + + + +We recommend installing in a project specific virtual environment created using +a environment management tool such as +[Conda](https://docs.conda.io/projects/conda/en/stable/). To install the latest +development version of `cookiecutter-test` using `pip` in the currently active +environment run + +```sh +pip install git+https://github.com/test-user/cookiecutter-test.git +``` + +Alternatively create a local clone of the repository with + +```sh +git clone https://github.com/test-user/cookiecutter-test.git +``` + +and then install in editable mode by running + +```sh +pip install -e . +``` + +### Running Locally + +How to run the application on your local system. + +### Running Tests + + + +Tests can be run across all compatible Python versions in isolated environments +using [`tox`](https://tox.wiki/en/latest/) by running + +```sh +tox +``` + +To run tests manually in a Python environment with `pytest` installed run + +```sh +pytest tests +``` + +again from the root of the repository. + +### Building Documentation + +The MkDocs HTML documentation can be built locally by running + +```sh +tox -e docs +``` + +from the root of the repository. The built documentation will be written to +`site`. + +Alternatively to build and preview the documentation locally, in a Python +environment with the optional `docs` dependencies installed, run + +```sh +mkdocs serve +``` + +## Roadmap + +- [x] Initial Research +- [ ] Minimum viable product <-- You are Here +- [ ] Alpha Release +- [ ] Feature-Complete Release diff --git a/tests/data/test_package_generation/docs/LICENSE.md b/tests/data/test_package_generation/docs/LICENSE.md new file mode 100644 index 00000000..75b899af --- /dev/null +++ b/tests/data/test_package_generation/docs/LICENSE.md @@ -0,0 +1,3 @@ + + +{! include-markdown "../LICENSE.md" !} diff --git a/tests/data/test_package_generation/docs/api.md b/tests/data/test_package_generation/docs/api.md new file mode 100644 index 00000000..e39bfc57 --- /dev/null +++ b/tests/data/test_package_generation/docs/api.md @@ -0,0 +1,3 @@ +# API reference + +::: cookiecutter_test diff --git a/tests/data/test_package_generation/docs/index.md b/tests/data/test_package_generation/docs/index.md new file mode 100644 index 00000000..e8a17ad1 --- /dev/null +++ b/tests/data/test_package_generation/docs/index.md @@ -0,0 +1,3 @@ + + +{! include-markdown "../README.md" rewrite-relative-urls=false !} diff --git a/tests/data/test_package_generation/mkdocs.yml b/tests/data/test_package_generation/mkdocs.yml new file mode 100644 index 00000000..5cfb7cd0 --- /dev/null +++ b/tests/data/test_package_generation/mkdocs.yml @@ -0,0 +1,63 @@ +site_name: "Cookiecutter Test" +site_description: "Documentation website for Cookiecutter Test" +site_author: "Eva Lu Ator" +copyright: "Copyright © 2024 Eva Lu Ator" +repo_url: "https://github.com/test-user/cookiecutter-test/" +repo_name: "test-user/cookiecutter-test" +edit_uri: edit/main/docs/ + +validation: + omitted_files: warn + absolute_links: warn + unrecognized_links: warn + +theme: + name: "material" + features: + - content.action.edit + palette: + - media: "(prefers-color-scheme)" + toggle: + icon: material/brightness-auto + name: Switch to light mode + - media: "(prefers-color-scheme: light)" + scheme: default + toggle: + icon: material/brightness-7 + name: Switch to dark mode + - media: "(prefers-color-scheme: dark)" + scheme: slate + toggle: + icon: material/brightness-4 + name: Switch to system preference + icon: + repo: fontawesome/brands/github + +nav: + - Overview: index.md + - API reference: api.md + - License: LICENSE.md + +markdown_extensions: + - pymdownx.tasklist + +plugins: + - search + - mkdocstrings: + default_handler: python + handlers: + python: + docstring_style: google + import: + - "https://docs.python.org/3/objects.inv" + options: + show_submodules: true + paths: [src] + - include-markdown: + opening_tag: "{!" + closing_tag: "!}" + +extra: + social: + - icon: fontawesome/brands/github + link: "https://github.com/test-user" diff --git a/tests/data/test_package_generation/pyproject.toml b/tests/data/test_package_generation/pyproject.toml new file mode 100644 index 00000000..897c2fb9 --- /dev/null +++ b/tests/data/test_package_generation/pyproject.toml @@ -0,0 +1,138 @@ +[build-system] +build-backend = "setuptools.build_meta" +requires = [ + "setuptools", + "setuptools-scm", +] + +[project] +authors = [ + {email = "eva.lu.ator@ucl.ac.uk", name = "Eva Lu Ator"}, +] +classifiers = [ + "Operating System :: POSIX", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3 :: Only", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", + "Programming Language :: Python :: 3.13", + "Typing :: Typed", +] +dependencies = [ +] +description = "description" +dynamic = [ + "version", +] +keywords = [ +] +name = "cookiecutter-test" +optional-dependencies = {dev = [ + "build", + "mypy", + "pre-commit", + "ruff", + "tox", + "twine", +], docs = [ + "mkdocs", + "mkdocs-include-markdown-plugin", + "mkdocs-material", + "mkdocstrings", + "mkdocstrings-python", +], test = [ + "pytest", + "pytest-cov", +]} +readme = "README.md" +requires-python = ">=3.11" +license.file = "LICENSE.md" +urls.homepage = "https://github.com/test-user/cookiecutter-test" + +[tool.coverage] +report = {sort = "cover"} +run = {branch = true, parallel = true, source = [ + "cookiecutter-test", +]} +paths.source = [ + "src", + ".tox*/*/lib/python*/site-packages", +] + +[tool.mypy] +explicit_package_bases = true + +[tool.pytest.ini_options] +addopts = [ + "--color=yes", + "--import-mode=importlib", + "--verbose", +] +testpaths = [ + "tests", +] + +[tool.ruff] +fix = true +force-exclude = true +lint.ignore = [ + "COM812", # trailing commas (ruff-format recommended) + "D203", # no-blank-line-before-class + "D212", # multi-line-summary-first-line + "D407", # removed dashes lines under sections + "D417", # argument description in docstring (unreliable) + "ISC001", # simplify implicit str concatenation (ruff-format recommended) +] +lint.per-file-ignores = {"tests*" = [ + "INP001", # File is part of an implicit namespace package. + "S101", # Use of `assert` detected +]} +lint.select = [ + "ALL", +] +lint.isort.known-first-party = [ + "cookiecutter_test", +] +lint.mccabe.max-complexity = 18 +lint.pep8-naming.classmethod-decorators = [ + "classmethod", +] + +[tool.setuptools_scm] +local_scheme = "no-local-version" +write_to = "src/cookiecutter_test/_version.py" + +[tool.tomlsort] +all = true +spaces_indent_inline_array = 4 +trailing_comma_inline_array = true +overrides."project.classifiers".inline_arrays = false +overrides."tool.coverage.paths.source".inline_arrays = false +overrides."tool.tox.env.docs.commands".inline_arrays = false +overrides."tool.tox.env_run_base.commands".inline_arrays = false + +[tool.tox] +env_list = [ + "py311", + "py312", + "py313", +] +env_run_base = {commands = [ + [ + "pytest", + "--cov", + "--cov-report=xml", + ], +], extras = [ + "test", +]} +env.docs = {commands = [ + "mkdocs", + "build", + "--strict", +], extras = [ + "docs", +]} +gh.python."3.11" = ["py311"] +gh.python."3.12" = ["py312"] +gh.python."3.13" = ["py313"] diff --git a/tests/data/test_package_generation/schemas/github-issue-forms.json b/tests/data/test_package_generation/schemas/github-issue-forms.json new file mode 100644 index 00000000..b890ff13 --- /dev/null +++ b/tests/data/test_package_generation/schemas/github-issue-forms.json @@ -0,0 +1,2377 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + + "$id": "https://json.schemastore.org/github-issue-forms.json", + + "$comment": "https://docs.github.com/en/communities/using-templates-to-encourage-useful-issues-and-pull-requests/syntax-for-issue-forms", + + "additionalProperties": false, + + "definitions": { + "type": { + "description": "A form item type\nhttps://docs.github.com/en/communities/using-templates-to-encourage-useful-issues-and-pull-requests/syntax-for-githubs-form-schema#keys", + + "type": "string", + + "enum": ["checkboxes", "dropdown", "input", "markdown", "textarea"] + }, + + "id": { + "type": "string", + + "pattern": "^[a-zA-Z0-9_-]+$", + + "examples": ["SampleId"] + }, + + "validations": { + "title": "validation options", + + "type": "object", + + "properties": { + "required": { + "description": "Specify whether require a form item", + + "type": "boolean", + + "default": false + } + }, + + "additionalProperties": false + }, + + "assignee": { + "type": "string", + + "maxLength": 39, + + "pattern": "^[a-zA-Z0-9](-?[a-zA-Z0-9])*$", + + "examples": ["SampleAssignee"] + }, + + "label": { + "type": "string", + + "minLength": 1, + + "examples": ["Sample label"] + }, + + "description": { + "type": "string", + + "default": "", + + "examples": ["Sample description"] + }, + + "placeholder": { + "type": "string", + + "default": "", + + "examples": ["Sample placeholder"] + }, + + "value": { + "type": "string", + + "minLength": 1, + + "examples": ["Sample value"] + }, + + "form_item": { + "title": "form item", + + "description": "A form item\nhttps://docs.github.com/en/communities/using-templates-to-encourage-useful-issues-and-pull-requests/syntax-for-githubs-form-schema#about-githubs-form-schema", + + "type": "object", + + "required": ["type"], + + "properties": { + "type": { + "$ref": "#/definitions/type" + } + }, + + "allOf": [ + { + "if": { + "properties": { + "type": { + "const": "markdown" + } + } + }, + + "then": { + "$comment": "For `additionalProperties` to work `type` must also be present here.", + + "title": "markdown", + + "description": "Markdown\nhttps://docs.github.com/en/communities/using-templates-to-encourage-useful-issues-and-pull-requests/syntax-for-githubs-form-schema#markdown", + + "type": "object", + + "required": ["type", "attributes"], + + "properties": { + "type": { + "$ref": "#/definitions/type" + }, + + "attributes": { + "title": "markdown attributes", + + "description": "Markdown attributes\nhttps://docs.github.com/en/communities/using-templates-to-encourage-useful-issues-and-pull-requests/syntax-for-githubs-form-schema#attributes", + + "type": "object", + + "required": ["value"], + + "properties": { + "value": { + "description": "A markdown code\nhttps://docs.github.com/en/communities/using-templates-to-encourage-useful-issues-and-pull-requests/syntax-for-githubs-form-schema#attributes", + + "type": "string", + + "minLength": 1, + + "examples": ["Sample code"] + } + }, + + "additionalProperties": false + } + }, + + "additionalProperties": false + } + }, + + { + "if": { + "properties": { + "type": { + "const": "textarea" + } + } + }, + + "then": { + "$comment": "For `additionalProperties` to work `type` must also be present here.", + + "title": "textarea", + + "description": "Textarea\nhttps://docs.github.com/en/communities/using-templates-to-encourage-useful-issues-and-pull-requests/syntax-for-githubs-form-schema#textarea", + + "type": "object", + + "required": ["type", "attributes"], + + "properties": { + "type": { + "$ref": "#/definitions/type" + }, + + "id": { + "$ref": "#/definitions/id", + + "description": "A textarea id\nhttps://docs.github.com/en/communities/using-templates-to-encourage-useful-issues-and-pull-requests/syntax-for-githubs-form-schema#keys" + }, + + "attributes": { + "title": "textarea attributes", + + "description": "Textarea attributes\nhttps://docs.github.com/en/communities/using-templates-to-encourage-useful-issues-and-pull-requests/syntax-for-githubs-form-schema#attributes-1", + + "type": "object", + + "required": ["label"], + + "properties": { + "label": { + "$ref": "#/definitions/label", + + "description": "A short textarea description\nhttps://docs.github.com/en/communities/using-templates-to-encourage-useful-issues-and-pull-requests/syntax-for-githubs-form-schema#attributes-1" + }, + + "description": { + "$ref": "#/definitions/description", + + "description": "A long textarea description\nhttps://docs.github.com/en/communities/using-templates-to-encourage-useful-issues-and-pull-requests/syntax-for-githubs-form-schema#attributes-1" + }, + + "placeholder": { + "$ref": "#/definitions/placeholder", + + "description": "A textarea placeholder\nhttps://docs.github.com/en/communities/using-templates-to-encourage-useful-issues-and-pull-requests/syntax-for-githubs-form-schema#attributes-1" + }, + + "value": { + "$ref": "#/definitions/value", + + "description": "A textarea value\nhttps://docs.github.com/en/communities/using-templates-to-encourage-useful-issues-and-pull-requests/syntax-for-githubs-form-schema#attributes-1" + }, + + "render": { + "description": "A textarea syntax highlighting mode\nhttps://docs.github.com/en/communities/using-templates-to-encourage-useful-issues-and-pull-requests/syntax-for-githubs-form-schema#attributes-1", + + "type": "string", + + "enum": [ + "1C Enterprise", + + "4D", + + "ABAP CDS", + + "ABAP", + + "ABNF", + + "AFDKO", + + "AGS Script", + + "AIDL", + + "AL", + + "AMPL", + + "ANTLR", + + "API Blueprint", + + "APL", + + "ASL", + + "ASN.1", + + "ASP.NET", + + "ATS", + + "ActionScript", + + "Ada", + + "Alloy", + + "Alpine Abuild", + + "Altium Designer", + + "AngelScript", + + "Ant Build System", + + "ApacheConf", + + "Apex", + + "Apollo Guidance Computer", + + "AppleScript", + + "Arc", + + "AsciiDoc", + + "AspectJ", + + "Assembly", + + "Astro", + + "Asymptote", + + "Augeas", + + "AutoHotkey", + + "AutoIt", + + "AutoIt3", + + "AutoItScript", + + "Avro IDL", + + "Awk", + + "BASIC", + + "Ballerina", + + "Batchfile", + + "Beef", + + "Befunge", + + "BibTeX", + + "Bicep", + + "Bison", + + "BitBake", + + "Blade", + + "BlitzBasic", + + "BlitzMax", + + "Boo", + + "Boogie", + + "Brainfuck", + + "Brightscript", + + "Browserslist", + + "C", + + "C#", + + "C++", + + "C-ObjDump", + + "C2hs Haskell", + + "CIL", + + "CLIPS", + + "CMake", + + "COBOL", + + "CODEOWNERS", + + "COLLADA", + + "CSON", + + "CSS", + + "CSV", + + "CUE", + + "CWeb", + + "Cabal Config", + + "Cabal", + + "Cap'n Proto", + + "Carto", + + "CartoCSS", + + "Ceylon", + + "Chapel", + + "Charity", + + "ChucK", + + "Cirru", + + "Clarion", + + "Classic ASP", + + "Clean", + + "Click", + + "Clojure", + + "Closure Templates", + + "Cloud Firestore Security Rules", + + "CoNLL", + + "CoNLL-U", + + "CoNLL-X", + + "ColdFusion CFC", + + "ColdFusion", + + "Common Lisp", + + "Common Workflow Language", + + "Component Pascal", + + "Containerfile", + + "Cool", + + "Coq", + + "Cpp-ObjDump", + + "Crystal", + + "Csound Document", + + "Csound Score", + + "Csound", + + "Cuda", + + "Cue Sheet", + + "Cycript", + + "Cython", + + "D-ObjDump", + + "DIGITAL Command Language", + + "DM", + + "DTrace", + + "Dafny", + + "Darcs Patch", + + "Dart", + + "DataWeave", + + "Dhall", + + "Diff", + + "Dlang", + + "Dockerfile", + + "Dogescript", + + "Dylan", + + "E", + + "E-mail", + + "EBNF", + + "ECL", + + "ECLiPSe", + + "EJS", + + "EQ", + + "Eagle", + + "Earthly", + + "Easybuild", + + "Ecere Projects", + + "EditorConfig", + + "Eiffel", + + "Elixir", + + "Elm", + + "Emacs Lisp", + + "EmberScript", + + "Erlang", + + "F#", + + "F*", + + "FIGfont", + + "FIGlet Font", + + "FLUX", + + "Factor", + + "Fancy", + + "Fantom", + + "Faust", + + "Fennel", + + "Filebench WML", + + "Filterscript", + + "Fluent", + + "Formatted", + + "Forth", + + "Fortran Free Form", + + "Fortran", + + "FreeBasic", + + "Frege", + + "Futhark", + + "G-code", + + "GAML", + + "GAMS", + + "GAP", + + "GCC Machine Description", + + "GDB", + + "GDScript", + + "GEDCOM", + + "GLSL", + + "GN", + + "Game Maker Language", + + "Gemfile.lock", + + "Genie", + + "Genshi", + + "Gentoo Eclass", + + "Gerber Image", + + "Gettext Catalog", + + "Gherkin", + + "Git Config", + + "Glyph Bitmap Distribution Format", + + "Glyph", + + "Gnuplot", + + "Go Checksums", + + "Go Module", + + "Go", + + "Golo", + + "Gosu", + + "Grace", + + "Gradle", + + "Grammatical Framework", + + "Graph Modeling Language", + + "GraphQL", + + "Graphviz (DOT)", + + "Groovy Server Pages", + + "Groovy", + + "HAProxy", + + "HCL", + + "HTML", + + "HTML+ECR", + + "HTML+EEX", + + "HTML+ERB", + + "HTML+PHP", + + "HTML+Razor", + + "HTTP", + + "HXML", + + "Hack", + + "Haml", + + "Handlebars", + + "Harbour", + + "HashiCorp Configuration Language", + + "Haskell", + + "Haxe", + + "HiveQL", + + "HolyC", + + "Hy", + + "IDL", + + "IGOR Pro", + + "IPython Notebook", + + "Idris", + + "Ignore List", + + "ImageJ Macro", + + "Inform 7", + + "Io", + + "Ioke", + + "Isabelle ROOT", + + "Isabelle", + + "J", + + "JAR Manifest", + + "JFlex", + + "JSON with Comments", + + "JSON", + + "JSON5", + + "JSONLD", + + "JSONiq", + + "Jasmin", + + "Java Properties", + + "Java Server Pages", + + "Java", + + "JavaScript", + + "JavaScript+ERB", + + "Jest Snapshot", + + "Jinja", + + "Jison Lex", + + "Jison", + + "Jolie", + + "Jsonnet", + + "Julia", + + "Jupyter Notebook", + + "Kaitai Struct", + + "KakouneScript", + + "KiCad Layout", + + "KiCad Legacy Layout", + + "KiCad Schematic", + + "Kit", + + "Kotlin", + + "Kusto", + + "LFE", + + "LLVM", + + "LOLCODE", + + "LSL", + + "LTspice Symbol", + + "LabVIEW", + + "Lark", + + "Lasso", + + "Lean", + + "Less", + + "Lex", + + "LilyPond", + + "Limbo", + + "Linker Script", + + "Linux Kernel Module", + + "Liquid", + + "Literate Agda", + + "Literate CoffeeScript", + + "Literate Haskell", + + "LiveScript", + + "Logos", + + "Logtalk", + + "LookML", + + "LoomScript", + + "Lua", + + "M", + + "M4", + + "M4Sugar", + + "MATLAB", + + "MAXScript", + + "MLIR", + + "MQL4", + + "MQL5", + + "MTML", + + "MUF", + + "Macaulay2", + + "Makefile", + + "Mako", + + "Markdown", + + "Marko", + + "Mathematica", + + "Max", + + "Mercury", + + "Meson", + + "Metal", + + "Microsoft Developer Studio Project", + + "Microsoft Visual Studio Solution", + + "MiniD", + + "Mirah", + + "Modelica", + + "Modula-2", + + "Modula-3", + + "Module Management System", + + "Monkey", + + "Moocode", + + "MoonScript", + + "Motoko", + + "Motorola 68K Assembly", + + "Muse", + + "Myghty", + + "NASL", + + "NCL", + + "NEON", + + "NPM Config", + + "NSIS", + + "NWScript", + + "Nearley", + + "Nemerle", + + "NeoSnippet", + + "NetLinx", + + "NetLinx+ERB", + + "NetLogo", + + "NewLisp", + + "Nextflow", + + "Nginx", + + "Ninja", + + "Nit", + + "Nix", + + "NumPy", + + "Nunjucks", + + "ObjDump", + + "Object Data Instance Notation", + + "ObjectScript", + + "Objective-C", + + "Objective-C++", + + "Objective-J", + + "Odin", + + "Omgrofl", + + "Opa", + + "Opal", + + "Open Policy Agent", + + "OpenCL", + + "OpenEdge ABL", + + "OpenQASM", + + "OpenRC runscript", + + "OpenSCAD", + + "OpenStep Property List", + + "OpenType Feature File", + + "Org", + + "Ox", + + "Oxygene", + + "Oz", + + "P4", + + "PEG.js", + + "PHP", + + "PLpgSQL", + + "POV-Ray SDL", + + "Pan", + + "Papyrus", + + "Parrot Assembly", + + "Parrot Internal Representation", + + "Parrot", + + "Pascal", + + "Pawn", + + "Pep8", + + "Perl", + + "Pickle", + + "PicoLisp", + + "PigLatin", + + "Pike", + + "PlantUML", + + "Pod 6", + + "Pod", + + "PogoScript", + + "Pony", + + "PostCSS", + + "PostScript", + + "PowerShell", + + "Prisma", + + "Processing", + + "Proguard", + + "Prolog", + + "Promela", + + "Propeller Spin", + + "Protocol Buffer", + + "Protocol Buffers", + + "Public Key", + + "Pug", + + "Puppet", + + "Pure Data", + + "PureBasic", + + "PureScript", + + "Python", + + "Q#", + + "QMake", + + "Qt Script", + + "Quake", + + "R", + + "RAML", + + "RDoc", + + "REALbasic", + + "REXX", + + "RMarkdown", + + "RPC", + + "RPM Spec", + + "Racket", + + "Ragel", + + "Raw token data", + + "ReScript", + + "Readline Config", + + "Reason", + + "Rebol", + + "Record Jar", + + "Red", + + "Redirect Rules", + + "Regular Expression", + + "RenderScript", + + "Rich Text Format", + + "Ring", + + "Riot", + + "RobotFramework", + + "Roff", + + "Rouge", + + "Rscript", + + "Ruby", + + "Rust", + + "SAS", + + "SCSS", + + "SELinux Kernel Policy Language", + + "SELinux Policy", + + "SMT", + + "SPARQL", + + "SQF", + + "SQL", + + "SQLPL", + + "SRecode Template", + + "SSH Config", + + "STON", + + "SVG", + + "SWIG", + + "Sage", + + "SaltStack", + + "Sass", + + "Scala", + + "Scaml", + + "Scheme", + + "Scilab", + + "Self", + + "ShaderLab", + + "Shell", + + "ShellCheck Config", + + "Sieve", + + "Singularity", + + "Slash", + + "Slice", + + "Slim", + + "SmPL", + + "Smalltalk", + + "SnipMate", + + "Solidity", + + "Soong", + + "SourcePawn", + + "Spline Font Database", + + "Squirrel", + + "Stan", + + "Standard ML", + + "Starlark", + + "StringTemplate", + + "Stylus", + + "SubRip Text", + + "SugarSS", + + "SuperCollider", + + "Svelte", + + "Swift", + + "SystemVerilog", + + "TI Program", + + "TLA", + + "TOML", + + "TSQL", + + "TSV", + + "TSX", + + "TXL", + + "Tcl", + + "Tcsh", + + "TeX", + + "Tea", + + "Terra", + + "Texinfo", + + "Text", + + "TextMate Properties", + + "Textile", + + "Thrift", + + "Turing", + + "Turtle", + + "Twig", + + "Type Language", + + "TypeScript", + + "UltiSnip", + + "UltiSnips", + + "Unified Parallel C", + + "Unity3D Asset", + + "Unix Assembly", + + "Uno", + + "UnrealScript", + + "Ur", + + "Ur/Web", + + "UrWeb", + + "V", + + "VBA", + + "VCL", + + "VHDL", + + "Vala", + + "Valve Data Format", + + "Verilog", + + "Vim Help File", + + "Vim Script", + + "Vim Snippet", + + "Visual Basic .NET", + + "Vue", + + "Wavefront Material", + + "Wavefront Object", + + "Web Ontology Language", + + "WebAssembly", + + "WebVTT", + + "Wget Config", + + "Wikitext", + + "Windows Registry Entries", + + "Wollok", + + "World of Warcraft Addon Data", + + "X BitMap", + + "X Font Directory Index", + + "X PixMap", + + "X10", + + "XC", + + "XCompose", + + "XML Property List", + + "XML", + + "XPages", + + "XProc", + + "XQuery", + + "XS", + + "XSLT", + + "Xojo", + + "Xonsh", + + "Xtend", + + "YAML", + + "YANG", + + "YARA", + + "YASnippet", + + "Yacc", + + "ZAP", + + "ZIL", + + "Zeek", + + "ZenScript", + + "Zephir", + + "Zig", + + "Zimpl", + + "abl", + + "abuild", + + "acfm", + + "aconf", + + "actionscript 3", + + "actionscript3", + + "ada2005", + + "ada95", + + "adobe composite font metrics", + + "adobe multiple font metrics", + + "advpl", + + "ags", + + "ahk", + + "altium", + + "amfm", + + "amusewiki", + + "apache", + + "apkbuild", + + "arexx", + + "as3", + + "asm", + + "asp", + + "aspx", + + "aspx-vb", + + "ats2", + + "au3", + + "autoconf", + + "b3d", + + "bash session", + + "bash", + + "bat", + + "batch", + + "bazel", + + "blitz3d", + + "blitzplus", + + "bmax", + + "bplus", + + "bro", + + "bsdmake", + + "byond", + + "bzl", + + "c++-objdump", + + "c2hs", + + "cURL Config", + + "cake", + + "cakescript", + + "cfc", + + "cfm", + + "cfml", + + "chpl", + + "clipper", + + "coccinelle", + + "coffee", + + "coffee-script", + + "coldfusion html", + + "console", + + "cperl", + + "cpp", + + "csharp", + + "csound-csd", + + "csound-orc", + + "csound-sco", + + "cucumber", + + "curlrc", + + "cwl", + + "dcl", + + "delphi", + + "desktop", + + "dircolors", + + "django", + + "dosbatch", + + "dosini", + + "dpatch", + + "dtrace-script", + + "eC", + + "ecr", + + "editor-config", + + "edn", + + "eeschema schematic", + + "eex", + + "elisp", + + "emacs muse", + + "emacs", + + "email", + + "eml", + + "erb", + + "fb", + + "fish", + + "flex", + + "foxpro", + + "fsharp", + + "fstar", + + "ftl", + + "fundamental", + + "gf", + + "git-ignore", + + "gitattributes", + + "gitconfig", + + "gitignore", + + "gitmodules", + + "go mod", + + "go sum", + + "go.mod", + + "go.sum", + + "golang", + + "groff", + + "gsp", + + "hbs", + + "heex", + + "help", + + "html+django", + + "html+jinja", + + "html+ruby", + + "htmlbars", + + "htmldjango", + + "hylang", + + "i7", + + "ignore", + + "igor", + + "igorpro", + + "ijm", + + "inc", + + "inform7", + + "inputrc", + + "irc logs", + + "irc", + + "java server page", + + "jq", + + "jruby", + + "js", + + "jsonc", + + "jsp", + + "kak", + + "kakscript", + + "keyvalues", + + "ksy", + + "lassoscript", + + "latex", + + "leex", + + "lhaskell", + + "lhs", + + "lisp", + + "litcoffee", + + "live-script", + + "ls", + + "m2", + + "m68k", + + "mIRC Script", + + "macruby", + + "mail", + + "make", + + "man page", + + "man", + + "man-page", + + "manpage", + + "markojs", + + "max/msp", + + "maxmsp", + + "mbox", + + "mcfunction", + + "mdoc", + + "mediawiki", + + "mf", + + "mma", + + "mumps", + + "mupad", + + "nanorc", + + "nasm", + + "ne-on", + + "nesC", + + "nette object notation", + + "nginx configuration file", + + "nixos", + + "njk", + + "node", + + "npmrc", + + "nroff", + + "nush", + + "nvim", + + "obj-c", + + "obj-c++", + + "obj-j", + + "objc", + + "objc++", + + "objectivec", + + "objectivec++", + + "objectivej", + + "objectpascal", + + "objj", + + "octave", + + "odin-lang", + + "odinlang", + + "oncrpc", + + "ooc", + + "openedge", + + "openrc", + + "osascript", + + "pandoc", + + "pasm", + + "pcbnew", + + "perl-6", + + "perl6", + + "pir", + + "plain text", + + "posh", + + "postscr", + + "pot", + + "pov-ray", + + "povray", + + "progress", + + "protobuf", + + "pwsh", + + "pycon", + + "pyrex", + + "python3", + + "q", + + "ql", + + "qsharp", + + "ragel-rb", + + "ragel-ruby", + + "rake", + + "raw", + + "razor", + + "rb", + + "rbx", + + "reStructuredText", + + "readline", + + "red/system", + + "redirects", + + "regex", + + "regexp", + + "renpy", + + "rhtml", + + "robots txt", + + "robots", + + "robots.txt", + + "rpcgen", + + "rs", + + "rs-274x", + + "rss", + + "rst", + + "rusthon", + + "salt", + + "saltstate", + + "sed", + + "sepolicy", + + "sh", + + "shell-script", + + "shellcheckrc", + + "sml", + + "snippet", + + "sourcemod", + + "soy", + + "specfile", + + "splus", + + "squeak", + + "terraform", + + "tl", + + "tm-properties", + + "troff", + + "ts", + + "udiff", + + "vb .net", + + "vb.net", + + "vb6", + + "vbnet", + + "vdf", + + "vim", + + "vimhelp", + + "viml", + + "visual basic 6", + + "visual basic for applications", + + "visual basic", + + "vlang", + + "wasm", + + "wast", + + "wdl", + + "wgetrc", + + "wiki", + + "winbatch", + + "wisp", + + "wl", + + "wolfram lang", + + "wolfram language", + + "wolfram", + + "wsdl", + + "xBase", + + "xbm", + + "xdr", + + "xhtml", + + "xml+genshi", + + "xml+kid", + + "xpm", + + "xsd", + + "xsl", + + "xten", + + "yas", + + "yml", + + "zsh" + ] + } + }, + + "additionalProperties": false + }, + + "validations": { + "$ref": "#/definitions/validations", + + "title": "textarea validations", + + "description": "Textarea validations\nhttps://docs.github.com/en/communities/using-templates-to-encourage-useful-issues-and-pull-requests/syntax-for-githubs-form-schema#validations" + } + }, + + "additionalProperties": false + } + }, + + { + "if": { + "properties": { + "type": { + "const": "input" + } + } + }, + + "then": { + "$comment": "For `additionalProperties` to work `type` must also be present here.", + + "title": "input", + + "description": "Input\nhttps://docs.github.com/en/communities/using-templates-to-encourage-useful-issues-and-pull-requests/syntax-for-githubs-form-schema#input", + + "type": "object", + + "required": ["type", "attributes"], + + "properties": { + "type": { + "$ref": "#/definitions/type" + }, + + "id": { + "$ref": "#/definitions/id", + + "description": "An input id\nhttps://docs.github.com/en/communities/using-templates-to-encourage-useful-issues-and-pull-requests/syntax-for-githubs-form-schema#keys" + }, + + "attributes": { + "title": "input attributes", + + "description": "Input attributes\nhttps://docs.github.com/en/communities/using-templates-to-encourage-useful-issues-and-pull-requests/syntax-for-githubs-form-schema#attributes-2", + + "type": "object", + + "required": ["label"], + + "properties": { + "label": { + "$ref": "#/definitions/label", + + "description": "A short input description\nhttps://docs.github.com/en/communities/using-templates-to-encourage-useful-issues-and-pull-requests/syntax-for-githubs-form-schema#attributes-2" + }, + + "description": { + "$ref": "#/definitions/description", + + "description": "A long input description\nhttps://docs.github.com/en/communities/using-templates-to-encourage-useful-issues-and-pull-requests/syntax-for-githubs-form-schema#attributes-2" + }, + + "placeholder": { + "$ref": "#/definitions/placeholder", + + "description": "An input placeholder\nhttps://docs.github.com/en/communities/using-templates-to-encourage-useful-issues-and-pull-requests/syntax-for-githubs-form-schema#attributes-2" + }, + + "value": { + "$ref": "#/definitions/value", + + "description": "An input value\nhttps://docs.github.com/en/communities/using-templates-to-encourage-useful-issues-and-pull-requests/syntax-for-githubs-form-schema#attributes-2" + } + }, + + "additionalProperties": false + }, + + "validations": { + "$ref": "#/definitions/validations", + + "title": "input validations", + + "description": "Input validations\nhttps://docs.github.com/en/communities/using-templates-to-encourage-useful-issues-and-pull-requests/syntax-for-githubs-form-schema#validations-1" + } + }, + + "additionalProperties": false + } + }, + + { + "if": { + "properties": { + "type": { + "const": "dropdown" + } + } + }, + + "then": { + "$comment": "For `additionalProperties` to work `type` must also be present here.", + + "title": "dropdown", + + "description": "dropdown\nhttps://docs.github.com/en/communities/using-templates-to-encourage-useful-issues-and-pull-requests/syntax-for-githubs-form-schema#dropdown", + + "type": "object", + + "required": ["type", "attributes"], + + "properties": { + "type": { + "$ref": "#/definitions/type" + }, + + "id": { + "$ref": "#/definitions/id", + + "description": "A dropdown id\nhttps://docs.github.com/en/communities/using-templates-to-encourage-useful-issues-and-pull-requests/syntax-for-githubs-form-schema#keys" + }, + + "attributes": { + "title": "dropdown attributes", + + "description": "Dropdown attributes\nhttps://docs.github.com/en/communities/using-templates-to-encourage-useful-issues-and-pull-requests/syntax-for-githubs-form-schema#attributes-3", + + "type": "object", + + "required": ["label", "options"], + + "properties": { + "label": { + "$ref": "#/definitions/label", + + "description": "A short dropdown description\nhttps://docs.github.com/en/communities/using-templates-to-encourage-useful-issues-and-pull-requests/syntax-for-githubs-form-schema#attributes-3" + }, + + "description": { + "$ref": "#/definitions/description", + + "description": "A long dropdown description\nhttps://docs.github.com/en/communities/using-templates-to-encourage-useful-issues-and-pull-requests/syntax-for-githubs-form-schema#attributes-3" + }, + + "multiple": { + "description": "Specify whether allow a multiple choices\nhttps://docs.github.com/en/communities/using-templates-to-encourage-useful-issues-and-pull-requests/syntax-for-githubs-form-schema#attributes-3", + + "type": "boolean", + + "default": false + }, + + "options": { + "description": "Dropdown choices\nhttps://docs.github.com/en/communities/using-templates-to-encourage-useful-issues-and-pull-requests/syntax-for-githubs-form-schema#attributes-3", + + "type": "array", + + "minItems": 1, + + "uniqueItems": true, + + "items": { + "type": "string", + + "minLength": 1, + + "examples": ["Sample choice"] + } + }, + + "default": { + "description": "Index of the default option\nhttps://docs.github.com/en/communities/using-templates-to-encourage-useful-issues-and-pull-requests/syntax-for-githubs-form-schema#attributes-3", + + "type": "integer", + + "examples": [0] + } + }, + + "additionalProperties": false + }, + + "validations": { + "$ref": "#/definitions/validations", + + "title": "dropdown validations", + + "description": "Dropdown validations\nhttps://docs.github.com/en/communities/using-templates-to-encourage-useful-issues-and-pull-requests/syntax-for-githubs-form-schema#validations-2" + } + }, + + "additionalProperties": false + } + }, + + { + "if": { + "properties": { + "type": { + "const": "checkboxes" + } + } + }, + + "then": { + "$comment": "For `additionalProperties` to work `type` must also be present here.", + + "title": "checkboxes", + + "description": "Checkboxes\nhttps://docs.github.com/en/communities/using-templates-to-encourage-useful-issues-and-pull-requests/syntax-for-githubs-form-schema#checkboxes", + + "type": "object", + + "required": ["type", "attributes"], + + "properties": { + "type": { + "$ref": "#/definitions/type" + }, + + "id": { + "$ref": "#/definitions/id", + + "description": "Checkbox list id\nhttps://docs.github.com/en/communities/using-templates-to-encourage-useful-issues-and-pull-requests/syntax-for-githubs-form-schema#keys" + }, + + "attributes": { + "title": "checkbox list attributes", + + "description": "Checkbox list attributes\nhttps://docs.github.com/en/communities/using-templates-to-encourage-useful-issues-and-pull-requests/syntax-for-githubs-form-schema#attributes-4", + + "type": "object", + + "required": ["label", "options"], + + "properties": { + "label": { + "$ref": "#/definitions/label", + + "description": "A short checkbox list description\nhttps://docs.github.com/en/communities/using-templates-to-encourage-useful-issues-and-pull-requests/syntax-for-githubs-form-schema#attributes-4" + }, + + "description": { + "$ref": "#/definitions/description", + + "description": "A long checkbox list description\nhttps://docs.github.com/en/communities/using-templates-to-encourage-useful-issues-and-pull-requests/syntax-for-githubs-form-schema#attributes-4" + }, + + "options": { + "description": "Checkbox list choices\nhttps://docs.github.com/en/communities/using-templates-to-encourage-useful-issues-and-pull-requests/syntax-for-githubs-form-schema#attributes-4", + + "type": "array", + + "minItems": 1, + + "items": { + "title": "checkbox list choice", + + "description": "Checkbox list choice\nhttps://docs.github.com/en/communities/using-templates-to-encourage-useful-issues-and-pull-requests/syntax-for-githubs-form-schema#attributes-4", + + "type": "object", + + "required": ["label"], + + "properties": { + "label": { + "description": "A short checkbox list choice description\nhttps://docs.github.com/en/communities/using-templates-to-encourage-useful-issues-and-pull-requests/syntax-for-githubs-form-schema#attributes-4", + + "type": "string", + + "minLength": 1, + + "examples": ["Sample label"] + }, + + "required": { + "description": "Specify whether a choice is required\nhttps://docs.github.com/en/communities/using-templates-to-encourage-useful-issues-and-pull-requests/syntax-for-githubs-form-schema#attributes-4", + + "type": "boolean", + + "default": false + } + }, + + "additionalProperties": false + } + } + }, + + "additionalProperties": false + } + }, + + "additionalProperties": false + } + } + ] + } + }, + + "properties": { + "name": { + "description": "An issue template name\nhttps://docs.github.com/en/communities/using-templates-to-encourage-useful-issues-and-pull-requests/syntax-for-issue-forms#top-level-syntax", + + "type": "string", + + "minLength": 1, + + "examples": ["Sample name"] + }, + + "description": { + "description": "An issue template description\nhttps://docs.github.com/en/communities/using-templates-to-encourage-useful-issues-and-pull-requests/syntax-for-issue-forms#top-level-syntax", + + "type": "string", + + "minLength": 1, + + "examples": ["Sample description"] + }, + + "body": { + "description": "An issue template body\nhttps://docs.github.com/en/communities/using-templates-to-encourage-useful-issues-and-pull-requests/syntax-for-issue-forms#top-level-syntax", + + "type": "array", + + "minItems": 1, + + "items": { + "$ref": "#/definitions/form_item" + } + }, + + "assignees": { + "description": "An issue template assignees\nhttps://docs.github.com/en/communities/using-templates-to-encourage-useful-issues-and-pull-requests/syntax-for-issue-forms#top-level-syntax", + + "oneOf": [ + { + "$ref": "#/definitions/assignee" + }, + + { + "type": "array", + + "minItems": 1, + + "uniqueItems": true, + + "items": { + "$ref": "#/definitions/assignee" + } + } + ] + }, + + "labels": { + "description": "An issue template labels\nhttps://docs.github.com/en/communities/using-templates-to-encourage-useful-issues-and-pull-requests/syntax-for-issue-forms#top-level-syntax", + + "type": "array", + + "minItems": 1, + + "uniqueItems": true, + + "items": { + "type": "string", + + "minLength": 1, + + "examples": [ + "Sample label", + + "bug", + + "documentation", + + "duplicate", + + "enhancement", + + "good first issue", + + "help wanted", + + "invalid", + + "question", + + "wontfix" + ] + } + }, + + "title": { + "description": "An issue template title\nhttps://docs.github.com/en/communities/using-templates-to-encourage-useful-issues-and-pull-requests/syntax-for-issue-forms#top-level-syntax", + + "type": "string", + + "minLength": 1, + + "examples": ["Sample title", "Bug: ", "Feature: "] + } + }, + + "required": ["name", "description", "body"], + + "title": "GitHub issue forms config file schema", + + "type": "object" +} diff --git a/tests/data/test_package_generation/src/cookiecutter_test/__init__.py b/tests/data/test_package_generation/src/cookiecutter_test/__init__.py new file mode 100644 index 00000000..a37fbaec --- /dev/null +++ b/tests/data/test_package_generation/src/cookiecutter_test/__init__.py @@ -0,0 +1,18 @@ +"""cookiecutter_test package.""" + +from ._version import __version__ # noqa: F401 + + +def example_function(argument: str, keyword_argument: str = "default") -> str: + """ + Concatenate string arguments - an example function docstring. + + Args: + argument: An argument. + keyword_argument: A keyword argument with a default value. + + Returns: + The concatenation of `argument` and `keyword_argument`. + + """ + return argument + keyword_argument diff --git a/tests/data/test_package_generation/tests/test_dummy.py b/tests/data/test_package_generation/tests/test_dummy.py new file mode 100644 index 00000000..0c1c580e --- /dev/null +++ b/tests/data/test_package_generation/tests/test_dummy.py @@ -0,0 +1,6 @@ +"""An example set of tests.""" + + +def test_stupid_example() -> None: + """Test is merely a placeholder.""" + assert True diff --git a/tests/test_package_generation.py b/tests/test_package_generation.py index 95f79a5a..b9de3bcd 100644 --- a/tests/test_package_generation.py +++ b/tests/test_package_generation.py @@ -1,7 +1,9 @@ """Checks that the cookiecutter works.""" +import difflib import os import pathlib +import shutil import subprocess import typing @@ -13,15 +15,20 @@ def get_all_files_folders(root_path: pathlib.Path) -> set[pathlib.Path]: Get all files and folders under a directory. The paths are returned relative to the root path given. + __pycache__ directories and .DS_Store files are ignored. """ file_set: set[pathlib.Path] = set() for dirpath, _, filenames in os.walk(root_path): dirpath_path = pathlib.Path(dirpath).relative_to(root_path) + if dirpath_path.name in ["__pycache__"]: + continue # Add this directory file_set.update((dirpath_path,)) # Add any files in it for filename in filenames: + if filename in [".DS_Store"]: + continue file_set.update((dirpath_path / filename,)) return file_set @@ -36,59 +43,69 @@ def test_package_generation( "github_username": "test-user", "project_short_description": "description", "project_name": "Cookiecutter Test", + # Not having a git repo makes it easier to check in/out reference + # data files to the main python-tooling git repository + "initialise_git_repository": False, } generate_package(config=test_config, path=tmp_path) + expected_package_dir = ( + pathlib.Path(__file__).parent / "data" / "test_package_generation" + ) # Check project directory exists test_project_dir = tmp_path / "cookiecutter-test" assert test_project_dir.exists() - # Check main files and directories inside - expected_files: set[pathlib.Path] = { - pathlib.Path(), - pathlib.Path(".github"), - pathlib.Path(".github/ISSUE_TEMPLATE"), - pathlib.Path(".github/ISSUE_TEMPLATE/bug_report.yml"), - pathlib.Path(".github/ISSUE_TEMPLATE/config.yml"), - pathlib.Path(".github/ISSUE_TEMPLATE/documentation.yml"), - pathlib.Path(".github/ISSUE_TEMPLATE/feature_request.yml"), - pathlib.Path(".github/ISSUE_TEMPLATE/question.yml"), - pathlib.Path(".github/workflows"), - pathlib.Path(".github/workflows/docs.yml"), - pathlib.Path(".github/workflows/linting.yml"), - pathlib.Path(".github/workflows/tests.yml"), - pathlib.Path(".gitignore"), - pathlib.Path(".markdownlint.yaml"), - pathlib.Path(".pre-commit-config.yaml"), - pathlib.Path("CITATION.cff"), - pathlib.Path("LICENSE.md"), - pathlib.Path("README.md"), - pathlib.Path("docs"), - pathlib.Path("docs/LICENSE.md"), - pathlib.Path("docs/api.md"), - pathlib.Path("docs/index.md"), - pathlib.Path("mkdocs.yml"), - pathlib.Path("pyproject.toml"), - pathlib.Path("schemas"), - pathlib.Path("schemas/github-issue-forms.json"), - pathlib.Path("src"), - pathlib.Path("src/cookiecutter_test"), - pathlib.Path("src/cookiecutter_test/__init__.py"), - pathlib.Path("tests"), - pathlib.Path("tests/test_dummy.py"), - } - actual_files = get_all_files_folders(test_project_dir) - # Filter out anything under specific directories to make comparison easier - actual_files = { - a - for a in actual_files - if not (a.parts and (a.parts[0] == ".git" or "__pycache__" in a.parts)) - } + expected_files = get_all_files_folders(expected_package_dir) assert actual_files == expected_files - # Check it's pip-installable + # Check diff between actual and expected file contents + diff = "" + for file in actual_files: + actual_file = test_project_dir / file + expected_file = expected_package_dir / file + + if actual_file.is_dir(): + continue + + with actual_file.open() as f1, expected_file.open() as f2: + diff += "".join( + difflib.unified_diff( + f1.readlines(), + f2.readlines(), + fromfile=str(actual_file), + tofile=str(expected_file), + ) + ) + + if diff: + shutil.rmtree(expected_package_dir) + shutil.move(test_project_dir, expected_package_dir) + msg = ( + "Non-zero diff between generated files and expected files.\n" + "Test data files have been modified with new content.\n" + "Diff is:\n" + f"{diff}" + ) + raise RuntimeError(msg) + + +def test_pip_installable( + tmp_path: pathlib.Path, + generate_package: typing.Callable, +) -> None: + """Test generated package is pip installable.""" + test_config = { + "github_username": "test-user", + "project_short_description": "description", + "project_name": "Cookiecutter Test", + } + generate_package(config=test_config, path=tmp_path) + + # Check project directory exists + test_project_dir = tmp_path / "cookiecutter-test" pipinstall = subprocess.run( # noqa: S603 [ # noqa: S607 "python",