From 72dcabc7c942eab90a53ec29a30a440374ca6f60 Mon Sep 17 00:00:00 2001 From: Hans-Martin von Gaudecker Date: Fri, 2 Dec 2022 10:58:18 +0100 Subject: [PATCH 01/14] Use checkout@v3, micromamba. --- .github/workflows/main.yml | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 16f0b36..5884de3 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -30,17 +30,16 @@ jobs: python-version: ['3.8', '3.9', '3.10', '3.11'] steps: - - uses: actions/checkout@v2 - - uses: conda-incubator/setup-miniconda@v2 + - uses: actions/checkout@v3 + - uses: mamba-org/provision-with-micromamba@main with: - auto-update-conda: false - python-version: ${{ matrix.python-version }} + environment-file: false channels: conda-forge,nodefaults - mamba-version: "*" - - - name: Install core dependencies. - shell: bash -l {0} - run: mamba install -c conda-forge tox-conda coverage + extra-specs: | + python=${{ matrix.python-version }} + tox-conda + coverage + cache-downloads: true - name: Run end-to-end tests. shell: bash -l {0} @@ -58,14 +57,16 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - uses: conda-incubator/setup-miniconda@v2 + - uses: actions/checkout@v3 + - uses: mamba-org/provision-with-micromamba@main with: - auto-update-conda: false - - - name: Install core dependencies. - shell: bash -l {0} - run: conda install -c conda-forge tox-conda + environment-file: false + channels: conda-forge,nodefaults + extra-specs: | + python=3.11 + tox-conda + coverage + cache-downloads: true - name: Build docs shell: bash -l {0} From 95bb053116b85bb1a3cd93bf5bfd97d62621b520 Mon Sep 17 00:00:00 2001 From: Hans-Martin von Gaudecker Date: Fri, 2 Dec 2022 11:05:37 +0100 Subject: [PATCH 02/14] Need to set environment-name. --- .github/workflows/main.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 5884de3..0d1a6da 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -34,6 +34,7 @@ jobs: - uses: mamba-org/provision-with-micromamba@main with: environment-file: false + environment-name: gha-testing channels: conda-forge,nodefaults extra-specs: | python=${{ matrix.python-version }} @@ -61,6 +62,7 @@ jobs: - uses: mamba-org/provision-with-micromamba@main with: environment-file: false + environment-name: gha-docs channels: conda-forge,nodefaults extra-specs: | python=3.11 From ed4a4cfd9eb0e8153354bbc9d9f4fe530e16e4e0 Mon Sep 17 00:00:00 2001 From: Hans-Martin von Gaudecker Date: Fri, 2 Dec 2022 11:12:01 +0100 Subject: [PATCH 03/14] Add mamba to environment. --- .github/workflows/main.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 0d1a6da..58a370b 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -38,6 +38,7 @@ jobs: channels: conda-forge,nodefaults extra-specs: | python=${{ matrix.python-version }} + mamba tox-conda coverage cache-downloads: true @@ -66,6 +67,7 @@ jobs: channels: conda-forge,nodefaults extra-specs: | python=3.11 + mamba tox-conda coverage cache-downloads: true From f1b8359b5c4dacc68e220903dccc2de31589b203 Mon Sep 17 00:00:00 2001 From: Hans-Martin von Gaudecker Date: Fri, 2 Dec 2022 12:26:43 +0100 Subject: [PATCH 04/14] Same changes also for inner project. --- .../.github/workflows/main.yml | 33 ++++++++++++------- 1 file changed, 21 insertions(+), 12 deletions(-) diff --git a/{{cookiecutter.project_slug}}/.github/workflows/main.yml b/{{cookiecutter.project_slug}}/.github/workflows/main.yml index 090a0ac..97f6ac1 100644 --- a/{{cookiecutter.project_slug}}/.github/workflows/main.yml +++ b/{{cookiecutter.project_slug}}/.github/workflows/main.yml @@ -30,13 +30,18 @@ jobs: python-version: ['3.8', '3.9', '3.10', '3.11'] steps: - - uses: actions/checkout@v2 - - uses: conda-incubator/setup-miniconda@v2 + - uses: actions/checkout@v3 + - uses: mamba-org/provision-with-micromamba@main with: - auto-update-conda: true - python-version: ${{ matrix.python-version }} + environment-file: false + environment-name: gha-testing channels: conda-forge,nodefaults - mamba-version: "*" + extra-specs: | + python=${{ matrix.python-version }} + mamba + tox-conda + coverage + cache-downloads: true - name: Install core dependencies. shell: bash -l {0} @@ -78,14 +83,18 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - uses: conda-incubator/setup-miniconda@v2 + - uses: actions/checkout@v3 + - uses: mamba-org/provision-with-micromamba@main with: - auto-update-conda: true - - - name: Install core dependencies. - shell: bash -l {0} - run: conda install -c conda-forge tox-conda + environment-file: false + environment-name: gha-docs + channels: conda-forge,nodefaults + extra-specs: | + python=3.11 + mamba + tox-conda + coverage + cache-downloads: true - name: Build docs shell: bash -l {0} From 3af47793ba1702bd8e82f4b07765e0b3d0dc4193 Mon Sep 17 00:00:00 2001 From: Hans-Martin von Gaudecker Date: Fri, 2 Dec 2022 12:37:01 +0100 Subject: [PATCH 05/14] Forgot to delete a block. --- {{cookiecutter.project_slug}}/.github/workflows/main.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/{{cookiecutter.project_slug}}/.github/workflows/main.yml b/{{cookiecutter.project_slug}}/.github/workflows/main.yml index 97f6ac1..a7f22fa 100644 --- a/{{cookiecutter.project_slug}}/.github/workflows/main.yml +++ b/{{cookiecutter.project_slug}}/.github/workflows/main.yml @@ -43,10 +43,6 @@ jobs: coverage cache-downloads: true - - name: Install core dependencies. - shell: bash -l {0} - run: mamba install -c conda-forge tox-conda coverage - # Unit, integration, and end-to-end tests. - name: Run unit tests and doctests. From 0888662085f99ffa24443c9a6440a1c8e4c67c7d Mon Sep 17 00:00:00 2001 From: Hans-Martin von Gaudecker Date: Fri, 2 Dec 2022 18:18:33 +0100 Subject: [PATCH 06/14] Pin conda to 22.9, see https://github.com/OpenSourceEconomics/econ-project-templates/commit/854bcad35ee8d785cec33d704130fb265158145d. --- {{cookiecutter.project_slug}}/.github/workflows/main.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/{{cookiecutter.project_slug}}/.github/workflows/main.yml b/{{cookiecutter.project_slug}}/.github/workflows/main.yml index a7f22fa..601b76b 100644 --- a/{{cookiecutter.project_slug}}/.github/workflows/main.yml +++ b/{{cookiecutter.project_slug}}/.github/workflows/main.yml @@ -39,6 +39,7 @@ jobs: extra-specs: | python=${{ matrix.python-version }} mamba + conda=22.9 tox-conda coverage cache-downloads: true @@ -88,6 +89,7 @@ jobs: extra-specs: | python=3.11 mamba + conda=22.9 tox-conda coverage cache-downloads: true From 6e06109e03eac5e7cd80454513c4cd49b7996a65 Mon Sep 17 00:00:00 2001 From: Hans-Martin von Gaudecker Date: Fri, 2 Dec 2022 18:23:57 +0100 Subject: [PATCH 07/14] Harmonize post_gen_project with econ-project-templates. --- hooks/post_gen_project.py | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/hooks/post_gen_project.py b/hooks/post_gen_project.py index dbcbc76..bac7d73 100644 --- a/hooks/post_gen_project.py +++ b/hooks/post_gen_project.py @@ -60,18 +60,30 @@ def main() -> None: ) if "{{ cookiecutter.create_conda_environment_at_finish }}" == "yes": - if shutil.which("mamba") is not None: - conda_exe = shutil.which("mamba") + + if _mamba := shutil.which("mamba"): + conda_exe = _mamba else: conda_exe = shutil.which("conda") - if conda_exe is None: + if conda_exe: + subprocess.run( + ( + conda_exe, + "env", + "create", + "-f", + (project_path / "environment.yml").absolute().as_posix(), + "--force", + ), + check=True, + capture_output=True, + ) + else: warnings.warn( "conda environment could not be created since no conda or mamba " "executable was found." ) - else: - subprocess.run((conda_exe, "env", "create"), check=True) if __name__ == "__main__": From 7826bf6757fff63038720ecac16d1ff0e34cc7fd Mon Sep 17 00:00:00 2001 From: Hans-Martin von Gaudecker Date: Fri, 2 Dec 2022 18:31:38 +0100 Subject: [PATCH 08/14] Forgot to pin conda in other location in prior commit. --- .github/workflows/main.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 58a370b..6bed7aa 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -39,6 +39,7 @@ jobs: extra-specs: | python=${{ matrix.python-version }} mamba + conda=22.9 tox-conda coverage cache-downloads: true @@ -68,6 +69,7 @@ jobs: extra-specs: | python=3.11 mamba + conda=22.9 tox-conda coverage cache-downloads: true From d09f7222cf86af83caf852855e4263ffa1bcd200 Mon Sep 17 00:00:00 2001 From: Hans-Martin von Gaudecker Date: Sat, 3 Dec 2022 12:20:27 +0100 Subject: [PATCH 09/14] Rename pytask to correct placeholder. --- .../.github/ISSUE_TEMPLATE/question.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/{{cookiecutter.project_slug}}/.github/ISSUE_TEMPLATE/question.md b/{{cookiecutter.project_slug}}/.github/ISSUE_TEMPLATE/question.md index 7049900..5bd68fb 100644 --- a/{{cookiecutter.project_slug}}/.github/ISSUE_TEMPLATE/question.md +++ b/{{cookiecutter.project_slug}}/.github/ISSUE_TEMPLATE/question.md @@ -7,7 +7,7 @@ labels: "question" --- -#### Question about pytask +#### Question about {{ cookiecutter.project_slug }} **Note**: If you'd still like to submit a question, please read [this guide]( https://matthewrocklin.com/blog/work/2018/02/28/minimal-bug-reports) detailing how to From 7d260cd6cd1cf0db5fb316d7f9f1917ab789a1ed Mon Sep 17 00:00:00 2001 From: Hans-Martin von Gaudecker Date: Sat, 3 Dec 2022 12:21:08 +0100 Subject: [PATCH 10/14] Use project_name instead of project_slug for issue templates. --- .../.github/ISSUE_TEMPLATE/bug_report.md | 6 +++--- .../.github/ISSUE_TEMPLATE/documentation.md | 2 +- .../.github/ISSUE_TEMPLATE/enhancement.md | 4 ++-- .../.github/ISSUE_TEMPLATE/question.md | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/{{cookiecutter.project_slug}}/.github/ISSUE_TEMPLATE/bug_report.md b/{{cookiecutter.project_slug}}/.github/ISSUE_TEMPLATE/bug_report.md index e663479..364c6af 100644 --- a/{{cookiecutter.project_slug}}/.github/ISSUE_TEMPLATE/bug_report.md +++ b/{{cookiecutter.project_slug}}/.github/ISSUE_TEMPLATE/bug_report.md @@ -1,7 +1,7 @@ --- name: Bug Report -about: Create a bug report to help us improve {{ cookiecutter.project_slug }} +about: Create a bug report to help us improve {{ cookiecutter.project_name }} title: "BUG:" labels: "bug" @@ -10,10 +10,10 @@ labels: "bug" - [ ] I have checked that this issue has not already been reported. - [ ] I have confirmed this bug exists on the latest version of {{ - cookiecutter.project_slug }}. + cookiecutter.project_name }}. - [ ] (optional) I have confirmed this bug exists on the `main` branch of {{ - cookiecutter.project_slug }}. + cookiecutter.project_name }}. --- diff --git a/{{cookiecutter.project_slug}}/.github/ISSUE_TEMPLATE/documentation.md b/{{cookiecutter.project_slug}}/.github/ISSUE_TEMPLATE/documentation.md index 9747ee7..03b2a05 100644 --- a/{{cookiecutter.project_slug}}/.github/ISSUE_TEMPLATE/documentation.md +++ b/{{cookiecutter.project_slug}}/.github/ISSUE_TEMPLATE/documentation.md @@ -1,7 +1,7 @@ --- name: Documentation Improvement -about: Report wrong or missing documentation +about: Report wrong or missing documentation in {{ cookiecutter.project_name }} title: "DOC:" labels: "documentation" diff --git a/{{cookiecutter.project_slug}}/.github/ISSUE_TEMPLATE/enhancement.md b/{{cookiecutter.project_slug}}/.github/ISSUE_TEMPLATE/enhancement.md index 980702f..e308e42 100644 --- a/{{cookiecutter.project_slug}}/.github/ISSUE_TEMPLATE/enhancement.md +++ b/{{cookiecutter.project_slug}}/.github/ISSUE_TEMPLATE/enhancement.md @@ -1,7 +1,7 @@ --- name: Enhancement -about: Suggest an idea for {{ cookiecutter.project_slug }} +about: Suggest an idea for {{ cookiecutter.project_name }} title: "ENH:" labels: "enhancement" @@ -10,7 +10,7 @@ labels: "enhancement" #### Is your feature request related to a problem? Provide a description of what the problem is, e.g. "I wish I could use -{{ cookiecutter.project_slug }} to do [...]". +{{ cookiecutter.project_name }} to do [...]". #### Describe the solution you'd like diff --git a/{{cookiecutter.project_slug}}/.github/ISSUE_TEMPLATE/question.md b/{{cookiecutter.project_slug}}/.github/ISSUE_TEMPLATE/question.md index 5bd68fb..ec2ca08 100644 --- a/{{cookiecutter.project_slug}}/.github/ISSUE_TEMPLATE/question.md +++ b/{{cookiecutter.project_slug}}/.github/ISSUE_TEMPLATE/question.md @@ -1,13 +1,13 @@ --- name: Submit Question -about: Ask a general question about {{ cookiecutter.project_slug }} +about: Ask a general question about {{ cookiecutter.project_name }} title: "QST:" labels: "question" --- -#### Question about {{ cookiecutter.project_slug }} +#### Question about {{ cookiecutter.project_name }} **Note**: If you'd still like to submit a question, please read [this guide]( https://matthewrocklin.com/blog/work/2018/02/28/minimal-bug-reports) detailing how to From d59f665c8268a2ff496327ddf7341edd97bb8894 Mon Sep 17 00:00:00 2001 From: Hans-Martin von Gaudecker Date: Sat, 3 Dec 2022 13:09:59 +0100 Subject: [PATCH 11/14] Typo. --- {{cookiecutter.project_slug}}/setup.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/{{cookiecutter.project_slug}}/setup.cfg b/{{cookiecutter.project_slug}}/setup.cfg index 946db6a..d7115b5 100644 --- a/{{cookiecutter.project_slug}}/setup.cfg +++ b/{{cookiecutter.project_slug}}/setup.cfg @@ -3,7 +3,7 @@ name = {{ cookiecutter.project_slug }} description = {{ cookiecutter.project_description }} long_description = file: README.md long_description_content_type = text/markdown -url = hhttps://github.com/{{ cookiecutter.github_username }}/{{ cookiecutter.project_slug }} +url = https://github.com/{{ cookiecutter.github_username }}/{{ cookiecutter.project_slug }} author = {{ cookiecutter.author }} author_email = {{ cookiecutter.email }} license = {{ cookiecutter.open_source_license }} From 1da8526c99cc8a568f2bf66a930ce817f214f579 Mon Sep 17 00:00:00 2001 From: Hans-Martin von Gaudecker Date: Sat, 3 Dec 2022 16:02:50 +0100 Subject: [PATCH 12/14] Typo. --- {{cookiecutter.project_slug}}/setup.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/{{cookiecutter.project_slug}}/setup.cfg b/{{cookiecutter.project_slug}}/setup.cfg index d7115b5..39f8479 100644 --- a/{{cookiecutter.project_slug}}/setup.cfg +++ b/{{cookiecutter.project_slug}}/setup.cfg @@ -19,7 +19,7 @@ classifiers = Programming Language :: Python :: 3 :: Only project_urls = Changelog = https://github.com/{{ cookiecutter.github_username }}/{{ cookiecutter.project_slug }} - Documentation = hhttps://github.com/{{ cookiecutter.github_username }}/{{ cookiecutter.project_slug }} + Documentation = https://github.com/{{ cookiecutter.github_username }}/{{ cookiecutter.project_slug }} Github = https://github.com/{{ cookiecutter.github_username }}/{{ cookiecutter.project_slug }} Tracker = https://github.com/{{ cookiecutter.github_username }}/{{ cookiecutter.project_slug }}/issues From 94626b26c2a10732711d450faf4d3f9e116987af Mon Sep 17 00:00:00 2001 From: Tobias Raabe Date: Sun, 4 Dec 2022 23:28:05 +0100 Subject: [PATCH 13/14] Apply suggestions from code review --- .github/workflows/main.yml | 3 --- hooks/post_gen_project.py | 4 ++-- {{cookiecutter.project_slug}}/.github/workflows/main.yml | 4 ---- 3 files changed, 2 insertions(+), 9 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 6bed7aa..03f8f95 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -39,7 +39,6 @@ jobs: extra-specs: | python=${{ matrix.python-version }} mamba - conda=22.9 tox-conda coverage cache-downloads: true @@ -69,9 +68,7 @@ jobs: extra-specs: | python=3.11 mamba - conda=22.9 tox-conda - coverage cache-downloads: true - name: Build docs diff --git a/hooks/post_gen_project.py b/hooks/post_gen_project.py index bac7d73..c8c4955 100644 --- a/hooks/post_gen_project.py +++ b/hooks/post_gen_project.py @@ -61,8 +61,8 @@ def main() -> None: if "{{ cookiecutter.create_conda_environment_at_finish }}" == "yes": - if _mamba := shutil.which("mamba"): - conda_exe = _mamba + if shutil.which("mamba") is not None: + conda_exe = shutil.which("mamba") else: conda_exe = shutil.which("conda") diff --git a/{{cookiecutter.project_slug}}/.github/workflows/main.yml b/{{cookiecutter.project_slug}}/.github/workflows/main.yml index 601b76b..eeb92d6 100644 --- a/{{cookiecutter.project_slug}}/.github/workflows/main.yml +++ b/{{cookiecutter.project_slug}}/.github/workflows/main.yml @@ -39,9 +39,7 @@ jobs: extra-specs: | python=${{ matrix.python-version }} mamba - conda=22.9 tox-conda - coverage cache-downloads: true # Unit, integration, and end-to-end tests. @@ -89,9 +87,7 @@ jobs: extra-specs: | python=3.11 mamba - conda=22.9 tox-conda - coverage cache-downloads: true - name: Build docs From df252e713709aafc82ade406a94845d6a42a0166 Mon Sep 17 00:00:00 2001 From: Tobias Raabe Date: Mon, 5 Dec 2022 01:12:18 +0100 Subject: [PATCH 14/14] Apply suggestions from code review --- .github/workflows/main.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 03f8f95..58e2471 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -40,7 +40,6 @@ jobs: python=${{ matrix.python-version }} mamba tox-conda - coverage cache-downloads: true - name: Run end-to-end tests.