Skip to content

Commit ae75dbd

Browse files
ksuessstevepiercy
andauthored
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]>
1 parent 73aa6bc commit ae75dbd

File tree

2 files changed

+45
-110
lines changed

2 files changed

+45
-110
lines changed

docs/contributing/core/index.md

Lines changed: 44 additions & 109 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,11 @@ myst:
1212
This guide describes the process of how to contribute to, and develop in, Plone core.
1313
It expands upon {doc}`/contributing/index`.
1414

15-
```{important}
1615
Although Plone core includes Volto—the React based, default frontend for Plone 6—this guide does not apply to Volto and its packages.
1716
To contribute to Volto, see {doc}`../volto`.
18-
```
1917

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.
2220

2321
```{important}
2422
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.
7371
On Linux, [GNU Compiler Collection (GCC)](https://gcc.gnu.org/) is a common option.
7472

7573

76-
74+
(contributing-core)=
7775
## Install Plone core for development
7876

7977
The tool that installs Plone core is `buildout.coredev`.
8078

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}`.
8280
Older versions are named according to their `major.minor` version.
8381
Its versions align with Plone's `major.minor` versions.
8482

8583
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.
8785

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.
9087

9188
```shell
92-
cd [MY_PROJECTS]
93-
# clone a specific major.minor version branch
94-
git clone -b 6.1 https://github.com/plone/buildout.coredev
89+
git clone https://github.com/plone/buildout.coredev
9590
cd buildout.coredev
9691
```
9792

98-
````{important}
99-
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.
12294

12395
```shell
124-
./bin/instance fg
96+
make run
12597
```
12698

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.
129100

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`.
132102

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).
136106
```
137107

138108

139109
(contributing-core-work-with-git-label)=
140110

141-
## Work with git
111+
## Work with Git
142112

143113
```{important}
144114
This section applies to members of the GitHub `plone/developers` team, who have write access to repositories under the Plone GitHub organization.
145115
146116
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`.
147117
```
148118

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.
150120
This is the base branch to which you will create a pull request.
151121

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`.
153123

154124
```shell
155-
git checkout 6.1
125+
git checkout {PLONE_BACKEND_MINOR_VERSION}
156126
```
157127

158128
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/).
173143

174144
Only a few packages are in {file}`src/` by default.
175145

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`.
177148

178149
```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
189152
```
190153

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.
193155

194156
```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
201159
```
202160

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-
216161
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.
217162
It's a good idea to use a branch name that includes the issue number and is descriptive of what it resolves.
218163

@@ -227,54 +172,44 @@ Now you can edit your code without affecting the original branch.
227172

228173
## Test locally
229174

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.
231176

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.
233179

234180
```shell
235-
./bin/test -s plone.app.event
181+
.venv/bin/rfbrowser init
236182
```
237183

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.
245185

246186
```shell
247-
# Run unit tests
248-
./bin/test
187+
.venv/bin/pytest src/plone.app.multilingual
249188
```
250189

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.
260192

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.
195+
With no options, pytest will run all tests.
262196

263197
```shell
264-
bin/test --all
198+
.venv/bin/pytest src/plone.app.multilingual -v -k "not robot"
265199
```
266200

267-
Plone uses [Playwright](https://playwright.dev/) to run robot tests.
268-
`plone.app.robotframework` provides a script to install Playwright browsers.
269-
270201
```shell
271-
./bin/rfbrowser init
202+
.venv/bin/pytest src/plone.app.multilingual -v -k "robot"
272203
```
273204

274-
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.
275210

276211
```shell
277-
./bin/test --all
212+
.venv/bin/pytest
278213
```
279214

280215

docs/contributing/core/release.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ These are:
6868
```shell
6969
git clone [email protected]:plone/buildout.coredev.git
7070
cd buildout.coredev
71-
git checkout 6.1
71+
git checkout {PLONE_BACKEND_MINOR_VERSION}
7272
./bootstrap.sh
7373
bin/buildout -c buildout.cfg
7474
```

0 commit comments

Comments
 (0)