Skip to content

Commit bde905b

Browse files
committed
- Repeat for source installation the same DRY, split of configuration and installation, and sync tabs as that for PyPI installation
1 parent 358fefc commit bde905b

1 file changed

Lines changed: 61 additions & 34 deletions

File tree

docs/admin-guide/add-ons.md

Lines changed: 61 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,15 @@ The Volto frontend has its own system of add-ons using Node.js packages.
1818
See {doc}`/volto/development/add-ons/index`.
1919
```
2020

21+
(install-an-add-on-from-pypi-label)=
22+
2123
## Install an add-on from PyPI
2224

2325
This section describes how to install an add-on that is released on {term}`PyPI`.
2426

2527

28+
(configure-add-on-installation-pypi-label)=
29+
2630
### Configure add-on installation
2731

2832
First, configure your project according to the instructions in the tabbed interface below.
@@ -89,6 +93,9 @@ You can control which version of an add-on to install through "version pinning."
8993
- Leave it off to always install the latest version.
9094
```
9195

96+
97+
(install-the-add-on-pypi-label)=
98+
9299
### Install the add-on
93100

94101
Stop the backend with {kbd}`ctrl-c`.
@@ -113,7 +120,7 @@ bin/buildout -N
113120
````
114121
`````
115122

116-
Finally, restart the backend.
123+
Next, restart the backend.
117124

118125
```{seealso}
119126
{doc}`run-plone`
@@ -130,18 +137,26 @@ At the bottom of the page, you should see the heading {guilabel}`Add-on Configur
130137

131138
## Install an add-on from source
132139

133-
An unreleased add-on can be installed from a source control system such as GitHub.
140+
This section describes how to install an unreleased add-on from a source control system, such as GitHub.
141+
134142

135-
For instructions to install an add-on that is released on {term}`PyPI`, select the tab below according to your Python package manager.
143+
(configure-add-on-installation-source-label)=
144+
145+
### Configure add-on installation
146+
147+
First, configure your project according to the instructions in the tabbed interface below.
148+
Select the tab according to your Python package manager.
136149

137150
```{tip}
138-
Select the tab for uv if you have a project that was created using Cookieplone, and you have `managed = true` set in the `[tool.uv]` section of the file {file}`backend/pyproject.toml`.
139-
Select the tab for pip if you have a project that was created using Cookieplone that does not have this setting.
151+
For projects created with Cookieplone, select either the tab labeled:
152+
153+
- {guilabel}`uv` if the file {file}`backend/pyproject.toml`, under the table `[tool.uv]` has the setting of `managed = true`
154+
- {guilabel}`pip` if your project doesn't have this setting
140155
```
141156

142157
`````{tab-set}
143-
144158
````{tab-item} uv
159+
:sync: uv
145160
146161
Clone the repository into a local directory.
147162
This example uses [`collective.easyform`](https://pypi.org/project/collective.easyform/).
@@ -157,22 +172,16 @@ cd backend
157172
uv add --editable ../collective.easyform
158173
```
159174
160-
```{note}
161-
When installing an add-on from source, it's best not to pin a version.
162-
This way you always get the version that's currently available in the source control system.
163-
```
164-
165-
Next add the add-on to `zcml_package_includes` in the file {file}`backend/instance.yaml` so that its configuration will load.
175+
To configure the add-on to load, in the file {file}`backend/instance.yaml`, under the key `default_context`, for the key `zcml_package_includes`, set its value to the add-on's name.
166176
167177
```yaml
168178
default_context:
169179
zcml_package_includes: project_title, collective.easyform
170180
```
171-
172-
Stop the backend with {kbd}`ctrl-c`.
173181
````
174182
175183
````{tab-item} pip
184+
:sync: pip
176185
177186
Add the name of your add-on in the file {file}`backend/pyproject.toml` in the section `dependencies`.
178187
This example adds [`collective.easyform`](https://pypi.org/project/collective.easyform/).
@@ -184,16 +193,11 @@ dependencies = [
184193
"plone.api",
185194
"plone.classicui",
186195
"plone.app.caching",
187-
"collective.easyform==4.5.1",
196+
"collective.easyform",
188197
]
189198
```
190199
191-
```{note}
192-
When installing an add-on from source, it's best not to pin a version.
193-
This way you always get the version that's currently available in the source control system.
194-
```
195-
196-
Next add the add-on to `zcml_package_includes` in the file {file}`backend/instance.yaml` so that its configuration will load.
200+
To configure the add-on to load, in the file {file}`backend/instance.yaml`, under the key `default_context`, for the key `zcml_package_includes`, set its value to the add-on's name.
197201
198202
```yaml
199203
default_context:
@@ -213,18 +217,10 @@ extras=test
213217
The {file}`mx.ini` file configures a tool called {term}`mxdev`.
214218
For an explanation of why Plone uses `mxdev`, see {ref}`manage-packages-mxdev-label`.
215219
```
216-
217-
Stop the backend with {kbd}`ctrl-c`.
218-
219-
To actually download and install the new add-on, run the following command.
220-
221-
```shell
222-
make backend-build
223-
```
224-
225220
````
226221
227222
````{tab-item} Buildout
223+
:sync: buildout
228224
229225
Update the file {file}`buildout.cfg`.
230226
This example uses [`collective.easyform`](https://pypi.org/project/collective.easyform/).
@@ -251,22 +247,53 @@ eggs =
251247
[sources]
252248
collective.easyform = git https://github.com/collective/collective.easyform.git
253249
```
250+
````
251+
`````
252+
253+
```{tip}
254+
When installing an add-on from source, it's best not to pin a version.
255+
This way you always get the version that's currently available in the source control system.
256+
```
257+
258+
259+
(install-the-add-on-source-label)=
260+
261+
### Install the add-on
262+
263+
Stop the backend with {kbd}`ctrl-c`.
254264

255265
To actually download and install the new add-on, run the following command.
256266

267+
`````{tab-set}
268+
````{tab-item} uv
269+
:sync: uv
270+
257271
```shell
258-
bin/buildout
272+
make backend-build
259273
```
274+
````
275+
276+
````{tab-item} pip
277+
:sync: pip
278+
279+
```shell
280+
make backend-build
281+
```
282+
````
260283
284+
````{tab-item} Buildout
285+
:sync: buildout
286+
287+
```shell
288+
bin/buildout
289+
```
261290
```{seealso}
262291
This approach uses the [`mr.developer`](https://pypi.org/project/mr.developer/) Buildout extension.
263292
```
264-
265293
````
266-
267294
`````
268295

269-
Now restart the backend.
296+
Next, restart the backend.
270297

271298
```{seealso}
272299
{doc}`run-plone`

0 commit comments

Comments
 (0)