Skip to content

Commit a94b398

Browse files
Create upgrade guide for Plone 6.2 backend. (#2002)
* Create upgrade guide for Plone 6.2 backend. * Apply suggestions from code review * More about namespaces. From PR review by Steve. --------- Co-authored-by: Steve Piercy <[email protected]>
1 parent 9804627 commit a94b398

File tree

4 files changed

+96
-0
lines changed

4 files changed

+96
-0
lines changed

docs/backend/upgrading/version-specific-migration/index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,5 +27,6 @@ upgrade-to-python3
2727
upgrade-zodb-to-python3
2828
upgrade-to-60
2929
upgrade-to-61
30+
upgrade-to-62
3031
migrate-to-volto
3132
```
Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
---
2+
myst:
3+
html_meta:
4+
"description": "How to upgrade to Plone 6.2"
5+
"property=og:description": "How to upgrade to Plone 6.2"
6+
"property=og:title": "How to upgrade to Plone 6.2"
7+
"keywords": "Upgrade, Plone 6"
8+
---
9+
10+
(backend-upgrade-plone-v62-label)=
11+
12+
# Upgrade Plone 6.1 to 6.2
13+
14+
Plone 6.2 has seen the following major changes.
15+
Some may require changes in your setup.
16+
17+
18+
## Move to native namespaces
19+
20+
Plone 6.2 has migrated all core Python packages from `pkg_resources`-style namespaces to native namespaces.
21+
22+
The Plone Python backend consists of over 200 packages.
23+
Most of these are namespace packages.
24+
Examples are `plone.batching` and `plone.api`, which share the `plone` namespace.
25+
26+
There are three styles or techniques of namespaces.
27+
For Plone only two are important: `pkg_resources` and native.
28+
The third style is `pkgutil`, but Plone has never used it.
29+
30+
Native namespaces are also referred to as implicit namespaces.
31+
The two terms mean the same.
32+
33+
```{seealso}
34+
- [Python Packaging Guide on native namespaces](https://packaging.python.org/en/latest/guides/.packaging-namespace-packages/#native-namespace-packages)
35+
- [PEP 420 - Implicit Namespace Packages](https://peps.python.org/pep-0420/)
36+
```
37+
38+
Native namespaces exist since Python 3.3.
39+
Because Plone started in the days of Python 2, it has always used `pkg_resources`.
40+
`pkg_resources` is part of the `setuptools` package.
41+
This part is deprecated.
42+
It's scheduled to be removed around the end of 2025, in `setuptools` 81.
43+
This means Plone needs to move to native namespaces.
44+
45+
In general, this move shouldn't cause problems for integrators.
46+
To install Plone 6.2 you can keep using the same version of `pip` (or `uv`), or `zc.buildout` as you do for Plone 6.1.
47+
This assumes that all packages within one namespace use the same namespace style or technique.
48+
49+
You may encounter problems when this assumption isn't true.
50+
As an example, say your Plone project uses a package `collective.example`, and this still uses `pkg_resources`-style namespaces.
51+
Plone itself depends on a package `collective.monkeypatcher` which is now using native namespaces.
52+
This may cause problems at startup, especially `ModuleNotFoundError`.
53+
In a normal install:
54+
55+
* `pip` works fine.
56+
* `zc.buildout` 4 won't work.
57+
* `zc.buildout` 5 works fine.
58+
59+
If for one or both of these packages you don't use a final release from https://pypi.org, but an editable install, it may not work.
60+
You can solve this by installing an extra package with `pip`, `horse-with-no-namespace`.
61+
62+
```{note}
63+
If you let `zc.buildout` install `horse-with-no-namespace`, it won't work.
64+
It really must be installed by `pip` into the same virtual environment where you have installed `zc.buildout`.
65+
```
66+
67+
The recommendation is to migrate all namespace packages to native namespaces.
68+
This includes the `collective` namespace that a lot of Plone add-ons use.
69+
This {doc}`guide </developer-guide/native-namespace>` describes the needed steps.
70+
71+
## Start separating Classic UI code from the core
72+
73+
In Plone 6, the Python backend includes the Classic UI frontend.
74+
You can't get one without the other.
75+
If you use the Volto frontend, this means that you get lots of code that you never use.
76+
77+
Plone 6.2 starts separating Classic UI code from the core of Plone.
78+
This is ongoing work, described in {term}`PLIP` [3953](https://github.com/plone/Products.CMFPlone/issues/3953).
79+
You won't yet get less code yet.
80+
This PLIP is preparation for a more complete separation in Plone 7.
81+
82+
The focus currently is on moving page templates into the `plone.app.layout` package.
83+
Templates from the following packages are now in a new location:
84+
85+
* `plone.locking`
86+
* `plone.protect`
87+
88+
```{note}
89+
If you use the `z3c.jbot` add-on to override a template that has been moved, your override will still work.
90+
This is because we keep a mapping from the old to the new location.
91+
For example, `plone.locking` registers that `plone.locking.browser.info.pt` has a new location, `plone.app.layout.viewlets.locking.pt`.
92+
You should rename your override to the new location if you no longer need compatibility with Plone 6.1 or earlier.
93+
```

docs/upgrade/index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ Plone has several components, each of which have their own upgrade guides:
1919

2020
For Plone 6 the most relevant guides are:
2121

22+
- {doc}`../backend/upgrading/version-specific-migration/upgrade-to-62`
2223
- {doc}`../backend/upgrading/version-specific-migration/upgrade-to-61`
2324
- {doc}`../backend/upgrading/version-specific-migration/upgrade-to-60`
2425
- {doc}`../backend/upgrading/version-specific-migration/migrate-to-volto`

styles/config/vocabularies/Plone/accept.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ jQuery
2828
libxslt
2929
middleware
3030
Mockup
31+
namespaces?
3132
npm
3233
nvm
3334
Pastanaga

0 commit comments

Comments
 (0)