Skip to content

Commit

Permalink
Update instance repo from cookiecutter template
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] committed Jun 6, 2024
1 parent 27f2f6c commit a473498
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ repos:
hooks:
- id: prettier
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.4.7
rev: v0.4.8
hooks:
- id: ruff
types_or: [python, pyi, jupyter]
Expand Down
38 changes: 38 additions & 0 deletions docs/template_usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -418,6 +418,44 @@ 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 https://github.com/scverse/cookiecutter-scverse
```

4. remove everything from the existing repo

```bash
cd ${REPO}_cookiecutterized
git switch -c 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 `cookiecutterize` branch into the main branch, e.g. by making a pull request.

<!-- Links -->

[scanpy developer guide]: https://scanpy.readthedocs.io/en/latest/dev/index.html
Expand Down

0 comments on commit a473498

Please sign in to comment.