Skip to content

Commit b4da80f

Browse files
authored
feat!: Add renovate (#311)
Need to add some release notes on renovate to the release An example PR it makes: bluesky/ophyd-async#1109
2 parents 17daee5 + 709b7bc commit b4da80f

File tree

21 files changed

+261
-89
lines changed

21 files changed

+261
-89
lines changed

.github/dependabot.yml

Lines changed: 0 additions & 28 deletions
This file was deleted.

README.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,16 +36,14 @@ You can see the template in action in the [example project](https://github.com/D
3636

3737
## Create a new project from the commandline
3838

39-
You will need to `pip install copier` inside an activated `venv` from python3.11 or later, then you can create a new module via:
39+
We recommend that you invoke copier via `uvx`, which will download, install, and run it in its own isolated `venv`. At Diamond you can `module load uv` to get `uvx` on your path, then:
4040

4141
```
4242
git init --initial-branch=main /path/to/my-project
4343
# $_ resolves to /path/to/my-project
44-
copier copy https://github.com/DiamondLightSource/python-copier-template.git $_
44+
uvx copier copy https://github.com/DiamondLightSource/python-copier-template.git $_
4545
```
4646

47-
You can also use it via `uvx copier` if you have `uv` installed.
48-
4947
<!-- README only content. Anything below this line won't be included in index.md -->
5048

5149
See https://DiamondLightSource.github.io/python-copier-template for more detailed documentation.

docs/how-to.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ Practical step-by-step guides for the more experienced user.
66
:maxdepth: 1
77
:glob:
88
9+
how-to/setup-repo
910
how-to/dev-install
1011
how-to/*
1112
```

docs/how-to/build-docs.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,3 +37,12 @@ If you want to watch additional directories for changes you can pass these as ar
3737
```
3838
$ tox -e docs-autobuild -- --watch tests
3939
```
40+
41+
(building-docs-in-ci)=
42+
## Building docs in CI
43+
44+
After a successful run of CI
45+
46+
Settings > Pages
47+
48+
![Setup GitHub Pages](../images/gh-pages-setup.png)

docs/how-to/coverage.md

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,20 @@
33

44
Code coverage is reported to the command line and to a `cov.xml` file by the command `tox -e tests`. The file is uploaded to the Codecov service in CI.
55

6-
## Adding a Codecov Token
6+
(installing-codecov-github-app)=
7+
## Installing Codecov GitHub app
78

8-
If the repo is not hosted in DiamondLightSource, then you need to visit `https://app.codecov.io/account/gh/<org_name>/org-upload-token` to generate a token for your org, and store it as a secret named `CODECOV_TOKEN` in `https://github.com/organizations/<org_name>/settings/secrets/actions`
9+
If your repo is hosted in the DiamondLightSource org, then the codecov GitHub app is already installed and a global token stored so you don't need to do anything.
10+
11+
If your repo is in an org where the codecov GitHub app is not installed, then follow these steps to install it on the org:
12+
13+
- Visit https://github.com/apps/codecov
14+
- Click `Configure`
15+
- Select the org your repo is hosted in
16+
- Select `All repositories` and click `Install`
17+
18+
![Install Codecov](../images/gh-install-codecov.png)
19+
20+
Now you need to visit `https://app.codecov.io/account/gh/<org_name>/org-upload-token` to generate a token for your org, and store it as a secret named `CODECOV_TOKEN` in `https://github.com/organizations/<org_name>/settings/secrets/actions`
21+
22+
Next time you create a pull request or merge to main, the code coverage will be uploaded, and the badge on the repository updated.

docs/how-to/lock-requirements.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ To update all dependencies to their latest versions run:
2828
```
2929
uv sync --upgrade
3030
```
31+
This command will be run by [renovate](./renovate) once a week in CI.
3132

3233
```{seealso}
3334
[The uv docs on locking and syncing](https://docs.astral.sh/uv/concepts/projects/sync)

docs/how-to/pypi.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ You will need the following information:
1414

1515
## If publishing to the DiamondLightSource PyPI organisation
1616

17-
If you are publishing to the DiamondLightSource PyPI organisation then use the above information and follow the [Developer Portal Guide on PyPI publishing](https://dev-portal.diamond.ac.uk/guide/python/how-tos/pypi/).
17+
If you are publishing to the DiamondLightSource PyPI organisation then use the above information and follow the [Developer Portal Guide on PyPI publishing](https://dev-guide.diamond.ac.uk/python/how-tos/pypi/).
1818

1919
## If publishing the PyPI project to another organisation
2020

docs/how-to/renovate.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# Use renovate to keep dependencies up to date
2+
3+
[Renovate](https://github.com/apps/renovate) is a tool for automating dependency updates. It is used to:
4+
- Automatically update the [uv lock file](./lock-requirements.md) and automerge if tests pass
5+
- Update any dependencies in the Dockerfile
6+
- Update the versions of any GitHub actions not manager by the python-copier-template
7+
8+
## Install the Renovate GitHub app
9+
10+
The renovate app will:
11+
- Create weekly PRs to update the lockfile to the latest versions, automerging if tests pass
12+
- Create PRs for other dependencies whenever they are released, but not automerge
13+
14+
If your repo is hosted in the DiamondLightSource org, then the Renovate GitHub app is already installed so you don't need to do anything.
15+
16+
If your repo is in an org where the Renovate GitHub app is not installed, then follow these steps to install it on the org:
17+
18+
- Visit https://github.com/apps/renovate
19+
- Click `Configure`
20+
- Select the org your repo is hosted in
21+
- Select `All repositories` and click `Install`
22+
- Select `Renovate Only` as the product
23+
- Select `Scan only` as the mode
24+
- Click `Finish`
25+
- Click `Settings`
26+
- Select the `Dependencies` tab
27+
- Uncheck `Silent mode`, uncheck `Create onboarding PRs`, and click `Save`
28+
- Visit https://github.com/apps/renovate-approve
29+
- Click `Configure`
30+
- Select the org your repo is hosted in
31+
- Select `All repositories` and click `Install`
32+
33+
![Install Renovate](../images/gh-install-renovate.png)
34+
35+
Renovate will now run periodically to check for updates.
36+
37+
## Pin the dependency dashboard issue
38+
39+
Renovate will create a dependency dashboard when it first runs, this is the way you interact with the bot, requesting it to re-run. It is recommended that you pin this issue to your repo so you can find it easily. Select `Pin issue` in the right hand bar of the issue to do this.

docs/how-to/setup-repo.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# Setup the repository with recommended settings
2+
3+
When the repository has been created, it will require some settings to be changed for all the features of the python-copier-template to work. These are listed below.
4+
5+
## Discussions
6+
7+
The contributing guide for the template recommends that new users start a discussion for questions. You can enable this feature by navigating to your repository page and:
8+
9+
- Visiting `Settings` > `General`
10+
- Scrolling down to `Features`
11+
- Enabling it as shown
12+
13+
![Setup GitHub Features](../images/gh-features-setup.png)
14+
15+
## Branch protection
16+
17+
GitHub will prompt you that your `main` branch is not protected. It is recommended that a [branch protection rule](https://docs.github.com/en/repositories/configuring-branches-and-merges-in-your-repository/managing-protected-branches/managing-a-branch-protection-rule) is setup for `main` to require pull requests.
18+
19+
If the repository is in the `DiamondLightSource` org, then follow [the dev guide](https://dev-guide.diamond.ac.uk/version-control/how-tos/github-setup-prs/) to see the recommended settings.
20+
21+
## Code Coverage
22+
23+
To ensure that code coverage is correctly uploaded to codecov.io follow [](#installing-codecov-github-app)
24+
25+
## Renovate
26+
27+
To ensure that your dependencies are kept up to date follow [](./renovate.md)
28+
29+
## GitHub pages
30+
31+
If you configured the project to have sphinx docs then follow [](#building-docs-in-ci)
32+
33+
## PyPI uploading
34+
35+
If you configured the project to upload built wheels to PyPI then follow [](./pypi.md)

docs/images/gh-features-setup.png

120 KB
Loading

0 commit comments

Comments
 (0)