Skip to content

Commit 5f879e6

Browse files
authored
Overhaul Manage Add-ons and Packages (#1724)
* Overhaul Manage Add-ons and Packages - Create a new Diataxis explanation section, Conceptual guides. - Create a new section, Manage Plone, and pages for frontend and backend. - Move bits from manage-add-ons-packages.md into appropriate files * Add a redirect * Move cookiecutter info to Glossary * Move Configuration with `cookiecutter-zope-instance` to manage/backend.md * Remove manage-add-ons-packages.md
1 parent 36e1a44 commit 5f879e6

File tree

11 files changed

+212
-125
lines changed

11 files changed

+212
-125
lines changed
51 KB
Loading

docs/conceptual-guides/index.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
---
2+
myst:
3+
html_meta:
4+
"description": "Conceptual guides provide explanation of concepts to deepen and broaden your understanding of Plone."
5+
"property=og:description": "Conceptual guides provide explanation of concepts to deepen and broaden your understanding of Plone."
6+
"property=og:title": "Conceptual guides"
7+
"keywords": "Plone 6, Conceptual guides"
8+
---
9+
10+
# Conceptual guides
11+
12+
This part of the documentation provides explanation of concepts to deepen and broaden your understanding of Plone.
13+
14+
15+
```{toctree}
16+
:maxdepth: 2
17+
18+
package-management
19+
make-build-backend-walk-through
20+
```
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
---
2+
myst:
3+
html_meta:
4+
"description": "make build-backend in Plone."
5+
"property=og:description": "make build-backend in Plone."
6+
"property=og:title": "make build-backend details"
7+
"keywords": "Plone 6, make, build-backend"
8+
---
9+
10+
(make-build-backend-details-label)=
11+
12+
# `make build-backend` details
13+
14+
This chapter assumes you have previously followed {doc}`/install/create-project`.
15+
16+
The `Makefile` at the root of your project invokes commands in `backend/Makefile`.
17+
Here are excerpts from `backend/Makefile` to show details of the `make build-backend` command.
18+
19+
```makefile
20+
bin/pip:
21+
@echo "$(GREEN)==> Setup Virtual Env$(RESET)"
22+
python3 -m venv .
23+
bin/pip install -U "pip" "wheel" "cookiecutter" "mxdev"
24+
25+
instance/etc/zope.ini: bin/pip
26+
@echo "$(GREEN)==> Install Plone and create instance$(RESET)"
27+
bin/cookiecutter -f --no-input --config-file instance.yaml https://github.com/plone/cookiecutter-zope-instance
28+
mkdir -p var/{filestorage,blobstorage,cache,log}
29+
30+
# ...
31+
32+
.PHONY: build-dev
33+
build-dev: instance/etc/zope.ini ## pip install Plone packages
34+
@echo "$(GREEN)==> Setup Build$(RESET)"
35+
bin/mxdev -c mx.ini
36+
bin/pip install -r requirements-mxdev.txt
37+
```
38+
39+
The command `make build-backend`:
40+
41+
- Invokes the target `build-dev` target in `backend/Makefile`.
42+
- This invokes the target `instance/etc/zope.ini`.
43+
- This invokes the target `bin/pip`.
44+
45+
- This creates a `Python` virtual environment if one does not exist.
46+
- It installs and upgrades Python package management tools in that virtual environment.
47+
48+
- Returning to the target `instance/etc/zope.ini`:
49+
50+
- This creates or updates the Zope configuration from its `instance.yaml` file using `cookiecutter-zope-instance`.
51+
- Creates specified directories, if they do not exist.
52+
53+
- Returning to the target `build-dev`:
54+
55+
- This generates the `mxdev` files as described above in {ref}`manage-mxdev-usage-overview-label`.
56+
- Installs Plone core packages and add-ons from the files generated by `mxdev`.
57+
58+
You can configure your Zope instance as described in the section {ref}`manage-common-management-tasks-label`.
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
---
2+
myst:
3+
html_meta:
4+
"description": "Package management in Plone."
5+
"property=og:description": "Package management in Plone."
6+
"property=og:title": "Package management"
7+
"keywords": "Plone 6, package management, mxdev"
8+
---
9+
10+
# Package management
11+
12+
Plone 6 consists of a collection of Python and Node.js packages.
13+
Over the decades of its existence, Plone has used several package management tools, sometimes multiple tools at one time.
14+
Each one has its strengths and weaknesses for performing specific tasks, such as installation, conflict resolution, updates and upgrades, and working with virtual environments and across platforms.
15+
16+
With Volto as the default frontend in Plone 6, first npm, then pnpm, was brought into the mix as a package manager for its Node.js packages.
17+
18+
Python itself has a complex and convoluted history with package management, as [xkcd](https://xkcd.com/1987/) illustrates.
19+
20+
```{image} /_static/conceptual-guides/xkcd-1987-python-environment.png
21+
:alt: A comic from xkcd entitled Python Environment
22+
:class: figure
23+
:target: https://xkcd.com/1987/
24+
```
25+
26+
27+
(manage-backend-python-packages-label)=
28+
29+
## Manage backend Python packages
30+
31+
If you want to check out a Plone core package for development, or want to override the constraints of Plone, normally you would define constraints with a file {file}`constraints.txt` to tell `pip` to install a different version of a Plone package.
32+
33+
```text
34+
# constraints.txt with unresolvable version conflict
35+
-c https://dist.plone.org/release/{PLONE_BACKEND_PATCH_VERSION}/constraints.txt
36+
plone.api>=2.0.0a3
37+
```
38+
39+
Unfortunately `pip` does not allow overriding constraints this way.
40+
{term}`mxdev` solves this issue.
41+
42+
43+
### `mxdev` to the rescue!
44+
45+
`mxdev` resolves Plone constraints according to your needs for pinning versions or source checkouts.
46+
It reads its configuration file {file}`mx.ini`, and your {file}`requirements.txt` and {file}`constraints.txt` files.
47+
Then it fetches the requirements and constraints of Plone.
48+
Finally, it writes new combined requirements in {file}`requirements-mxdev.txt` and new constraints in {file}`constraints-mxdev.txt`.
49+
Together these two files contain the combined requirements and constraints, but modified according to the configuration in {file}`mx.ini`.
50+
The generated files indicate from where the constraints were fetched, and comments are added when a modification was necessary.
51+
52+
`mxdev` does not run `pip` or install packages.
53+
You or your development tools, such as GNU Make, must perform that step.
54+
55+
```{seealso}
56+
{doc}`/manage/backend`
57+
```
58+
59+
60+
## Manage frontend Node.js packages
61+
62+
```{todo}
63+
Why do we use pnpm?
64+
```

docs/conf.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,7 @@
245245
"contributing/plone-restapi": "/plone.restapi/docs/source/contributing/index.html",
246246
"contributing/volto": "/volto/contributing/index.html",
247247
"install/install-from-packages": "/install/create-project.html",
248+
"manage/frontend": "/volto/addons/index.html",
248249
}
249250

250251

docs/glossary.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,9 @@ plone/generator-volto
4848
See {ref}`upgrade-18-cookieplone-label`.
4949
5050
cookiecutter-plone-starter
51-
[cookiecutter-plone-starter](https://github.com/collective/cookiecutter-plone-starter/) is a framework for jumpstarting Plone 6 projects quickly.
51+
[cookiecutter-plone-starter](https://github.com/collective/cookiecutter-plone-starter/) creates a Plone project that you can install using {term}`Make`.
52+
It generates files for installing and configuring both the frontend and backend.
53+
For the backend, it uses {term}`cookiecutter-zope-instance` to generate configuration files for a Zope WSGI instance.
5254
5355
cookiecutter-zope-instance
5456
[cookiecutter-zope-instance](https://github.com/plone/cookiecutter-zope-instance) is a cookiecutter template to create a full and complex configuration of a Zope WSGI instance.

docs/index.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,15 @@ Read the [documentation for the previous version, Plone 5](https://5.docs.plone.
3232
3333
overview/index
3434
install/index
35+
manage/index
3536
upgrade/index
3637
deployment/index
3738
volto/index
3839
plone.restapi/docs/source/index
3940
backend/index
4041
classic-ui/index
4142
i18n-l10n/index
43+
conceptual-guides/index
4244
contributing/index
4345
```
4446

docs/install/index.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,5 @@ Choose a version to demo.
5555
create-project
5656
create-project-classic-ui
5757
create-project-cookieplone
58-
manage-add-ons-packages
5958
containers/index
6059
```

docs/install/manage-add-ons-packages.md renamed to docs/manage/backend.md

Lines changed: 26 additions & 123 deletions
Original file line numberDiff line numberDiff line change
@@ -1,90 +1,30 @@
11
---
22
myst:
33
html_meta:
4-
"description": "Manage add-ons, packages, and processes"
5-
"property=og:description": "Manage add-ons, packages, and processes"
6-
"property=og:title": "Manage add-ons, packages, and processes"
7-
"keywords": "Plone 6, manage, backend, add-ons, packages, processes, cookiecutter, Zope"
4+
"description": "Manage Plone backend"
5+
"property=og:description": "Manage Plone backend"
6+
"property=og:title": "Manage Plone backend"
7+
"keywords": "Plone 6, manage, backend, add-ons, packages, mxdev"
88
---
99

10+
(manage-plone-backend-label)=
1011

11-
(manage-add-ons-packages-and-processes-label)=
12+
# Manage Plone backend
1213

13-
# Manage add-ons and packages
14+
This part of the documentation describes how to perform common management tasks in the Plone backend.
15+
This chapter assumes you have previously followed {doc}`/install/create-project`.
1416

15-
This chapter assumes you have previously followed {doc}`create-project`.
16-
In this section, we discuss details of the installation process so that you can customize your Plone installation.
17-
It also covers routine management tasks that a developer might perform.
1817

18+
## Manage add-ons and packages
1919

20-
(manage-installation-details-with-cookiecutter-label)=
21-
22-
## Installation details with Cookiecutter
23-
24-
{term}`Cookiecutter` creates projects from project templates.
25-
The cookiecutter [`cookiecutter-plone-starter`](https://github.com/collective/cookiecutter-plone-starter/) creates a Plone project that you can install using {term}`Make`.
26-
It generates files for installing and configuring both the frontend and backend.
27-
For the backend, it uses [`cookiecutter-zope-instance`](https://github.com/plone/cookiecutter-zope-instance) to generate configuration files for a Zope WSGI instance.
28-
29-
30-
(manage-configuration-with-cookiecutter-zope-instance-label)=
31-
32-
## Configuration with `cookiecutter-zope-instance`
33-
34-
You can configure your instance's options, including the following.
35-
36-
- persistent storage: blobs, direct filestorage, relational database, ZEO, and so on
37-
- ports
38-
- threads
39-
- cache
40-
- debugging and profiling for development
20+
Plone uses `mxdev` to manage packages and constraints.
4121

4222
```{seealso}
43-
For a complete list of features, usage, and options, read [`cookiecutter-zope-instance`'s `README.rst`](https://github.com/plone/cookiecutter-zope-instance#readme).
23+
For an explanation of why Plone uses `mxdev`, see {ref}`manage-backend-python-packages-label`.
4424
```
4525

4626

47-
(manage-plone-backend-packages-with-mxdev-label)=
48-
49-
## Manage Plone backend packages with `mxdev`
50-
51-
This section describes how to manage packages for the Plone backend with `mxdev`.
52-
53-
For developing add-ons for the Plone frontend, Volto, see {doc}`volto/addons/index`.
54-
55-
56-
(manage-the-problem-with-pip-label)=
57-
58-
### The problem with `pip`
59-
60-
If you want to check out a Plone core package for development, or want to override the constraints of Plone, normally you would define constraints with a file {file}`constraints.txt` to tell `pip` to install a different version of a Plone package.
61-
62-
```
63-
# constraints.txt with unresolvable version conflict
64-
-c https://dist.plone.org/release/{PLONE_BACKEND_PATCH_VERSION}/constraints.txt
65-
plone.api>=2.0.0a3
66-
```
67-
68-
Unfortunately `pip` does not allow overriding constraints this way.
69-
{term}`mxdev` solves this issue.
70-
71-
72-
(manage-mxdev-to-the-rescue-label)=
73-
74-
### `mxdev` to the rescue!
75-
76-
`mxdev` resolves Plone constraints according to your needs for version pinning or source checkouts.
77-
It reads its configuration file {file}`mx.ini`, and your {file}`requirements.txt` and {file}`constraints.txt` files.
78-
Then it fetches the requirements and constraints of Plone.
79-
Finally, it writes new combined requirements in {file}`requirements-mxdev.txt` and new constraints in {file}`constraints-mxdev.txt`.
80-
Together these two files contain the combined requirements and constraints, but modified according to the configuration in {file}`mx.ini`.
81-
The generated files indicate from where the constraints were fetched, and comments are added when a modification was necessary.
82-
83-
`mxdev` does not run `pip` or install packages.
84-
You must perform that step.
85-
86-
87-
(manage-mxdev-usage-overview-label)=
27+
(mxdev-usage-overview-label)=
8828

8929
### `mxdev` usage overview
9030

@@ -140,7 +80,7 @@ make build-backend
14080
`make build-backend` invokes `mxdev`, which generates the files {file}`requirements-mxdev.txt` and {file}`constraints-mxdev.txt`.
14181
It then invokes `pip` to install packages with the new requirements file.
14282

143-
To reload the packages, stop your Zope instance/Plone site with {kbd}`ctrl-c`, and start it with the following command.
83+
To reload the packages, stop your Plone site with {kbd}`ctrl-c`, and start it with the following command.
14484

14585
```shell
14686
make start-backend
@@ -151,15 +91,6 @@ See the [documentation of `mxdev` in its README.md](https://github.com/mxstack/m
15191
```
15292

15393

154-
(manage-common-management-tasks-label)=
155-
156-
## Common management tasks
157-
158-
This section provides examples of common add-on and package management tasks.
159-
For the examples, we will modify the default files from the previous section {ref}`manage-mxdev-usage-overview-label`.
160-
We will also use Classic UI for the interface because some packages and add-ons have not yet been updated to work with the new frontend.
161-
162-
16394
(manage-add-an-add-on)=
16495

16596
### Add an add-on
@@ -346,51 +277,23 @@ In a web browser, visit http://localhost:8080/ to see that Plone is running.
346277

347278
Your instance is running in the foreground.
348279

349-
350-
(manage-installation-details-label)=
351-
352-
## Backend installation details
353-
354-
The `Makefile` at the root of your project invokes commands in `backend/Makefile`.
355-
Here are excerpts from `backend/Makefile` to show details of the `make build-backend` command.
356-
357-
```makefile
358-
bin/pip:
359-
@echo "$(GREEN)==> Setup Virtual Env$(RESET)"
360-
python3 -m venv .
361-
bin/pip install -U "pip" "wheel" "cookiecutter" "mxdev"
362-
363-
instance/etc/zope.ini: bin/pip
364-
@echo "$(GREEN)==> Install Plone and create instance$(RESET)"
365-
bin/cookiecutter -f --no-input --config-file instance.yaml https://github.com/plone/cookiecutter-zope-instance
366-
mkdir -p var/{filestorage,blobstorage,cache,log}
367-
368-
# ...
369-
370-
.PHONY: build-dev
371-
build-dev: instance/etc/zope.ini ## pip install Plone packages
372-
@echo "$(GREEN)==> Setup Build$(RESET)"
373-
bin/mxdev -c mx.ini
374-
bin/pip install -r requirements-mxdev.txt
280+
```{seealso}
281+
For an explanation of the command `make build-backend`, see {doc}`/conceptual-guides/make-build-backend-walk-through`.
375282
```
376283

377-
The command `make build-backend`:
378-
379-
- Invokes the target `build-dev` target in `backend/Makefile`.
380-
- This invokes the target `instance/etc/zope.ini`.
381-
- This invokes the target `bin/pip`.
382-
383-
- This creates a `Python` virtual environment if one does not exist.
384-
- It installs and upgrades Python package management tools in that virtual environment.
385284

386-
- Returning to the target `instance/etc/zope.ini`:
285+
(manage-configuration-with-cookiecutter-zope-instance-label)=
387286

388-
- This creates or updates the Zope configuration from its `instance.yaml` file using `cookiecutter-zope-instance`.
389-
- Creates specified directories, if they do not exist.
287+
## Configuration with `cookiecutter-zope-instance`
390288

391-
- Returning to the target `build-dev`:
289+
You can configure your instance's options, including the following.
392290

393-
- This generates the `mxdev` files as described above in {ref}`manage-mxdev-usage-overview-label`.
394-
- Installs Plone core packages and add-ons from the files generated by `mxdev`.
291+
- persistent storage: blobs, direct filestorage, relational database, ZEO, and so on
292+
- ports
293+
- threads
294+
- cache
295+
- debugging and profiling for development
395296

396-
You can configure your Zope instance as described in the section {ref}`manage-common-management-tasks-label`.
297+
```{seealso}
298+
For a complete list of features, usage, and options, read [`cookiecutter-zope-instance`'s `README.rst`](https://github.com/plone/cookiecutter-zope-instance#readme).
299+
```

docs/manage/frontend.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
---
2+
myst:
3+
html_meta:
4+
"description": "Manage Plone frontend"
5+
"property=og:description": "Manage Plone frontend"
6+
"property=og:title": "Manage Plone frontend"
7+
"keywords": "Plone 6, manage, frontend, add-ons, packages"
8+
---
9+
10+
(manage-plone-frontend-label)=
11+
12+
# Manage Plone frontend
13+
14+
This part of the documentation describes how to perform common management tasks in the Plone frontend.
15+
16+
```{seealso}
17+
{doc}`/volto/addons/index`
18+
```

0 commit comments

Comments
 (0)