|
| 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 | +``` |
0 commit comments