|
| 1 | +--- |
| 2 | +myst: |
| 3 | + html_meta: |
| 4 | + "description": "Override core Plone packages" |
| 5 | + "property=og:description": "Override core Plone packages" |
| 6 | + "property=og:title": "Override core Plone packages" |
| 7 | + "keywords": "Plone 6, core, package, version, override" |
| 8 | +--- |
| 9 | + |
| 10 | +(override-core-plone-packages-label)= |
| 11 | + |
| 12 | +# Override core Plone packages |
| 13 | + |
| 14 | +Plone includes a lot of Python packages. |
| 15 | +Sometimes it is necessary to override one or more package versions in order to fix a bug. |
| 16 | + |
| 17 | + |
| 18 | +## with Cookieplone |
| 19 | + |
| 20 | +Use the following instructions if you installed Plone with Cookieplone or `cookiecutter-plone-starter`. |
| 21 | + |
| 22 | +### Override a core Plone package |
| 23 | + |
| 24 | +Add a version override to {file}`mx.ini`. |
| 25 | +This example uses `plone.api`. |
| 26 | + |
| 27 | +``` |
| 28 | +[settings] |
| 29 | +version-overrides = |
| 30 | + plone.api==2.0.0a3 |
| 31 | +``` |
| 32 | + |
| 33 | +```{seealso} |
| 34 | +The {file}`mx.ini` file configures a tool called {term}`mxdev`. |
| 35 | +For an explanation of why Plone uses `mxdev`, see {ref}`manage-backend-python-packages-label`. |
| 36 | +``` |
| 37 | + |
| 38 | +Stop the backend with {kbd}`ctrl-c`. |
| 39 | + |
| 40 | +To actually download and install the new package version, run: |
| 41 | + |
| 42 | +```shell |
| 43 | +make backend-build |
| 44 | +``` |
| 45 | + |
| 46 | +```{note} |
| 47 | +If you installed Plone using `cookiecutter-plone-starter`, run `make build-backend` instead.` |
| 48 | +``` |
| 49 | + |
| 50 | +Now restart the backend. |
| 51 | + |
| 52 | + |
| 53 | +### Install a core Plone package from source |
| 54 | + |
| 55 | +`mxdev` can also be used to install core Plone packages from a source control system such as GitHub. |
| 56 | + |
| 57 | +Add the Plone package you want to check out in {file}`mx.ini`. |
| 58 | +This example uses `plone.restapi`. |
| 59 | + |
| 60 | +```cfg |
| 61 | +[plone.restapi] |
| 62 | +url = git@github.com:plone/plone.restapi.git |
| 63 | +branch = main |
| 64 | +extras = test |
| 65 | +``` |
| 66 | + |
| 67 | +Stop the backend with {kbd}`ctrl-c`. |
| 68 | + |
| 69 | +To actually download and install the new package version, run: |
| 70 | + |
| 71 | +```shell |
| 72 | +make backend-build |
| 73 | +``` |
| 74 | + |
| 75 | +```{note} |
| 76 | +If you installed Plone using `cookiecutter-plone-starter`, run `make build-backend` instead.` |
| 77 | +``` |
| 78 | + |
| 79 | +Now restart the backend. |
| 80 | + |
| 81 | + |
| 82 | +## with Buildout |
| 83 | + |
| 84 | +Use the following instructions if you installed Plone with Buildout. |
| 85 | + |
| 86 | +### Override a core Plone package |
| 87 | + |
| 88 | +Update {file}`buildout.cfg`. |
| 89 | +This example uses `plone.api`. |
| 90 | + |
| 91 | +```cfg |
| 92 | +[buildout] |
| 93 | +extends = |
| 94 | + https://dist.plone.org/release/6-latest/versions.cfg |
| 95 | +
|
| 96 | +parts = |
| 97 | + instance |
| 98 | +
|
| 99 | +[instance] |
| 100 | +recipe = plone.recipe.zope2instance |
| 101 | +user = admin:admin |
| 102 | +http-address = 8080 |
| 103 | +eggs = |
| 104 | + Plone |
| 105 | +
|
| 106 | +[versions] |
| 107 | +plone.api = 2.0.0a3 |
| 108 | +``` |
| 109 | + |
| 110 | +```{note} |
| 111 | +The version pins specified in the `[versions]` section will take precedence over the pins inherited from `https://dist.plone.org/release/6-latest/versions.cfg`. |
| 112 | +``` |
| 113 | + |
| 114 | +To actually download and install the new package version, run: |
| 115 | + |
| 116 | +```shell |
| 117 | +bin/buildout |
| 118 | +``` |
| 119 | + |
| 120 | +Then restart your instance. |
| 121 | + |
| 122 | + |
| 123 | +### Install a core Plone package from source |
| 124 | + |
| 125 | +A core Plone package can be installed from a source control system such as GitHub. |
| 126 | + |
| 127 | +Update {file}`buildout.cfg`. |
| 128 | +This example uses `plone.restapi`. |
| 129 | + |
| 130 | +```cfg |
| 131 | +[buildout] |
| 132 | +extends = |
| 133 | + https://dist.plone.org/release/6-latest/versions.cfg |
| 134 | +extensions = mr.developer |
| 135 | +auto-checkout = |
| 136 | + plone.restapi |
| 137 | +
|
| 138 | +parts = |
| 139 | + instance |
| 140 | +
|
| 141 | +[instance] |
| 142 | +recipe = plone.recipe.zope2instance |
| 143 | +user = admin:admin |
| 144 | +http-address = 8080 |
| 145 | +eggs = |
| 146 | + Plone |
| 147 | +
|
| 148 | +[sources] |
| 149 | +plone.restapi = git https://github.com/plone/plone.restapi.git |
| 150 | +
|
| 151 | +[versions] |
| 152 | +plone.restapi = |
| 153 | +``` |
| 154 | + |
| 155 | +```{tip} |
| 156 | +Setting an empty version ensures that the copy of `plone.restapi` from source control will be used, instead of the version pin inherited from https://dist.plone.org/release/6-latest/versions.cfg. |
| 157 | +``` |
| 158 | + |
| 159 | +To actually download and install the new add-on, run: |
| 160 | + |
| 161 | +```shell |
| 162 | +bin/buildout |
| 163 | +``` |
| 164 | + |
| 165 | +```{seealso} |
| 166 | +This approach uses the [`mr.developer`](https://pypi.org/project/mr.developer/) Buildout extension. |
| 167 | +``` |
0 commit comments