From 60b102fe1c7bab612e4712ec8eb4d05a9c0e9d45 Mon Sep 17 00:00:00 2001 From: Gregor Sturm Date: Wed, 5 Jun 2024 10:06:43 +0200 Subject: [PATCH 1/5] Add instructions on how to migrate an existing project to using the template --- .../docs/template_usage.md | 40 +++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/{{cookiecutter.project_name}}/docs/template_usage.md b/{{cookiecutter.project_name}}/docs/template_usage.md index e12702e2..ab7a4cb6 100644 --- a/{{cookiecutter.project_name}}/docs/template_usage.md +++ b/{{cookiecutter.project_name}}/docs/template_usage.md @@ -419,6 +419,46 @@ The following hints may be useful to work with the template sync: You have reached the end of this document. Congratulations! You have successfully set up your project and are ready to start. For everything else related to documentation, code style, testing and publishing your project to pypi, please refer to the [contributing docs](contributing.md#contributing-guide). +## Migrate existing projects to using this template + +You can also update existing projects to make use of this template to benefit from the latest-greatest +tooling and automated template updates. This requires some manual work though. Here's one way how to do it + +1. Let's assume your repository is checked out to `$REPO` +2. Clone your repository a second time to `${REPO}_cookiecutterized` +3. Initialize an empty repository from this cookiecutter template: + + ```bash + mkdir template && cd template + cruft create cruft create https://github.com/scverse/cookiecutter-scverse + ``` + +4. remove everything from the existing repo + + ```bash + cd ${REPO}_cookiecutterized + git co -b cookiecutterize + git rm -r "*" + git add -A + git commit -m "clean repo" + ``` + +5. move template over from generated folder + + ```bash + # move everything, including hidden folders, excluding `.git`. + rsync -av --exclude='.git' ./template/ ./${REPO}_cookiecutterized/ + git add -A + git commit -m "init from template" + ``` + +6. Migrate your project: Move over files from `$REPO` to `${REPO}_cookiecutterized`. Omit files that are not + needed anymore and manually merge files where required. + +7. Commit your changes. Merge the `cookiecutteriz` branch into the main branch, e.g. by making a pull request. + + + [scanpy developer guide]: https://scanpy.readthedocs.io/en/latest/dev/index.html From a41f82023f70c16b7a76b3e76d1127b97a20dfec Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Wed, 5 Jun 2024 08:07:21 +0000 Subject: [PATCH 2/5] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- {{cookiecutter.project_name}}/docs/template_usage.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/{{cookiecutter.project_name}}/docs/template_usage.md b/{{cookiecutter.project_name}}/docs/template_usage.md index ab7a4cb6..ac0ca05b 100644 --- a/{{cookiecutter.project_name}}/docs/template_usage.md +++ b/{{cookiecutter.project_name}}/docs/template_usage.md @@ -457,8 +457,6 @@ tooling and automated template updates. This requires some manual work though. H 7. Commit your changes. Merge the `cookiecutteriz` branch into the main branch, e.g. by making a pull request. - - [scanpy developer guide]: https://scanpy.readthedocs.io/en/latest/dev/index.html From dbf98777f175b639f477c12924c09f8a011c1e45 Mon Sep 17 00:00:00 2001 From: Gregor Sturm Date: Thu, 6 Jun 2024 14:45:39 +0200 Subject: [PATCH 3/5] Update {{cookiecutter.project_name}}/docs/template_usage.md Co-authored-by: Philipp A. --- {{cookiecutter.project_name}}/docs/template_usage.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/{{cookiecutter.project_name}}/docs/template_usage.md b/{{cookiecutter.project_name}}/docs/template_usage.md index ac0ca05b..cb6818a4 100644 --- a/{{cookiecutter.project_name}}/docs/template_usage.md +++ b/{{cookiecutter.project_name}}/docs/template_usage.md @@ -430,7 +430,7 @@ tooling and automated template updates. This requires some manual work though. H ```bash mkdir template && cd template - cruft create cruft create https://github.com/scverse/cookiecutter-scverse + cruft create https://github.com/scverse/cookiecutter-scverse ``` 4. remove everything from the existing repo From 2f2a5cd5738d260c44094115a051401341dff535 Mon Sep 17 00:00:00 2001 From: Gregor Sturm Date: Thu, 6 Jun 2024 14:46:02 +0200 Subject: [PATCH 4/5] Update {{cookiecutter.project_name}}/docs/template_usage.md Co-authored-by: Philipp A. --- {{cookiecutter.project_name}}/docs/template_usage.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/{{cookiecutter.project_name}}/docs/template_usage.md b/{{cookiecutter.project_name}}/docs/template_usage.md index cb6818a4..712fd24c 100644 --- a/{{cookiecutter.project_name}}/docs/template_usage.md +++ b/{{cookiecutter.project_name}}/docs/template_usage.md @@ -437,7 +437,7 @@ tooling and automated template updates. This requires some manual work though. H ```bash cd ${REPO}_cookiecutterized - git co -b cookiecutterize + git switch -c cookiecutterize git rm -r "*" git add -A git commit -m "clean repo" From a4d7378dace0891e17265a863217b9a668b293f5 Mon Sep 17 00:00:00 2001 From: Gregor Sturm Date: Thu, 6 Jun 2024 14:46:07 +0200 Subject: [PATCH 5/5] Update {{cookiecutter.project_name}}/docs/template_usage.md Co-authored-by: Philipp A. --- {{cookiecutter.project_name}}/docs/template_usage.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/{{cookiecutter.project_name}}/docs/template_usage.md b/{{cookiecutter.project_name}}/docs/template_usage.md index 712fd24c..88dfa4e6 100644 --- a/{{cookiecutter.project_name}}/docs/template_usage.md +++ b/{{cookiecutter.project_name}}/docs/template_usage.md @@ -455,7 +455,7 @@ tooling and automated template updates. This requires some manual work though. H 6. Migrate your project: Move over files from `$REPO` to `${REPO}_cookiecutterized`. Omit files that are not needed anymore and manually merge files where required. -7. Commit your changes. Merge the `cookiecutteriz` branch into the main branch, e.g. by making a pull request. +7. Commit your changes. Merge the `cookiecutterize` branch into the main branch, e.g. by making a pull request.