Skip to content

Commit 178f754

Browse files
authored
Merge pull request #2072 from plone/uv-managed
Update docs to cover uv managed installations
2 parents bcd0667 + 16cd84f commit 178f754

9 files changed

Lines changed: 369 additions & 190 deletions

File tree

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
In your web browser, and assuming you are currently logged in as an administrator, visit the URL http://localhost:8080/Plone/prefs_install_products_form.
2+
3+
Then click the {guilabel}`Install` button next to your add-on to complete installation of the add-on.
4+
5+
Some add-ons have configuration options.
6+
To configure such add-ons, return to the {guilabel}`Site Setup` control panel.
7+
At the bottom of the page, you should see the heading {guilabel}`Add-on Configuration`, and a control panel to configure the add-on that you just installed.

docs/_inc/_build-and-restart.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
If the backend is running, stop it with {kbd}`ctrl-c`.
2+
3+
To actually download and install the package, run the following command.
4+
5+
`````{tab-set}
6+
````{tab-item} uv
7+
:sync: uv
8+
9+
```shell
10+
make backend-build
11+
```
12+
````
13+
14+
````{tab-item} pip
15+
:sync: pip
16+
17+
```shell
18+
make backend-build
19+
```
20+
````
21+
22+
````{tab-item} Buildout
23+
:sync: buildout
24+
25+
```shell
26+
bin/buildout -N
27+
```
28+
````
29+
`````
30+
31+
Next, restart the backend.
32+
33+
```{seealso}
34+
{doc}`run-plone`
35+
```

docs/admin-guide/add-ons.md

Lines changed: 142 additions & 97 deletions
Original file line numberDiff line numberDiff line change
@@ -18,168 +18,206 @@ 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)=
2122

22-
## Cookieplone
23+
## Install an add-on from PyPI
2324

24-
Use the following instructions if you installed Plone with Cookieplone.
25+
This section describes how to install an add-on that is released on {term}`PyPI`.
2526

2627

27-
### Install an add-on
28+
(configure-add-on-installation-pypi-label)=
29+
30+
### Configure add-on installation
31+
32+
First, configure your project according to the instructions in the tabbed interface below.
33+
Select the tab according to the method you used to create your project.
34+
35+
`````{tab-set}
36+
````{tab-item} Cookieplone
37+
:sync: cookieplone
2838
2939
Add the name of your add-on in the file {file}`backend/pyproject.toml` in the section `dependencies`.
3040
This example adds [`collective.easyform`](https://pypi.org/project/collective.easyform/).
3141
3242
```{code-block} toml
3343
:emphasize-lines: 6
3444
dependencies = [
35-
"Products.CMFPlone==6.1.1",
45+
"Products.CMFPlone==6.1.4",
3646
"plone.api",
3747
"plone.classicui",
3848
"plone.app.caching",
39-
"collective.easyform==4.4.0",
49+
"collective.easyform==4.5.1",
4050
]
4151
```
4252
43-
```{tip}
44-
Including the add-on version, or "pinning a version", ensures that it won't unintentionally get upgraded in the future.
45-
```
46-
47-
Also add the add-on to `zcml_package_includes` in the file {file}`backend/instance.yaml` to make sure its configuration will be loaded.
53+
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.
4854
4955
```yaml
5056
default_context:
5157
zcml_package_includes: project_title, collective.easyform
5258
```
59+
````
5360
54-
Stop the backend with {kbd}`ctrl-c`.
61+
````{tab-item} Buildout
62+
:sync: buildout
5563
56-
To actually download and install the new add-on, run the following command.
64+
Update the file {file}`buildout.cfg`.
65+
This example uses [`collective.easyform`](https://pypi.org/project/collective.easyform/).
5766
58-
```shell
59-
make backend-build
60-
```
67+
```cfg
68+
[buildout]
69+
extends =
70+
https://dist.plone.org/release/6-latest/versions.cfg
6171
62-
Now restart the backend.
72+
parts =
73+
instance
6374
64-
```{seealso}
65-
{doc}`run-plone`
75+
[instance]
76+
recipe = plone.recipe.zope2instance
77+
user = admin:admin
78+
http-address = 8080
79+
eggs =
80+
Plone
81+
collective.easyform
82+
83+
[versions]
84+
collective.easyform = 4.5.1
6685
```
86+
````
87+
`````
6788

68-
In your web browser, and assuming you are currently logged in as an administrator, visit the URL http://localhost:8080/Plone/prefs_install_products_form.
89+
```{tip}
90+
You can control which version of an add-on to install through "version pinning."
6991
70-
Then click the {guilabel}`Install` button next to your add-on to complete installation of the add-on.
92+
- Specify the add-on version to avoid its unintentional upgrade.
93+
- Leave it off to always install the latest version.
94+
```
7195

72-
Some add-ons have configuration options.
73-
To configure such add-ons, return to the {guilabel}`Site Setup` control panel.
74-
At the bottom of the page, you should see the heading {guilabel}`Add-on Configuration`, and a control panel to configure the add-on that you just installed.
7596

97+
(install-the-add-on-pypi-label)=
7698

77-
### Install an add-on from source
99+
### Install the add-on
78100

79-
An add-on can be installed from a source control system such as GitHub.
101+
If the backend is running, stop it with {kbd}`ctrl-c`.
80102

81-
Add a line with the name of your add-on in the file {file}`backend/requirements.txt`.
82-
This example uses [`collective.easyform`](https://pypi.org/project/collective.easyform/).
103+
To actually download and install the new add-on, run the following command.
83104

84-
```
85-
collective.easyform
86-
```
105+
`````{tab-set}
106+
````{tab-item} Cookieplone
107+
:sync: cookieplone
87108
88-
```{note}
89-
When installing an add-on from source, it's best not to pin a version.
90-
This way you always get the version that's currently available in the source control system.
109+
```shell
110+
make backend-build
91111
```
112+
````
92113
93-
Next add the add-on to `zcml_package_includes` in the file {file}`backend/instance.yaml` so that its configuration will load.
114+
````{tab-item} Buildout
115+
:sync: buildout
94116
95-
```yaml
96-
default_context:
97-
zcml_package_includes: project_title, collective.easyform
117+
```shell
118+
bin/buildout -N
98119
```
120+
````
121+
`````
99122

100-
Finally, add the package's source to the file {file}`mx.ini`.
123+
Next, restart the backend.
101124

102-
```cfg
103-
[collective.easyform]
104-
url=git@github.com:collective/collective.easyform.git
105-
branch=dev-branch-name
106-
extras=test
125+
```{seealso}
126+
{doc}`run-plone`
107127
```
108128

109-
```{seealso}
110-
The {file}`mx.ini` file configures a tool called {term}`mxdev`.
111-
See the [documentation of `mxdev` in its README.md](https://github.com/mxstack/mxdev/blob/main/README.md) for complete information.
129+
```{include} /_inc/_add-on-complete-install.md
112130
```
113131

114-
Stop the backend with {kbd}`ctrl-c`.
115132

116-
To actually download and install the new add-on, run the following command.
133+
(install-an-add-on-from-source-label)=
117134

118-
```shell
119-
make backend-build
120-
```
135+
## Install an add-on from source
121136

122-
Now restart the backend.
137+
This section describes how to install an unreleased add-on from a source control system, such as GitHub.
123138

124-
```{seealso}
125-
{doc}`run-plone`
126-
```
127139

128-
In your web browser, and assuming you are currently logged in as an administrator, visit the URL http://localhost:8080/Plone/prefs_install_products_form.
129-
An upgrade step might need to be performed in the Plone control panel.
130-
Follow the upgrade information, if present.
131-
Else click the {guilabel}`Install` button to complete installation of the add-on.
140+
(configure-add-on-installation-source-label)=
132141

142+
### Configure add-on installation
133143

134-
## Buildout
144+
First, configure your project according to the instructions in the tabbed interface below.
145+
Select the tab according to your Python package manager.
135146

136-
Use the following instructions if you installed Plone with Buildout.
147+
```{tip}
148+
For projects created with Cookieplone, select the tab labeled:
137149
138-
### Install an add-on
150+
- {guilabel}`pip` if your project has the file {file}`backend/mx.ini`
151+
- {guilabel}`uv` if your project doesn't have this file
152+
```
139153

140-
Update the file {file}`buildout.cfg`.
141-
This example uses [`collective.easyform`](https://pypi.org/project/collective.easyform/).
154+
`````{tab-set}
155+
````{tab-item} uv
156+
:sync: uv
142157
143-
```cfg
144-
[buildout]
145-
extends =
146-
https://dist.plone.org/release/6-latest/versions.cfg
158+
Clone the repository into a local directory.
159+
This example uses [`collective.easyform`](https://pypi.org/project/collective.easyform/).
147160
148-
parts =
149-
instance
161+
```shell
162+
git clone git@github.com:collective/collective.easyform.git
163+
```
150164
151-
[instance]
152-
recipe = plone.recipe.zope2instance
153-
user = admin:admin
154-
http-address = 8080
155-
eggs =
156-
Plone
157-
collective.easyform
165+
Add the local directory to your uv project as an editable package.
158166
159-
[versions]
160-
collective.easyform = 4.2.1
167+
```shell
168+
cd backend
169+
uv add --editable ../collective.easyform
161170
```
162171
163-
```{tip}
164-
Including the add-on version, or "pinning a version", ensures that it won't unintentionally get upgraded in the future.
172+
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.
173+
174+
```yaml
175+
default_context:
176+
zcml_package_includes: project_title, collective.easyform
165177
```
178+
````
166179
167-
To actually download and install the new add-on, run the following command.
180+
````{tab-item} pip
181+
:sync: pip
168182
169-
```shell
170-
bin/buildout
183+
Add the name of your add-on in the file {file}`backend/pyproject.toml` in the section `dependencies`.
184+
This example adds [`collective.easyform`](https://pypi.org/project/collective.easyform/).
185+
186+
```{code-block} toml
187+
:emphasize-lines: 6
188+
dependencies = [
189+
"Products.CMFPlone==6.1.4",
190+
"plone.api",
191+
"plone.classicui",
192+
"plone.app.caching",
193+
"collective.easyform",
194+
]
171195
```
172196
173-
Then restart your instance.
197+
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.
174198
175-
```{seealso}
176-
{doc}`run-plone`
199+
```yaml
200+
default_context:
201+
zcml_package_includes: project_title, collective.easyform
177202
```
178203
204+
Finally, add the package's source to the file {file}`mx.ini`.
205+
206+
```cfg
207+
[collective.easyform]
208+
url=git@github.com:collective/collective.easyform.git
209+
branch=dev-branch-name
210+
extras=test
211+
```
179212
180-
### Install an add-on from source
213+
```{seealso}
214+
The {file}`mx.ini` file configures a tool called {term}`mxdev`.
215+
For an explanation of why Plone uses mxdev, see {ref}`manage-packages-mxdev-label`.
216+
```
217+
````
181218
182-
You can install an add-on from a source control system such as GitHub.
219+
````{tab-item} Buildout
220+
:sync: buildout
183221
184222
Update the file {file}`buildout.cfg`.
185223
This example uses [`collective.easyform`](https://pypi.org/project/collective.easyform/).
@@ -207,18 +245,25 @@ eggs =
207245
collective.easyform = git https://github.com/collective/collective.easyform.git
208246
```
209247
210-
To actually download and install the new add-on, run the following command.
248+
```{seealso}
249+
This approach uses the [`mr.developer`](https://pypi.org/project/mr.developer/) Buildout extension.
250+
```
211251
212-
```shell
213-
bin/buildout
252+
````
253+
`````
254+
255+
```{tip}
256+
When installing an add-on from source, it's best not to pin a version.
257+
This way you always get the version that's currently available in the source control system.
214258
```
215259

216-
Then restart your instance.
217260

218-
```{seealso}
219-
{doc}`run-plone`
261+
(install-the-add-on-source-label)=
262+
263+
### Install the add-on
264+
265+
```{include} /_inc/_build-and-restart.md
220266
```
221267

222-
```{seealso}
223-
This approach uses the [`mr.developer`](https://pypi.org/project/mr.developer/) Buildout extension.
268+
```{include} /_inc/_add-on-complete-install.md
224269
```

0 commit comments

Comments
 (0)