You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Contributing to Plone core: skip buildout, use magic (#1936)
* contributing: skip buildout, use magic
* Simplify instructions on "## Install Plone core for development". Be more polite to new contributors.
* myST fix
* Back to former punctuation
* less like before
* Older versions not former versions
* "git" now capitalized
* Add link to the README concerning make options/targets
* ## Edit packages and ## Test locally
* Apply suggestions from code review
Co-authored-by: Steve Piercy <[email protected]>
* Apply suggestions from code review
Co-authored-by: Steve Piercy <[email protected]>
* 6.1 -> {PLONE_BACKEND_MINOR_VERSION}
* Apply suggestions from code review
Co-authored-by: Steve Piercy <[email protected]>
* Choose a distribution depending on whether you are developing for ClassicUI or Volto
* Update docs/contributing/core/index.md
---------
Co-authored-by: Steve Piercy <[email protected]>
This guide describes the process of how to contribute to, and develop in, Plone core.
13
13
It expands upon {doc}`/contributing/index`.
14
14
15
-
```{important}
16
15
Although Plone core includes Volto—the React based, default frontend for Plone 6—this guide does not apply to Volto and its packages.
17
16
To contribute to Volto, see {doc}`../volto`.
18
-
```
19
17
20
-
This guide assumes that you have basic knowledge of how to use git and GitHub.
21
-
If you have never contributed to Plone, or you lack basic knowledge of how to use git and GitHub, you should first read {doc}`/contributing/first-time` for more information.
18
+
This guide assumes that you have basic knowledge of how to use Git and GitHub.
19
+
If you have never contributed to Plone, or you lack basic knowledge of how to use Git and GitHub, you should first read {doc}`/contributing/first-time` for more information.
22
20
23
21
```{important}
24
22
You must {ref}`contributing-sign-and-return-the-plone-contributor-agreement-label` before your contribution can be accepted.
@@ -73,86 +71,58 @@ On macOS, Developer Tools provides Clang for a C compiler.
73
71
On Linux, [GNU Compiler Collection (GCC)](https://gcc.gnu.org/) is a common option.
74
72
75
73
76
-
74
+
(contributing-core)=
77
75
## Install Plone core for development
78
76
79
77
The tool that installs Plone core is `buildout.coredev`.
80
78
81
-
The current default and development branch of `buildout.coredev` is `6.1`
79
+
The current default and development branch of `buildout.coredev` is `{PLONE_BACKEND_MINOR_VERSION}`.
82
80
Older versions are named according to their `major.minor` version.
83
81
Its versions align with Plone's `major.minor` versions.
84
82
85
83
Use a separate directory for each version of Plone to which you want to contribute.
86
-
This will avoid switching between git branches, then re-running buildout, which can cause dependency conflicts between versions of Plone.
84
+
This will avoid switching between Git branches, which can cause dependency conflicts between versions of Plone.
87
85
88
-
To set up a Plone 6 development environment, change your working directory to wherever you place your projects, and clone https://github.com/plone/buildout.coredev.
89
-
You can specify the branch that you want to check out with the `-b` option.
86
+
To set up a Plone 6 development environment, clone https://github.com/plone/buildout.coredev.
If you want to use a Python version that is not 3.11, follow these instructions.
100
-
101
-
Open the file {file}`bootstrap.sh` at the root of the repository.
102
-
Notice that the script expects Python 3.11 to be installed on your system and in your user's `PATH`.
103
-
104
-
```shell
105
-
#/bin/sh
106
-
`which python3.11` -m venv .
107
-
```
108
-
109
-
Edit it according to the Python version you want to use, then save and close the file.
110
-
After you have run the script, you should undo the change, otherwise you have a local change in git that you might accidentally commit.
111
-
````
112
-
113
-
Now run the script to install Plone 6.
114
-
115
-
```shell
116
-
./bootstrap.sh
117
-
```
118
-
119
-
This will run for a long time if it's your first pull (approximately 10-20 minutes, depending on network speed and your hardware).
120
-
121
-
Once that's done, you can start an instance of Plone with the following command.
93
+
Use the following command to install Plone and run it.
122
94
123
95
```shell
124
-
./bin/instance fg
96
+
make run
125
97
```
126
98
127
-
```{include} /_inc/_create-classic-ui-instance.md
128
-
```
99
+
To create and visit a new Plone site, visit http://localhost:8080, select the Classic UI distribution, and fill out and submit the form, ensuring you create a site with sample content against which you can test.
129
100
130
-
```{warning}
131
-
Ignore the warning about accessing the Plone backend through its Classic UI frontend.
101
+
Stop Plone with the keyboard shortcut {kbd}`ctrl-c`.
132
102
133
-
Do not follow the instructions to install Volto.
134
-
They will not work with buildout.
135
-
To contribute to Volto, you will need to start over, and follow {doc}`../volto`.
103
+
```{seealso}
104
+
For more Make targets, see documentation in [`buildout.coredev`'s `README-make.md` file](https://github.com/plone/buildout.coredev/blob/{PLONE_BACKEND_MINOR_VERSION}/README-make.md).
105
+
The most relevant section is [How to use the `Makefile`](https://github.com/plone/buildout.coredev/blob/{PLONE_BACKEND_MINOR_VERSION}/README-make.md#how-to-use-the-makefile).
136
106
```
137
107
138
108
139
109
(contributing-core-work-with-git-label)=
140
110
141
-
## Work with git
111
+
## Work with Git
142
112
143
113
```{important}
144
114
This section applies to members of the GitHub `plone/developers` team, who have write access to repositories under the Plone GitHub organization.
145
115
146
116
Members of the `plone/contributors` team do not have write access, and instead must follow the process to set up their remote upstream and origin branches as described in {ref}`set-up-your-environment-label`.
147
117
```
148
118
149
-
Always begin by checking out the git branch on which you want to work.
119
+
Always begin by checking out the Git branch on which you want to work.
150
120
This is the base branch to which you will create a pull request.
151
121
152
-
If you just cloned `https://github.com/plone/buildout.coredev`, then the `6.1` branch is checked out and current, and you can skip the rest of this section and continue on the next, {ref}`contributing-core-edit-packages-label`.
122
+
If you just cloned `https://github.com/plone/buildout.coredev`, then the `{PLONE_BACKEND_MINOR_VERSION}` branch is checked out and current, and you can skip the rest of this section and continue on the next, {ref}`contributing-core-edit-packages-label`.
153
123
154
124
```shell
155
-
git checkout 6.1
125
+
git checkout {PLONE_BACKEND_MINOR_VERSION}
156
126
```
157
127
158
128
Next pull down and merge any recent changes from the remote tracked repository with a single command.
@@ -173,46 +143,21 @@ You can also ask in the [Plone Community Forum](https://community.plone.org/).
173
143
174
144
Only a few packages are in {file}`src/` by default.
175
145
176
-
Next create a new file {file}`buildout.local.cfg`, and add the names of packages that you want to develop under the `auto-checkout` list.
146
+
Next, edit the file {file}`mxcheckouts.ini` at the root of your checkout, adding the name of the package that you want to develop as a new section.
147
+
The following example adds `plone.app.multilingual`.
177
148
178
149
```ini
179
-
[buildout]
180
-
extends =
181
-
buildout.cfg
182
-
183
-
auto-checkout =
184
-
# Add packages that you want to develop
185
-
plone.app.event
186
-
icalendar
187
-
# others
188
-
...
150
+
[plone.app.multilingual]
151
+
use = true
189
152
```
190
153
191
-
When you make changes in your package, then rerun buildout with the following command, specifying your new buildout configuration file with the `-c` option.
192
-
You can add the `-N` flag to save time by not checking PyPI to see if there are updates to packages that were already installed.
154
+
You can now check out the package and start your instance with the checked out package using the following commands.
193
155
194
156
```shell
195
-
./bin/buildout -c buildout.local.cfg -N
196
-
```
197
-
198
-
```{seealso}
199
-
`mr.developer` checks out additional repositories using the `auto-checkout` option.
200
-
For more information, see {doc}`mrdeveloper`.
157
+
make sources-dirty
158
+
make run
201
159
```
202
160
203
-
````{tip}
204
-
To avoid conflicts with `buildout.coredev` files, you can configure git for your user.
205
-
Either create or edit a file at {file}`~/.gitconfig`.
206
-
Then add the following stanza to it.
207
-
208
-
```cfg
209
-
[core]
210
-
excludesfile = ~/.gitignore_global
211
-
```
212
-
213
-
Then add any standard `.gitignore` syntax to exclude files from getting committed and pushed to a remote repository.
214
-
````
215
-
216
161
Next create a new development branch on which you want to work from the current branch, tracking the upstream Plone repository, and check it out.
217
162
It's a good idea to use a branch name that includes the issue number and is descriptive of what it resolves.
218
163
@@ -227,54 +172,44 @@ Now you can edit your code without affecting the original branch.
227
172
228
173
## Test locally
229
174
230
-
If you change the expected behavior of a feature in a package, you should write a test to cover the change.
175
+
If you change the expected behavior of a feature in a package, you should write a unit or acceptance test, as appropriate, to cover the change.
231
176
232
-
To run a test for the specific package that you modified, use the `-s` option followed by the package name, as shown in the following example.
177
+
Plone uses [Playwright](https://playwright.dev/) to run acceptance tests.
178
+
`plone.app.robotframework` provides a script to install Playwright browsers.
233
179
234
180
```shell
235
-
./bin/test -s plone.app.event
181
+
.venv/bin/rfbrowser init
236
182
```
237
183
238
-
If any test fails, do not commit and push the changes.
239
-
Instead write a test that passes.
240
-
241
-
After the package level tests pass with your change, you can {ref}`contributing-core-create-a-pull-request-label` and let CI run and ask Jenkins to run the full test suite.
242
-
243
-
However, if CI or Jenkins report a test failure that you want to troubleshoot locally, you can run the full unit test suite to ensure other packages aren't affected by the change.
244
-
It takes 5-10 minutes to run the full unit test suite.
184
+
To run tests for the specific package that you modified, use `.venv/bin/pytest` followed by the package name, as shown in the following example.
245
185
246
186
```shell
247
-
# Run unit tests
248
-
./bin/test
187
+
.venv/bin/pytest src/plone.app.multilingual
249
188
```
250
189
251
-
If you run acceptance tests with the `--all` option, it will run tests in a real browser.
252
-
This takes 30-40 minutes to run.
253
-
This may repeatedly launch and close browser windows that gain focus, disrupting you from doing any other work.
254
-
If this happens, you can use `headlesschrome` as the test browser.
255
-
First set an environment variable.
256
-
257
-
```shell
258
-
export ROBOT_BROWSER="headlesschrome"
259
-
```
190
+
If any test fails, do not commit and push the changes.
191
+
Instead write a test that passes.
260
192
261
-
Then run all tests again.
193
+
Following [How to invoke pytest](https://docs.pytest.org/en/stable/how-to/usage.html), you can run tests for the package you're developing.
194
+
Using the pytest keyword option `-k`, followed by a string expression in double quotes, you can select only unit tests or only acceptance tests to run as shown below.
After the script downloads and initalizes browser resources, you can run the acceptance tests.
205
+
After the package level tests pass with your change, you can {ref}`contributing-core-create-a-pull-request-label`, which will start the CI checks.
206
+
After all CI checks pass, then you can ask Jenkins to run the full test suite.
207
+
208
+
If either CI or Jenkins report a test failure, and you want to troubleshoot it locally, then you can run the full test suite to ensure other packages aren't affected by the change.
209
+
It takes about 15-20 minutes to run the full unit test suite.
0 commit comments