diff --git a/.github/ISSUE_TEMPLATE/new-issue-form.yml b/.github/ISSUE_TEMPLATE/new-issue-form.yml index ec0be7e160..92f61cdc3e 100644 --- a/.github/ISSUE_TEMPLATE/new-issue-form.yml +++ b/.github/ISSUE_TEMPLATE/new-issue-form.yml @@ -17,6 +17,6 @@ body: id: description attributes: label: Description - description: Include include screenshots and any other helpful information. + description: Include screenshots and any other helpful information. validations: required: true diff --git a/.github/boring-cyborg.yml b/.github/boring-cyborg.yml new file mode 100644 index 0000000000..7ccb43e29e --- /dev/null +++ b/.github/boring-cyborg.yml @@ -0,0 +1,133 @@ +# boring-cyborg.yml +# https://probot.github.io/apps/boring-cyborg/ + +##### Labeler ########################################################################################################## +## Enable "labeler" for your PR that would add labels to PRs based on the paths that are modified in the PR. +#labelPRBasedOnFilePath: +# # Add 'label1' to any changes within 'example' folder or any subfolders +# label1: +# - example/**/* +# +# # Add 'label2' to any file changes within 'example2' folder +# label2: +# - example2/* +# +# # Complex: Add 'area/core' label to any change within the 'core' package +# area/core: +# - src/core/* +# - src/core/**/* +# +# # Add 'test' label to any change to *.spec.js files within the source dir +# test: +# - src/**/*.spec.js +# +# Various Flags to control behaviour of the "Labeler" +#labelerFlags: +# # If this flag is changed to 'false', labels would only be added when the PR is first created and not when existing +# # PR is updated. +# # The default is 'true' which means the labels would be added when PR is updated even if they were removed by the user +# labelOnPRUpdates: true + +##### Reviewer ######################################################################################################### +# Enable "Reviewer" for your PR that would add reviewers to PRs based on the labels that exist on the PR. +# You have the option to set a default reviewer that gets added to every PR, or you can omit that config variable to skip it. +addReviewerBasedOnLabel: + # add list of reviewers to add by default to all PRs + defaultReviewers: + - stevepiercy + # specify PR labels that you want to auto assign reviewers based on +# labels: +# label1: +# - tyler-mairose-sp +# - jordan-violet-sp +# label2: +# - kaxil + +##### Greetings ######################################################################################################## +# Comment to be posted to welcome users when they open their first PR +firstPRWelcomeComment: > + Thanks for submitting your first pull request! You are awesome! :hugs: + +
If you haven't done so already, read + [Plone's Code of Conduct](https://plone.org/foundation/about/materials/foundation-resolutions/code-of-conduct) + and [Contribute to documentation](https://6.docs.plone.org/contributing/documentation/index.html), + as this will greatly help the review process. + +
Welcome to the Plone community! :tada: + +# Comment to be posted to congratulate user on their first merged PR +firstPRMergeComment: > + Congratulations on your first merged pull request in this project! :tada: + + ![Congratulations](https://raw.githubusercontent.com/plone/documentation/fda4eadee4b0b71c4bcd0da739847444f74d3fc5/.github/images/congratulations.jpg) + +
Thank you for contributing, we are very proud of you! :heart: + +# Comment to be posted to on first time issues +firstIssueWelcomeComment: > + Thanks for opening your first issue here! + Your engagement is essential for open source projects, including Plone. :hugs: + +
If you haven't done so already, + read [Plone's Code of Conduct](https://plone.org/foundation/about/materials/foundation-resolutions/code-of-conduct). + Also please follow the issue template, as it helps both you and other community members contribute more effectively. + +
If your issue is a feature request, others may raise its prominence through + [feature voting](https://github.com/plone/documentation/issues?q=is%3Aissue%20state%3Aopen%20sort%3Areactions-%2B1-desc%20). + +
Welcome to the Plone community! :tada: + +###### IssueLink Adder ################################################################################################# +# Insert Issue (Jira/Github etc) link in PR description based on the Issue ID in PR title. +#insertIssueLinkInPrDescription: +# # specify the placeholder for the issue link that should be present in the description +# descriptionIssuePlaceholderRegexp: "^Issue link: (.*)$" +# matchers: +# # you can have several matches - for different types of issues +# # only the first matching entry is replaced +# jiraIssueMatch: +# # specify the regexp of issue id that you can find in the title of the PR +# # the match groups can be used to build the issue id (${1}, ${2}, etc.). +# titleIssueIdRegexp: \[(AIRFLOW-[0-9]{4})\] +# # the issue link to be added. ${1}, ${2} ... are replaced with the match groups from the +# # title match (remember to use quotes) +# descriptionIssueLink: "[${1}](https://issues.apache.org/jira/browse/${1}/)" +# docOnlyIssueMatch: +# titleIssueIdRegexp: \[(AIRFLOW-X{4})\] +# descriptionIssueLink: "`Document only change, no JIRA issue`" +# +###### Title Validator ################################################################################################# +# Verifies if commit/PR titles match the regexp specified +#verifyTitles: +# # Regular expression that should be matched by titles of commits or PR +# titleRegexp: ^\[AIRFLOW-[0-9]{4}\].*$|^\[AIRFLOW-XXXX\].*$ +# # If set to true, it will always check the PR title (as opposed to the individual commits). +# alwaysUsePrTitle: true +# # If set to true, it will only check the commit in case there is a single commit. +# # In case of multiple commits it will check PR title. +# # This reflects the standard behaviour of Github that for `Squash & Merge` GitHub +# # uses the PR title rather than commit messages for the squashed commit ¯\_(ツ)_/¯ +# # For single-commit PRs it takes the squashed commit message from the commit as expected. +# # +# # If set to false it will check all commit messages. This is useful when you do not squash commits at merge. +# validateEitherPrOrSingleCommitTitle: true +# # The title the GitHub status should appear from. +# statusTitle: "Title Validator" +# # A custom message to be displayed when the title passes validation. +# successMessage: "Validation successful!" +# # A custom message to be displayed when the title fails validation. +# # Allows insertion of ${type} (commit/PR), ${title} (the title validated) and ${regex} (the titleRegexp above). +# failureMessage: "Wrong ${type} title: ${title}" +# +###### PR/Branch Up-To-Date Checker #################################################################################### +## Check if the branch is up to date with master when certain files are modified +#checkUpToDate: +# # The default branch is "master", change the branch if you want to check against a different target branch +# targetBranch: master +# files: +# # File paths that you want to check for +# # In this example, it checks if the branch is up to date when alembic migrations are modified in the PR. +# # It helps avoid multiple heads in alembic migrations in a collaborative development project. +# - airflow/migrations/* +# - airflow/migrations/**/* +# - airflow/alembic.ini diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000000..0d08e261a2 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,11 @@ +# To get started with Dependabot version updates, you'll need to specify which +# package ecosystems to update and where the package manifests are located. +# Please see the documentation for all configuration options: +# https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file + +version: 2 +updates: + - package-ecosystem: "github-actions" # See documentation for possible values + directory: "/" # Location of package manifests + schedule: + interval: "weekly" diff --git a/.github/images/congratulations.jpg b/.github/images/congratulations.jpg new file mode 100644 index 0000000000..f60a81079b Binary files /dev/null and b/.github/images/congratulations.jpg differ diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index ba6cd265ef..16258e7cfb 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -11,9 +11,9 @@ Thank you for your contribution to the Plone Documentation. Before submitting this pull request, please make sure you follow our guides: - [Contributing to Plone documentation](https://6.docs.plone.org/contributing/index.html) -- [Building and checking the quality of documentation](https://6.docs.plone.org/contributing/setup-build.html) -- [Authors guide](https://6.docs.plone.org/contributing/authors.html) -- [MyST reference](https://6.docs.plone.org/contributing/myst-reference.html) +- [Building and checking the quality of documentation](https://6.docs.plone.org/contributing/documentation/setup-build.html) +- [Authors guide](https://6.docs.plone.org/contributing/documentation/authors.html) +- [MyST reference](https://6.docs.plone.org/contributing/documentation/myst-reference.html) ## Issue number diff --git a/.github/workflows/build_deploy.yml b/.github/workflows/build_deploy.yml index e8bbdf4c94..9cf11ee24e 100644 --- a/.github/workflows/build_deploy.yml +++ b/.github/workflows/build_deploy.yml @@ -5,6 +5,9 @@ on: branches: - "6.0" +env: + node-version: 20.x + jobs: build_deploy: runs-on: ubuntu-latest @@ -12,13 +15,13 @@ jobs: name: docs.plone.org url: https://docs.plone.org steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v6 - name: Setup Graphviz - uses: ts-graphviz/setup-graphviz@v1 - - name: Set up Python 3.10 - uses: actions/setup-python@v4 + uses: ts-graphviz/setup-graphviz@v2 + - name: Set up Python 3.12 + uses: actions/setup-python@v6 with: - python-version: '3.10' + python-version: '3.12' cache: 'pip' - name: Install dependencies run: | @@ -35,31 +38,32 @@ jobs: - name: Prepare deploy run: make deploy - # node setup - - name: Use Node.js 16 - uses: actions/setup-node@v3 + - name: Use Node.js ${{ env.node-version }} + uses: actions/setup-node@v6 with: - node-version: '16' - - name: Install Yarn - run: npm install -g yarn - # node cache - - name: Get yarn cache directory path - id: yarn-cache-dir-path - working-directory: submodules/volto - run: echo "dir=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT - - uses: actions/cache@v3 - id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`) + node-version: ${{ env.node-version }} + + - name: Enable corepack + shell: bash + run: | + npm i -g corepack@latest + corepack enable + + - name: Get pnpm store directory + shell: bash + run: | + echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV + + - uses: actions/cache@v5 + name: Setup pnpm cache with: - path: ${{ steps.yarn-cache-dir-path.outputs.dir }} - key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} + path: ${{ env.STORE_PATH }} + key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} restore-keys: | - ${{ runner.os }}-yarn- + ${{ runner.os }}-pnpm-store- - name: StoryBook build - run: | - cd submodules/volto - yarn install --immutable - yarn build-storybook -o ../../_build/html/storybook + run: make storybook - name: Deploy to server id: deploy diff --git a/.github/workflows/rtd-pr-preview.yml b/.github/workflows/rtd-pr-preview.yml new file mode 100644 index 0000000000..bf7bd5aef9 --- /dev/null +++ b/.github/workflows/rtd-pr-preview.yml @@ -0,0 +1,22 @@ +# .github/workflows/rtd-pr-preview.yml +name: readthedocs/actions +on: + pull_request_target: + types: + - opened + # Execute this action only on PRs that touch + # documentation files. + # paths: + # - "docs/**" + +permissions: + pull-requests: write + +jobs: + documentation-links: + runs-on: ubuntu-latest + steps: + - uses: readthedocs/actions/preview@v1 + with: + project-slug: "plone6" + single-version: "true" diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index f99fc8cab7..7fc4a35d54 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -6,12 +6,12 @@ jobs: if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name runs-on: ubuntu-latest steps: - - uses: actions/checkout@v1 + - uses: actions/checkout@v6 - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v4 + uses: actions/setup-python@v6 with: - python-version: "3.10" + python-version: "3.12" - name: Install dependencies run: | diff --git a/.github/workflows/update_submodule.yml b/.github/workflows/update_submodule.yml index 1161b2a0bd..a1a1001914 100644 --- a/.github/workflows/update_submodule.yml +++ b/.github/workflows/update_submodule.yml @@ -1,3 +1,4 @@ +# See https://github.com/plone/documentation/issues/1214 for current status name: Get latest version of submodules and push back to 6.0 branch on: @@ -8,7 +9,7 @@ jobs: runs-on: ubuntu-latest steps: # Checkout - - uses: actions/checkout@v3 + - uses: actions/checkout@v6 with: ref: 6.0 submodules: true diff --git a/.gitignore b/.gitignore index 82863e71d7..a825459902 100644 --- a/.gitignore +++ b/.gitignore @@ -1,19 +1,15 @@ # Dependencies -/bin -/include -/lib -/lib64 +/venv # Generated files -pyvenv.cfg /_build -/styles/Microsoft /share +/styles/Microsoft # symlinked from submodule -docs/volto -docs/plone.restapi docs/plone.api +docs/plone.restapi +docs/volto # editor files .vscode diff --git a/.gitmodules b/.gitmodules index 7e3c9e4d0d..0e7410d058 100644 --- a/.gitmodules +++ b/.gitmodules @@ -9,4 +9,4 @@ [submodule "submodules/plone.api"] path = submodules/plone.api url = https://github.com/plone/plone.api.git - branch = master + branch = main diff --git a/.readthedocs.yaml b/.readthedocs.yaml new file mode 100644 index 0000000000..7ebd03b0c7 --- /dev/null +++ b/.readthedocs.yaml @@ -0,0 +1,25 @@ +# .readthedocs.yaml +# Read the Docs configuration file +# See https://docs.readthedocs.com/platform/stable/config-file/v2.html for details + +# Required +version: 2 + +# Set the OS, Python version and other tools you might need +build: + os: ubuntu-22.04 + tools: + python: "3.12" + commands: + # Cancel building pull requests when there aren't changes in the docs directory or YAML file. + # You can add any other files or directories that you'd like here as well, + # like your docs requirements file, or other files that will change your docs build. + # + # If there are no changes (git diff exits with 0) we force the command to return with 183. + # This is a special exit code on Read the Docs that will cancel the build immediately. + - | + if [ "$READTHEDOCS_VERSION_TYPE" = "external" ] && git diff --quiet origin/6.0 -- docs/ Makefile .readthedocs.yaml requirements-initial.txt requirements.txt; + then + exit 183; + fi + - make rtd-pr-preview diff --git a/.vale.ini b/.vale.ini index f89759a516..df7f09b27f 100644 --- a/.vale.ini +++ b/.vale.ini @@ -10,3 +10,5 @@ Packages = Microsoft BasedOnStyles = Vale, Microsoft Microsoft.Contractions = suggestion Microsoft.Units = suggestion +; ignore MyST reference targets +TokenIgnores = \([a-zA-Z0-9._-]*\)= diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000000..a836b007c7 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,5 @@ +{ + "[markdown]": { + "editor.formatOnSave": false + } +} diff --git a/Makefile b/Makefile index 057129a659..492f479d40 100644 --- a/Makefile +++ b/Makefile @@ -5,10 +5,11 @@ SHELL = bash # You can set these variables from the command line. SPHINXOPTS ?= PAPER ?= +VALEOPTS ?= # Internal variables. -SPHINXBUILD = $(realpath bin/sphinx-build) -SPHINXAUTOBUILD = $(realpath bin/sphinx-autobuild) +SPHINXBUILD = "$(realpath venv/bin/sphinx-build)" +SPHINXAUTOBUILD = "$(realpath venv/bin/sphinx-autobuild)" DOCS_DIR = ./docs/ BUILDDIR = ../_build PAPEROPT_a4 = -D latex_paper_size=a4 @@ -29,116 +30,120 @@ clean: ## Clean docs build directory cd $(DOCS_DIR) && rm -rf $(BUILDDIR)/ .PHONY: distclean -distclean: ## Clean docs build directory and Python virtual environment - cd $(DOCS_DIR) && rm -rf $(BUILDDIR)/ - rm -rf ./bin/ ./lib/ ./lib64 ./include ./pyvenv.cfg - +distclean: clean ## Clean Python virtual environment and symlinks to submodules + rm -rf venv + rm docs/plone.api + rm docs/plone.restapi + rm docs/volto + @echo "Cleaned Python virtual environment and symlinks to submodules." + @echo -bin/python: - python3 -m venv . || virtualenv --clear --python=python3 . - bin/pip install -r requirements-initial.txt - bin/pip install -r requirements.txt +venv/bin/python: ## Setup up Python virtual environment and install requirements + python3 -m venv venv + venv/bin/pip install -r requirements-initial.txt + venv/bin/pip install -r requirements.txt + @echo "Installation of requirements completed." + @echo -docs/plone.api: - git submodule init; \ - git submodule update; \ - bin/pip install -e submodules/plone.api/"[test]"; \ +docs/plone.api: ## Setup plone.api docs + git submodule init + git submodule update ln -s ../submodules/plone.api/docs ./docs/plone.api - @echo @echo "Documentation of plone.api initialized." + @echo -docs/plone.restapi: - git submodule init; \ - git submodule update; \ - ln -s ../submodules/plone.restapi ./docs/plone.restapi +venv/plone.api-install: docs/plone.api + touch venv/plone.api-install + venv/bin/pip install plone.api -c submodules/plone.api/constraints.txt + venv/bin/pip install --no-deps -e submodules/plone.api/"[test]" + @echo "plone.api installed." @echo + +docs/plone.restapi: ## Setup plone.restapi docs + git submodule init + git submodule update + ln -s ../submodules/plone.restapi ./docs/plone.restapi @echo "Documentation of plone.restapi initialized." + @echo -docs/volto: - git submodule init; \ - git submodule update; \ +docs/volto: ## Setup Volto docs + git submodule init + git submodule update ln -s ../submodules/volto/docs/source ./docs/volto - @echo @echo "Documentation of volto initialized." + @echo -.PHONY: deps -deps: bin/python docs/volto docs/plone.restapi docs/plone.api ## Create Python virtual environment, install requirements, initialize or update the volto, plone.restapi, and plone.api submodules, and finally create symlinks to the source files. +ln-seven: ## Toggle the symlink to Seven + rm docs/volto + ln -s ../submodules/volto/docs ./docs/volto + @echo "Symlink to Volto changed to Seven." + @echo +ln-volto: ## Toggle the symlink to Volto + rm docs/volto + ln -s ../submodules/volto/docs/source ./docs/volto + @echo "Symlink to Seven changed to Volto." + @echo + +.PHONY: deps +deps: venv/bin/python docs/volto docs/plone.restapi venv/plone.api-install ## Create Python virtual environment, install requirements, initialize or update the volto, plone.restapi, and plone.api submodules, create symlinks to the source files, and finally install plone.api. .PHONY: html html: deps ## Build html cd $(DOCS_DIR) && $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html - @echo @echo "Build finished. The HTML pages are in $(BUILDDIR)/html." + @echo .PHONY: manual manual: deps cd $(DOCS_DIR) && $(SPHINXBUILD) -b html -t manual . $(BUILDDIR)/manual + @echo "Build finished. The manual pages are in $(BUILDDIR)/manual." + @echo .PHONY: dirhtml dirhtml: deps cd $(DOCS_DIR) && $(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml - @echo @echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml." + @echo .PHONY: singlehtml singlehtml: deps cd $(DOCS_DIR) && $(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml - @echo @echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml." + @echo .PHONY: pickle pickle: deps cd $(DOCS_DIR) && $(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle - @echo @echo "Build finished; now you can process the pickle files." + @echo .PHONY: json json: deps cd $(DOCS_DIR) && $(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json - @echo @echo "Build finished; now you can process the JSON files." + @echo .PHONY: htmlhelp htmlhelp: deps cd $(DOCS_DIR) && $(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp - @echo @echo "Build finished; now you can run HTML Help Workshop with the" \ ".hhp project file in $(BUILDDIR)/htmlhelp." - -.PHONY: qthelp -qthelp: deps - cd $(DOCS_DIR) && $(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp @echo - @echo "Build finished; now you can run "qcollectiongenerator" with the" \ - ".qhcp project file in $(BUILDDIR)/qthelp, like this:" - @echo "# qcollectiongenerator $(BUILDDIR)/qthelp/MasteringPlone.qhcp" - @echo "To view the help file:" - @echo "# assistant -collectionFile $(BUILDDIR)/qthelp/MasteringPlone.qhc" - -.PHONY: devhelp -devhelp: deps - cd $(DOCS_DIR) && $(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp - @echo - @echo "Build finished." - @echo "To view the help file:" - @echo "# mkdir -p $$HOME/.local/share/devhelp/MasteringPlone" - @echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/MasteringPlone" - @echo "# devhelp" .PHONY: epub epub: deps cd $(DOCS_DIR) && $(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub - @echo @echo "Build finished. The epub file is in $(BUILDDIR)/epub." + @echo .PHONY: latex latex: deps cd $(DOCS_DIR) && $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex - @echo @echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex." @echo "Run \`make' in that directory to run these through (pdf)latex" \ "(use \`make latexpdf' here to do that automatically)." + @echo .PHONY: latexpdf latexpdf: deps @@ -146,26 +151,27 @@ latexpdf: deps @echo "Running LaTeX files through pdflatex..." $(MAKE) -C $(BUILDDIR)/latex all-pdf @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex." + @echo .PHONY: text text: deps cd $(DOCS_DIR) && $(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text - @echo @echo "Build finished. The text files are in $(BUILDDIR)/text." + @echo .PHONY: man man: deps cd $(DOCS_DIR) && $(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man - @echo @echo "Build finished. The manual pages are in $(BUILDDIR)/man." + @echo .PHONY: texinfo texinfo: deps cd $(DOCS_DIR) && $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo - @echo @echo "Build finished. The Texinfo files are in $(BUILDDIR)/texinfo." @echo "Run \`make' in that directory to run these through makeinfo" \ "(use \`make info' here to do that automatically)." + @echo .PHONY: info info: deps @@ -173,33 +179,34 @@ info: deps @echo "Running Texinfo files through makeinfo..." make -C $(BUILDDIR)/texinfo info @echo "makeinfo finished; the Info files are in $(BUILDDIR)/texinfo." + @echo .PHONY: changes changes: deps cd $(DOCS_DIR) && $(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes - @echo @echo "The overview file is in $(BUILDDIR)/changes." + @echo .PHONY: linkcheck linkcheck: deps ## Run linkcheck cd $(DOCS_DIR) && $(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck - @echo @echo "Link check complete; look for any errors in the above output " \ "or in $(BUILDDIR)/linkcheck/ ." + @echo .PHONY: linkcheckbroken linkcheckbroken: deps ## Run linkcheck and show only broken links cd $(DOCS_DIR) && $(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck | GREP_COLORS='0;31' grep -wi "broken\|redirect" --color=always | GREP_COLORS='0;31' grep -vi "https://github.com/plone/volto/issues/" --color=always && if test $$? = 0; then exit 1; fi || test $$? = 1 - @echo @echo "Link check complete; look for any errors in the above output " \ "or in $(BUILDDIR)/linkcheck/ ." + @echo .PHONY: vale vale: deps ## Run Vale style, grammar, and spell checks - vale sync - vale --no-wrap $(VALEFILES) - @echo + venv/bin/vale sync + venv/bin/vale --no-wrap $(VALEOPTS) $(VALEFILES) @echo "Vale is finished; look for any errors in the above output." + @echo .PHONY: html_meta html_meta: deps ## Add meta data headers to all Markdown pages @@ -210,6 +217,7 @@ doctest: deps cd $(DOCS_DIR) && $(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest @echo "Testing of doctests in the sources finished, look at the " \ "results in $(BUILDDIR)/doctest/output.txt." + @echo .PHONY: test test: clean linkcheckbroken ## Clean docs build, then run linkcheckbroken @@ -222,24 +230,27 @@ livehtml: deps ## Rebuild Sphinx documentation on changes, with live-reload in cd "$(DOCS_DIR)" && ${SPHINXAUTOBUILD} \ --ignore "*.swp" \ --port 8050 \ + --watch volto \ + --watch plone.api \ + --watch plone.restapi \ -b html . "$(BUILDDIR)/html" $(SPHINXOPTS) $(O) -.PHONY: netlify -netlify: +.PHONY: rtd-pr-preview +rtd-pr-preview: ## Build pull request preview on Read the Docs pip install -r requirements-initial.txt pip install -r requirements.txt - pip install -r requirements-netlify.txt - git submodule init; \ - git submodule update; \ - pip install -e submodules/plone.api[test]; \ + git submodule init + git submodule update + pip install plone.api -c submodules/plone.api/constraints.txt + pip install --no-deps -e submodules/plone.api[test] ln -s ../submodules/volto/docs/source ./docs/volto ln -s ../submodules/plone.restapi ./docs/plone.restapi ln -s ../submodules/plone.api/docs ./docs/plone.api - cd $(DOCS_DIR) && sphinx-build -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html + cd $(DOCS_DIR) && sphinx-build -b html $(ALLSPHINXOPTS) ${READTHEDOCS_OUTPUT}/html/ .PHONY: storybook storybook: - cd submodules/volto && yarn && yarn build-storybook -o ../../_build/html/storybook + cd submodules/volto && pnpm i && pnpm build:registry && pnpm build:components && pnpm --filter @plone/volto build-storybook -o ../../../../_build/html/storybook .PHONY: all all: clean vale linkcheck html ## Clean docs build, then run vale and linkcheck, and build html diff --git a/coredev/agreement.md b/coredev/agreement.md deleted file mode 100644 index 337895245f..0000000000 --- a/coredev/agreement.md +++ /dev/null @@ -1,63 +0,0 @@ ---- -myst: - html_meta: - "description": "Contributing to Plone" - "property=og:description": "Contributing to Plone" - "property=og:title": "Contributing to Plone" - "keywords": "Contributing, Plone" ---- - -(contributing-to-plone-label)= - -# Contributing to Plone - -There are many people and companies who rely on Plone on a day-to-day basis, so we must enforce some level of code quality control. - -Plone's source code is hosted in git repositories at , but only members of the developer team have commit rights. - -Sending in a contributors agreement does not guarantee your commit access to the repositories, but once you send it in we will always have it on file for when you are ready to contribute. - -We ask that before requesting core access you familiarize yourself a little with the community since they will help you get ramped up: - -- Ask and (especially) answer questions on [the Plone forum](https://community.plone.org/) and in {doc}`Plone chat ` with a focus on getting to know the active developers a bit. - -- Attend a [conference](https://plone.org/news-and-events/events/plone-conferences), [symposium](https://plone.org/news-and-events/events/regional), or participate in a [sprint](https://plone.org/news-and-events/events/sprints). - - There are plenty of opportunities to meet the community and start contributing through various coding sessions, either in person or on the web. - - You may even be able to get immediate core access at a conference if you are flexing your mad coding skills and the right people are attending. - -- Get your feet wet by contributing to the [collective](https://collective.github.io/). - Don't worry about getting it perfect or asking for help. - This way you get to know us and we improve our code together as a community. - -- **Patches:** Historically we encouraged people to submit patches to the ticket collector. - These tickets are usually ignored forever. - Technically, for us to accept your patch, you must sign the contributors agreement. - If you want to contribute fixes, please just sign the agreement and go through the standard GitHub pull request process described below until you feel comfortable to bypass review. - If the ticket is trivial, you do not need to sign a contributor's agreement. - -Once you have familiarized yourself with the community and you are excited to contribute to the core: - -- Sign the contributor agreement at , then either send by postal mail to the address provided, or scan and email it to . - This offers both copyright protection and ensures that the Plone Foundation is able to exercise some control over the codebase, ensuring it is not appropriated for someone's unethical purposes. - For questions about why the agreement is required, please see [About the Plone Contributor Agreement -](https://plone.org/foundation/contributors-agreement). - -If you aren't sure where to start or just want more direction, feel free to get in the forum or in chat, and ask for help. -While there is no official mentoring process, there are plenty of people willing to act in that role and guide you through the steps of getting involved in the community. -A common way to start contributing is to participate in a [Plone sprint](https://plone.org/news-and-events/events/sprints). - -**Welcome to the Plone community!** - - -## Dealing with pull requests on GitHub - -Before we can merge a pull request, we must ensure that the author has signed the Plone Contributor Agreement. - -If they're listed in either the [Developers](https://github.com/orgs/plone/teams/developers/members) or [Contributors](https://github.com/orgs/plone/teams/contributors/members) team, the author has signed the Plone Contributor Agreement, so we can go ahead and merge. - -If they aren't listed there, they may have signed and returned the Plone Contributor Agreement, but they were not yet added to a team. -You can ask agreements@plone.org to verify. - -Pull requests without a signed Plone Contributor Agreement can only be merged in trivial cases, and only by the release manager. diff --git a/coredev/continous-integration.md b/coredev/continous-integration.md deleted file mode 100644 index a1458cf41d..0000000000 --- a/coredev/continous-integration.md +++ /dev/null @@ -1,105 +0,0 @@ ---- -myst: - html_meta: - "description": "Essential continuous integration practices" - "property=og:description": "Essential continuous integration practices" - "property=og:title": "Essential continuous integration practices" - "keywords": "Plone, continuous integration, best practices" ---- - -# Essential continuous integration practices - -The CI system at [jenkins.plone.org](https://jenkins.plone.org) is a shared resource for Plone core developers to notify them of regressions in Plone core code. - -Build breakages are a normal and expected part of the development process. -Our aim is to find errors and eliminate them as quickly as possible, without expecting perfection and zero errors. -Though, there are some essential rules that needs to be followed in order to achieve a stable build. - - -## 1) Don't check in on a broken build - -Do not make things more complicated for the developer who is responsible for breaking the build. - -If the build breaks, the developer has to identify the cause of the breakage as soon as possible and should fix it. -If we adopt this strategy, we will always be in the best position to find out what caused the breakage and fix it immediately. -If one of the developers has made a check-in and broken the build as a result, we have the best chance of fixing the build if we have a clear look at the problem. -Checking in further changes and triggering new builds will just lead to more problems. - -If the build is broken over a longer period of time (more than a couple of hours) you should either notify the developer who is responsible for the breakage, fix the problem yourself, or just revert the commit in order to be able to continue to work. - -```note -There is one exception to this rule. -Sometimes there are changes or tests that depend on changes in other packages. -If this is the case, there is no way around breaking a single build for a certain period of time. -In this case run the all tests locally with all the changes and commit them within a time frame of ten minutes. -``` - - -## 2) Always run all commit tests locally before committing - -Following this practice ensures the build stays green, and other developers can continue to work without breaking the first rule. - -There might be changes that have been checked in before your last update from the version control that might lead to a build failure in Jenkins in combination with your changes. -Therefore it is essential that you check out ({command}`git pull`) and run the tests again before you push your changes to GitHub. - -Furthermore, a common source of errors on check-in is to forget to add some files to the repository. - -If you follow this rule and your local build passes, you can be sure that this is because someone else checked in in the meantime, or because you forgot to add a new class or configuration file that you have been working on into the version control system. - - -## 3) Wait for commit tests to pass before moving on - -Always monitor the build's progress, and fix the problem right away if it fails. -You have a far better chance of fixing the build, if you just introduced a regression than later. -Also another developer might have committed in the meantime (by breaking rule 1), making things more complicated for yours. - - -## 4) Never go home on a broken build - -Taking into account the first rule of CI ("Don't check in on a broken build"), breaking the build essentially stops all other developers from working on it. -Therefore going home on a broken build (or even on a build that has not finished yet) is **not** acceptable. -It will prevent all the other developers to stop working on the build or fixing the errors that you introduced. - - -## 5) Always be prepared to revert to the previous revision - -In order for the other developers to be able to work on the build, you should always be prepared to revert to the previous (passing) revision. - - -## 6) Time-box fixing before reverting - -When the build breaks on check-in, try to fix it for ten minutes. -If, after ten minutes, you aren't finished with the solution, revert to the previous version from your version control system. -This way you will allow other developers to continue to work. - - -## 7) Don't comment out failing tests - -Once you begin to enforce the previous rule, the result is often that developers start commenting out failing tests in order to get the build passing again as quick as possible. -While this impulse is understandable, it is **wrong**. - -The tests have been passing for a while and then start to fail. -This means that we either caused a regression, made assumptions that are no longer valid, or the application has changed the functionality being tested for a valid reason. - -You should always either fix the code (if a regression has been found), modify the test (if one of the assumptions has changed), or delete it (if the functionality under test no longer exists). - - -## 8) Take responsibility for all breakages that result from your changes - -If you commit a change and all the tests you wrote pass, but others break, the build is still broken. -This also applies to tests that fail in `buildout.coredev` and don't belong directly to the package you worked on. -This means that you have introduced a regression bug into the application. - -It is **your responsibility**—because you made the change—to fix all tests that are not passing as a result of your changes. - -There are some tests in Plone that fail randomly, we are always working on fixing those. -If you think you hit such a test, try to fix it (better) or re-run the Jenkins job to see if it passes again. - -In any case the developer who made the commit is responsible to make it pass. - - -## Further Reading - -Those rules were taken from the excellent book "Continuous Delivery" by Jez Humble and David Farley (Addison Wesley), and have been adopted and rewritten for the Plone community. - -If you want to learn more about continuous integration and continuous delivery, I'd recommend that you buy this book. diff --git a/coredev/contributors_agreement_explained.md b/coredev/contributors_agreement_explained.md deleted file mode 100644 index 88851f6c85..0000000000 --- a/coredev/contributors_agreement_explained.md +++ /dev/null @@ -1,101 +0,0 @@ ---- -myst: - html_meta: - "description": "Contributor's Agreement for Plone explained" - "property=og:description": "Contributor's Agreement for Plone explained" - "property=og:title": "Contributor's Agreement for Plone explained" - "keywords": "Contributor, Agreement, Plone" ---- - -```{todo} -All this content should be audited against the plone.org site, probably removed, and replaced with a link to the authorative content on plone.org. -Duplicating content is a maintenance burden. -``` - -# Contributor's Agreement for Plone explained - -Prospective contributors to the Plone code base are required to sign a contributor's agreement, which assigns copyright in the code to the Plone Foundation, the non-profit organization which stewards the Plone code base. - -This document explains the purposes of this, along with questions and answers about what this means. - -The Plone Contributor's Agreement can be found at https://plone.org/foundation/contributors-agreement. - - -## About the Plone Contributor Agreement - -The Foundation feels that it benefits the community for a single organization to hold the rights to Plone. -Prior to the Foundation, the intellectual property of Plone was jointly held by individual developers and by Alan Runyan and Alexander Limi. - -The community members who formed the Foundation felt that having the Foundation hold these rights provides several benefits: - -1. **Minimizing confusion / maximizing business compatibility** -- Organizations considering adopting Plone have a simple answer for "Who owns this?", rather than a more complicated answer that might scare away the legally-cautious. -2. **Trademark protection** -- By having the Foundation hold the trademarks and rights to the Plone branding assets, it can effectively protect these from unfair use. -3. **Guarantee of future Open Source versions** -- The Foundation's contributor agreement ensures that there will **always** be an OSI-approved version of Plone. - - -## Questions and answers - -What does the Contributor's Agreement cover? - -> This agreement is for the Plone core codebase only. -> The Plone core codebase is that code which lives in the Plone core version repositories, currently located at [https://github.com/plone]. -> Contributions to the "Collective", currently located at [https://github.com/collective] are not assigned to the Plone Foundation, and are made available under whatever license the project developers wish to use, although add-on products that import from GPLed Plone code are of course subject to the terms of the GPL, which requires derived works to be GPL licensed. - -What rights will I continue to have for my contributions? - -> Contributors are asked to transfer their intellectual property rights to the Foundation. -> In return, they will be given back irrevocable rights to use and distribute their contributions. -> They can even give their contributions to other Open Source projects (as long as those projects are compatible with the license Plone itself is issued under) or use them in non-Open Source commercial applications (if that is compatible with the license Plone is under). - -Do I have to sign the contributor's agreement to make changes to the Plone core codebase? - -> Yes. - -Do I have to sign the contributor's agreement to submit a patch to the Plone core codebase? - -> We enthusiastically welcome patches, but we can't merge them until you sign and return a contributor's agreement. -> (Unless, in the judgement of the Plone Release Manager, the patch is so tiny as not to constitute a "creative work". -> See the [Policy for Contributor Agreements and Patches] for more detail on this policy.) - -Can I grant the Plone foundation a non-exclusive license to my contributions rather than an exclusive license, so that I can contribute the same code to other projects under different terms or use the contribution for other commercial endeavors? - -> Not under the current version of the contributors agreement. - -Does the Foundation control use of the Plone trademark? - -> Yes. -> In order to keep the trademark, the Foundation (or any trademark owner) must demonstrate that they have acted to protect it. - -Will Plone always be available under an OSI-approved/Open Source license? -Couldn't the Board change its mind about this? - -> Plone will always be available under an OSI-approved license; this is written into the language of the contributor agreement each developer and the foundation sign. - -Will Plone ever be available under a non-GPL license? - -> The current Plone approach states that companies can negotiate a non-GPL license. -> Thus, the Foundation might pursue a dual-licensing (GPL and non-GPL) scheme - -> but, at this time, the Board has not yet created any policies on this. -> This is an important question for the community, of course, and the Foundation intends to have this conversation in a transparent way. - -Why would anyone want a non-GPL Plone? - -> Two possible reasons: some companies are reluctant to do in-house modifications of framework-like systems (such as Plone) that are under the GPL, fearing that a clause in the GPL might force them to disclose their internal work - thus wanting to license it under (for example) a BSD-style license. -> Second, companies may wish to offer a commercial version of Plone, under a conventional shrink-wrap license, without the obligation to reveal source code or share changes. - -How much would a non-GPL version of Plone cost? - -> Would a small company be able to afford one? -> Neither the Foundation nor the Board have made any decisions about a non-GPL version, let alone about pricing. -> However, one of the Foundation's stated goals is to maintain a level playing field for Plone while trying to benefit all of the Plone commons. -> If a non-GPL version was available, and a large company bought it, -> added features to it, and sold it, wouldn't they be using our work without an obligation to give back? -> It's helpful to remember the core value open source provides: distributed development, maintenance, security checking, and support. -> Companies that build large features for Plone are **already** having to make decisions of whether to release their products under an open source license or not (since they could always release them as a Product, not as a modification to the Plone core). -> Despite this, though, many large and excellent contributions—such as Archetypes—have been made, and the Foundation hopes that companies will continue to do so. -> In any event, a company that purchases a non-GPL license (should such ever become available) is contributing financial resources to our community, which can be used to further develop, market, and protect the GPL version of Plone. - -- https://plone.org/foundation/contributors-agreement/agreement.pdf -- https://github.com/collective -- https://github.com/plone -- [Policy for Contributor Agreements and patches](https://plone.org/foundation/materials/foundation-resolutions/patch-policy-052011) diff --git a/coredev/culture.md b/coredev/culture.md deleted file mode 100644 index 545b90996a..0000000000 --- a/coredev/culture.md +++ /dev/null @@ -1,30 +0,0 @@ ---- -myst: - html_meta: - "description": "Plone developer culture" - "property=og:description": "Plone developer culture" - "property=og:title": "Plone developer culture" - "keywords": "Plone, developer, culture" ---- - -```{todo} -This content is probably redundant and should be purged. -``` - -# Plone developer culture - -If you are going to contribute to Plone, we ask a couple things. -First, please join the [Plone forum](https://community.plone.org) and at minimum lurk around. -You will quickly see how people work and what kind of things are best suited for group discussion. -Second, please ask for help setting up your environment, in the forum. - -Most of our developers work there and you will get the best advice there. - -If you are actively committing code, always keep an eye on our [Jenkins CI](https://jenkins.plone.org/) to know if your recent commits have broken (or fixed!) the build. - -If you are in a timezone when things are not very active, please post to the forum or grab a drink and wait for people to wake up. - -**When in doubt, please ask** - -The code base is very complicated and everyone is vested in the right thing happening. -Despite the occasional grouch here and there, most Plone developers will go out of their way to get you on the right path. diff --git a/coredev/getting-started-with-development.md b/coredev/getting-started-with-development.md deleted file mode 100644 index 5975adc21d..0000000000 --- a/coredev/getting-started-with-development.md +++ /dev/null @@ -1,387 +0,0 @@ ---- -myst: - html_meta: - "description": "Getting started with Plone development" - "property=og:description": "Getting started with Plone development" - "property=og:title": "Getting started with Plone development" - "keywords": "Plone, development" ---- - -# Getting started with development - -This document assumes you want to run the current latest Plone source, fix a bug in Plone, or test an add-on in the context of the latest code, and will detail the full process. -For how to write Plone Improvement Proposals (PLIPs), read {doc}`plips`. - - -## Version support policy - -If you are triaging or fixing bugs, keep in mind that Plone has a [version support policy](https://plone.org/download/release-schedule#91815aec-0513-40e0-a804-55ea787a8c68). - - -## Dependencies - -- git. See [Set up Git](https://docs.github.com/en/get-started/quickstart/set-up-git). -- [Python](https://python.org/). See the [current supported versions of Python](https://plone.org/download/release-schedule). -- If you are on macOS, you will need to install [XCode](https://developer.apple.com/xcode/). - You can do this through the App Store or registering through the Apple Developer Program. -- [Pillow](https://pypi.org/project/Pillow/). -- [GCC](https://gcc.gnu.org/) in order to compile ZODB, Zope and lxml. -- [libxml2 and libxslt](https://gitlab.gnome.org/GNOME/libxslt/-/releases), including development headers. - - -(setup-development-environment)= - -## Set up your development environment - -The first step in fixing a bug is getting this [buildout](https://github.com/plone/buildout.coredev) running. -We recommend fixing the bug on the latest branch, and then [backporting](https://en.wikipedia.org/wiki/Backporting) as necessary. -Dependent on the current development cycle, there may exist a future branch. -For example, `6.0` is the actively maintained stable branch. -[Some other branch] is the future, currently unstable, active development branch. -More information on switching release branches is described below. - -To set up a plone 6 development environment. - -```shell -cd ~/projects # or wherever you want to put things -git clone -b 6.0 https://github.com/plone/buildout.coredev ./plone6devel -cd ./plone6devel -./bootstrap.sh -``` - -If you run into issues in this process, please see {doc}`troubleshooting`. - -This will run for a long time if it is your first pull (approximately 20 minutes). -Once that is done pulling down eggs, you can start your new instance with: - -```shell -./bin/instance fg -``` - -or as a WSGI service with: - -```shell -./bin/wsgi -``` - -To login, the defaults are: - -- username: admin -- password: admin - - -## Switching branches - -If your bug is specific to one branch, or you think it should be backported, you can switch branches. -The first time you get a branch, you must do: - -```shell -git checkout -t origin/6.0 -``` - -This should set up a local 6.0 branch tracking the one on GitHub. -From then on you can just do: - -```shell -git checkout 6.0 -``` - -To see what branch you are currently on: - -```shell -git branch -``` - -The line with a `*` by it will indicate the branch on which you are currently working. - -```{important} -Make sure to rerun buildout if you were in a different branch earlier to get the correct versions of packages, otherwise you will get some weird behavior. -``` - - -## Jenkins and mr.roboto - -Plone has a continuous integration (CI) setup and follows CI rules. - -When you push a change to any Plone package, our testing/CI middleware `mr.roboto` starts running all the tests that are needed to make sure that you don't break anything. -For each Plone and Python version we run two jobs, one for the package itself (which will give you a fast feedback, within 10 minutes) and one on the full `coredev` build (which can take up to an hour, but makes sure no other packages are effected by your change. - -For more information you can read {doc}`Mr. Roboto workflow ` or our [Jenkins machine](https://jenkins.plone.org/). - -The CI system at `jenkins.plone.org` is a shared resource for Plone developers to notify them of regressions in Plone code. -Build breakages are a normal and expected part of the development process. -Our aim is to find errors and eliminate them as quickly as possible, without expecting perfection and zero errors. -Though, there are some essential practices that need to be followed in order to achieve a stable build: - -1. Don't check in on a broken build. Check Jenkins first. -2. Always run all commit tests locally before committing. -3. Wait for commit tests to pass before moving on. -4. Never go home on a broken build. -5. Always be prepared to revert to the previous revision. -6. Time-box fixing before reverting. -7. Don't comment out failing tests. -8. Take responsibility for all breakages that result from your changes. - -See {doc}`continous-integration` for more information. - -Since it can be burdensome to check this manually, install the tools locally to always see the current state of the Plone CI Server: - -- For Linux and X11 environments, there is [BuildNotify](https://pypi.org/project/BuildNotify/). -- For macOS there is [CCMenu](http://ccmenu.org/). -- For windows there is [CCTray](https://cruisecontrolnet.org/cctray_download_plugin-2/). -- For Firefox there is [CruiseControl Monitor](https://addons.thunderbird.net/EN-US/firefox/addon/cruisecontrol-monitor/?src=cb-dl-name) (no longer supported), and many other [Jenkins plugins](https://addons.mozilla.org/en-US/firefox/search/?q=jenkins). - -These tools were built to parse a specific file that CruiseControl, another CI tool, generated. -Jenkins generates this file too. -You can configure your notifier of choice with this url: `https://jenkins.plone.org/cc.xml` [which is a 404, LOL!] - - -## Check out packages to fix - -Most packages are not in {file}`src/` by default, so you can use `mr.developer` to get the latest and make sure you are always up to date. -It can be a little daunting at first to find out which packages cause the bug in question, but just ask in https://community.plone.org/ if you need some help. -Once you know which packages you want, pull their source. - -You can get the source of the package with `mr.developer` and the checkout command, or you can go directly to editing {file}`checkouts.cfg`. -We recommend the latter but will describe both. -In the end, {file}`checkouts.cfg` must be configured, so you might as well start there. - -At the base of your buildout, open {file}`checkouts.cfg` and add your package if it's not already there: - -```cfg -auto-checkout = - # my modified packages - plone.app.caching - plone.caching - # others - ... -``` - -Then rerun buildout to get the source packages: - -```shell -./bin/buildout -``` - -Alternatively, we can manage checkouts from the command line, by using `mr.developer`'s `bin/develop` command to get the latest source. -For example, if the issue is in `plone.app.caching` and `plone.caching`: - -```shell -./bin/develop co plone.app.caching -./bin/develop co plone.caching -./bin/buildout -``` - -Don't forget to rerun buildout! -In both methods, `mr.developer` will download the source from GitHub (or otherwise) and put the package in the {file}`src/` directory. -You can repeat this process with as many or as few packages as you need. -For some more tips on working with `mr.developer`, please read {doc}`mrdeveloper`. - - -## Testing Locally - -To run a test for the specific module you modify: - -```shell -./bin/test -m plone.app.caching -``` - -These should all run without error. -Please don't check in anything that doesn't succeed! -Now write a test case for the bug you are fixing, and make sure everything is running as it should. - -After the module level tests run with your change, please make sure other modules aren't affected by the change by running the full suite, including robot-tests (remove the `--all` to run without robot tests): - -```shell -./bin/test --all -``` - -```{note} -Tests take a long time to run. -Once you become a master of bugfixes, -you may just let jenkins do this part for you. -More on that below. -``` - - -## Updating `CHANGES.rst` and `checkouts.cfg` - -Once all the tests are running locally on your machine, you are **ALMOST** ready to commit the changes. -You must perform a couple housekeeping chores before moving on. - -First, edit {file}`CHANGES.rst` (or {file}`CHANGES.txt`, or {file}`HISTORY.txt`) in each package you have modified and add a summary of the change. -This change note will be collated for the next Plone release and is important for integrators and developers to be able to see what they will get if they upgrade. -New changelog entries should be added at the very top of {file}`CHANGES.rst`. -Some packages already switched to use [towncrier](https://pypi.org/project/towncrier/). -If this is the case you'll find a note at the top of the `CHANGES.rst` file. - -Most importantly, if you didn't do it earlier, edit the file {file}`checkouts.cfg` in the buildout directory, and add your changes package to the `auto-checkout` list. -This lets the release manager know that the package has been updated, so that when the next release of Plone is cut, a new egg will be released, and Plone will need to pin to the next version of that package. -In other words, this is how your fix becomes an egg! - -Note that there is a section separator called "# Test Fixes Only". -Make sure your egg is above that line, else your egg probably won't get made very quickly. -This just tells the release manager that any eggs below this line have tests that are updated, but no code changes. - -Modifying the file {file}`checkouts.cfg` also triggers the buildbot, [jenkins](https://jenkins.plone.org/), to pull in the egg and run all the tests against the changes you just made. -Not that you would ever skip running all tests. - -If your bug is in more than one release, for example 5.2 and 6.0, please checkout both branches, and add it to the file {file}`checkouts.cfg`. - - -## Commits and pull requests - -Review the following checklist: - -- Did you fix the original bug? -- Is your code consistent with our [Style Guides](https://5.docs.plone.org/develop/styleguide/index.html)? -- Did you remove any extra code and lingering pdbs? -- Did you write a test case for that bug? -- DO all test cases for the modules and Plone pass? -- Did you update {file}`CHANGES.rst` in each packages you touched? -- Did you add your changed packages to {file}`checkouts.cfg`? - -If you answered *YES* to all of these questions, then you are ready to push your changes! -A couple quick reminders: - -- Only commit directly to the development branch if you're confident that your code won't break anything badly and the changes are small and fairly trivial. - Otherwise, please create a `pull request` (more on that below). -- Please try to make one change per commit. - If you are fixing three bugs, make three commits. - That way, it is easier to see what was done when, and easier to roll back any changes if necessary. - If you want to make large changes cleaning up whitespace or renaming variables, it is especially important to do so in a separate commit for this reason. -- We have a few angels that follow the changes and each commit to see what happens to their favourite CMS! - If you commit something REALLY sketchy, they will politely contact you, most likely after immediately reverting changes. - There are no official people assigned to this so if you are especially nervous, ask in https://community.plone.org/. - - -## Commit to `Products.CMFPlone` - -If you are working a bug fix on `Products.CMFPlone`, there are a couple other things to take notice of. -First and foremost, you'll see that there are several branches. -At the time of writing this document, there are branches for 4.2.x, 4.3.x and master, which is the implied 5.0. -This may change faster than this documentation, so check the branch dropdown on GitHub. - -If the fix is only for one version, make sure to get that branch. -However, chances are the bug is in multiple branches. - -Let's say the bug starts in 4.1. -Pull the 4.1 branch and fix and commit there with tests. - -If your fix only involved a single commit, you can use git's `cherry-pick` command to apply the same commit to a different branch. - -First check out the branch: - -```shell -git checkout 4.2 -``` - -And then cherry-pick the commit (you can get the SHA hash from git log): - -```shell -git cherry-pick b6ff4309 -``` - -There may be conflicts. -If so, resolve them, then follow the directions git gives you to complete the cherry-pick. - -If your fix involved multiple commits, cherry-picking them one by one can get tedious. -In this case, things are easiest if you did your fix in a separate feature branch. - -In that scenario, you first merge the feature branch to the 4.1 branch: - -```shell -git checkout 4.1 -git merge my-awesome-feature -``` - -Then return to the feature branch, and make a branch for rebasing it onto the 4.2 branch: - -```shell -git checkout my-awesome-feature -git checkout -b my-awesome-feature-4.2 -git rebase ef978a --onto 4.2 -``` - -(`ef978a` happens to be the last commit in the feature branch's history before it was branched off of 4.1. -You can look at `git log` to find this.) - -At this point, the feature branch's history has been updated, but it hasn't actually been merged to 4.2 yet. -This lets you deal with resolving conflicts before you actually merge it to the 4.2 release branch. -Let's do that now: - -```shell -git checkout 4.2 -git merge my-awesome-feature-4.2 -``` - -### Branches and forks and direct commits - oh my! - -```{note} -This section needs a rewrite. -Meanwhile we do not allow direct commits, except in very rare cases. -``` - -Plone used to be in an svn repository, so everyone is familiar and accustomed to committing directly to the branches. -After the migration to GitHub, the community decided to maintain this spirit. -If you have signed the [contributor agreement](https://plone.org/foundation/contributors-agreement), you can commit directly to the branch. -For Plone, this would be the version branch, whereas for most other packages this would be `main`. - -HOWEVER, there are a few situations where a branch is appropriate. -If you: - -- are just getting started -- are not sure about your changes -- want feedback or code review -- are implementing a non-trivial change - -then you should create a branch of whatever packages you are using, and then use the [pull request](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/about-pull-requests) feature of GitHub to get review. -Everything about this process would be the same except you need to work on a branch. -Take the `plone.app.caching` example. -After checking it out with `mr.developer`, create your own branch with: - -```shell -cd src/plone.app.caching -git checkout -b my_descriptive_branch_name -``` - -```{note} -Branching or forking is your choice. -I prefer branching, and I'm writing the docs so this uses the branch method. -If you branch, it helps us because we *know* that you have committer rights. -Either way it's your call. -``` - -Proceed as normal. -When you are ready to push your fix, push to a remote branch with: - -```shell -git push origin my_descriptive_branch_name -``` - -This will make a remote branch in GitHub. -Navigate to this branch in the GitHub user interface, and on the top right, there will be a button that says {guilabel}`Pull Request`. -This will turn your request into a pull request on the main branch. -There are people who look once a week or more for pending pull requests and will confirm whether or not it's a good fix, and give you feedback where necessary. -The reviewers are informal and very nice, so don't worry. -They are there to help! -If you want immediate feedback, visit https://community.plone.org/ with the pull request link and ask for a review. - -```{note} -You still need to update the file {file}`checkouts.cfg` in the correct branches of `buildout.coredev`! -``` - - -## Finalize issues - -If you are working from an issue, please don't forget to go back to the issue, and add a link to the change set. -We don't have integration with GitHub yet so it's a nice way to track changes. -It also lets the reporter know that you care. -If the bug is really bad, consider pinging the release manager and asking them to make a release. - - -## FAQ - -How do I know when my package got made? -: You can follow the project on GitHub, and watch its [timeline](https://github.com/orgs/plone/dashboard). - You can also check the {file}`CHANGES.rst` of every plone release for a comprehensive list of all changes, and validate that yours is present. diff --git a/coredev/git.md b/coredev/git.md deleted file mode 100644 index 9c9034f756..0000000000 --- a/coredev/git.md +++ /dev/null @@ -1,642 +0,0 @@ ---- -myst: - html_meta: - "description": "" - "property=og:description": "" - "property=og:title": "" - "keywords": "" ---- - -```{todo} -I seriously question the value of this entire guide. -I think it should be purged. -Plone should not be in the business of teaching how to use git or GitHub. -``` - -# Working with Git and GitHub - -## The Plone Git workflow and branching model - -Our repository on GitHub has the following layout: - -- **feature branches**: - All development for new features must be done in dedicated branches, normally one branch per feature. -- **main** or **master** **branch**: - when features get completed they are merged into the master branch; bugfixes are commited directly on the master branch, -- **tags**: - whenever we create a new release, we tag the repository so we can later retrace our steps, or rerelease versions. - - -## Git basics - -Some introductory definitions and concepts, if you are already familiar enough with Git, head to next section: {ref}`general-guidelines-label`. - - -### Mental working model - -With Git (as well as all modern [DVCS](http://en.wikipedia.org/wiki/Distributed_revision_control)), distributing changes to others is a two steps process (contrary to traditional VCS like `svn`). - -This way what on svn is a single `svn ci` in Git is two commands: `git commit` and `git push`. - -This may seem to be a drawback, but instead it's a feature. - -**You are working locally until you decide to push your changes.** - -Not a single commit anymore, but a series of them, meaning that all those fears, concerns, doubts are taken away! - -You can freely fix/change/remove/rework/update/... your commits afterwards. - -Push your changes whenever you are sure they are what you, and others, expect them to be. - - -### Concepts - -In Git there are: - -commits - -: A patch made out of changes (additions, removals) on files tracked by Git. - -branches - -: Series of commits that have a name. - -tags - -: A name attached to a single commit. - -`HEAD` - -: A pointer that always tells you where you are (extremely useful when doing some operations). - -The index - -: A temporal staging storage with changes on files that are pending to be added to a commit. - If your Git output is colored, green filenames are those in the index. - -Working tree - -: Your current modified files. - This is the only place where you can loose your changes. - If your Git output is colored, red filenames are those in the working tree. - -Stash - -: Temporal storage for changes, again, extremely useful in some scenarios, see further below for examples. - -### Branches - -Another great feature of DVCS is cheap branching, i.e. branching in Git is effortless and really useful. -As it's no longer too much effort to branch, there is no need to always work on the master branch. - -A developer can branch easily for each fix/feature. - -Branches allow you to tinker with your changes while keeping the master branch clean. - -Not only that, it also allows you to keep modifying your changes until you and your peers are fine with them. - -Further documentation: -[Introduction to branching](http://git-scm.com/book/en/v2/Git-Branching-Branches-in-a-Nutshell). - -### Commands - -Some of the most useful/common commands (note that most of them have switches that enhance/*completely twist* their functionality): - -Just append `--help` on all of them to get their full definitions and options, -i.e. `git add --help`. - -clone - -: Download a repository from a given remote URL. - -add - -: Add the given files to the index. - - ```{note} - **pro tip**: once a file is add via `git add` your changes will never be lost! - As long as you don't remove the `.git` folder, even if you remove the file you just added, the changes you made before doing `git add` are still there ready to be recovered at any time! - ``` - -status - -: Get an overview of the repository status. - - If there are files on the index, or files not tracked by Git, or the status of your local branch with regards to the remote, etc. - -diff - -: See the current changes made to the files already tracked by Git. - - ```note} - Fear not, if you used `git add SOME_FILE` and then `git diff` doesn't output anything you haven't lost your changes! - - Just try `git diff --cached`. - Now you know how to see the working tree changes (`git diff`) and index changes (`git diff --cached`). - ``` - -commit - -: Create/record changes to the repository (locally only, nothing is sent over the wire). - -push - -: Send your changes, - either commits or a complete new branch, - to the configured remote repository. - -show - -: Display the given commit(s) details. - -log - -: Shows the repository history. - Sorted by date (last commit at the top), - and like all other commands, - extremely versatile with all its switches. - - See further below for an example of a powerful combination of switches. - -branch - -: Create a branch. - -fetch - -: Download changes from the remote repository. - - **Without** changing the current `HEAD` (see rebase and pull commands). - -pull - -: Fetch and integrate changes from remote repository. - - Internally that means to do a `git fetch` plus either `git merge` or `git rebase`. - - :::{note} - Used careless most probably adds extra superfluous commits. - See further down. - ::: - -merge - -: Join two, - or more, - branches together. - -rebase - -: Forward-port your current local commits (or branch) to be based on top of another commit. - - An image is worth 1000 words: - -checkout - -: Change to the given branch or get the given file to its latest committed version. - - :::{note} - If Git is criticized for being complex, - this command is one of the main sources of complains. - - You can compare it with `svn switch` if you happen to know it. - - Fear not though, - two main use cases are: - change branches and reset a file to its last committed version. - Still, - the syntax for both cases is really simple. - ::: - -cherry-pick - -: Apply a commit(s) to the current working branch. - -stash - -: Use a temporal storage to save/restore current changes still not meant to be used on a commit. - - :::{note} - Seems a bit not so useful on a first look, - but it is indeed. - - Think about this scenario: - you are working on your branch coding away. - All of the sudden you notice a small fix that should be done directly on master. - Thanks to `git stash` you can save your changes quickly and safely, - move to master branch, - do the quick fix, - commit and push it, - move back to your branch and `git stash pop` to recover your changes and continue hacking away. - ::: - -reflog - -: When things go bad you will **love** this command. - - It effectively shows you a histogram of what happened on the repository, - allowing you to rollback you repository to a previous stage. - - Extremely useful once a bad interactive rebase has happened. - -(general-guidelines-label)= - -## General guidelines - -### Pulling code - -Let's compare this two histories: - -``` -* 3333333 (HEAD, master) Merge branch 'feature-branch' into master -|\ -| * 2222222 (feature-branch) Last changes on feature-branch -| * 1111111 Merge branch 'master' into feature-branch -| |\ -| * | 0000000 More changes on feature branch -| * | fffffff Merge branch 'master' into feature-branch -| |\ \ -* | | | eeeeeee master keeps rocking -| |_|/ -|/| | -* | | ddddddd master goes and goes -| |/ -|/| -* | ccccccc master evolves -| * bbbbbbb First commit on feature-branch -|/ -* aaaaaaa commit on master # this is where feature-branch was created -``` - -With: - -``` -* 3333333 (HEAD, master) Merge branch 'feature-branch' into master -|\ -| * 2222221 (feature-branch) Last changes on feature-branch -| * 0000001 More changes on feature branch -| * bbbbbb1 First commit on feature-branch -|/ -* eeeeeee master keeps rocking -* ddddddd master goes and goes -* ccccccc master evolves -* aaaaaaa commit on master -``` - -What do we see above? Actually and contrary to what it seems, -exactly the same **result** -(as how the files and its content look like on commit `333333`). - -The second version is far more easy to understand what happened and removes two superfluous commits -(the two partial merges with master (`fffffff` and `1111111`). - -This happens if you have not properly configured `git pull`. -By default it does a `merge` meaning that an extra commit is always added, -tangling the history and making this more complex when looking back for what happened there. - -#### How to solve it? - -*ALWAYS* do a {command}`git pull --rebase` when fetching new code, -configure Git to do always so with: - -``` -git config branch.autosetuprebase always # add the --global switch to make it default everywhere -``` - -This way you do not introduce new extra commits and the Git history is kept as simple as possible. - -This is especially important when trying to understand why some changes were made, -or who did actually change that line, -etc. - -A couple of further explanations: - - - - -Search for `git merge vs rebase`, you will find plenty of literature. - -### Reviewing your changes - -After hacking for some minutes/hours/days you are finished and about to commit your changes, -great! - -*BUT*, -please, -do so with {command}`git add --patch`. - -The `--patch` (also `-p`) switch allows you to select which hunks you want to add on a commit. - -This is not only great to split changes into different commits, -but is also the time when you actually **review** your code before anyone else sees it. - -This is the time when you spot typos, pep8 errors, misaligned code, lack of docstrings in methods, -that a permission is not defined on Generic Setup, that an upgrade should be needed... - -Remember that the first code review is the one you do on your own. -Some inspiration/better phrasing: - - -And please, do remember the gold metric about reviewing code: - - -#### One commit does one thing - -Repeat with me: *One commit does one thing*. Period. - -When someone else needs to review your code, most probably she will give up or just skim over your code -if there are too many (unrelated) changes. - -Reviewing commits with +20 files doing all sorts of changes on them (maybe even unrelated) -is no fun and adds complexity and [cognitive load](http://en.wikipedia.org/wiki/Cognitive_load). - -Something that should mostly be a verification of a checklist like: - -- the browser view is registered on ZCML? - -- is there an interface for that form? - -- the pt and py are there? - -- ... - -Turns instead into a list of questions: - -- why is this interface renamed here if it has nothing to do with this adapter? -- all this removal of deprecated code while adding new features just mixes the diff, - am I missing something? -- *others* - -If you can not express what has been changed within 50 characters (suggested length of a commit message subject), -or you say it like "it does XXX and YYY", you most probably need to split that commit into, at least, -two or more commits. - -That doesn't mean that a +20 files or +100 lines of code changes are bad per se, you may be doing -a simple refactoring across lots of files, that's fine and good actually. - -As long as a commit is just and only about a specific purpose, and not a mixed selection of the following: - -- refactoring code -- moving things around -- fixing some bugs while at it -- adding some docs -- a new cool feature -- fixing typos on documentation -- pep8 fixes - -It is absolutely fine to refactor. - -And this is actually to help both your present self and your +5 years from now that will have to refactor that code of yours, -and maybe is struggling to understand what was going on there. - -Following this advice will: - -- keep things simple where there's no gain in adding complexity -- make your changes easy to be reviewed -- make later on lookups on those changes easy to follow - -### Making commits - -For commit messages see: {ref}`git_commit_message_style_guide`. - -#### Adding references to issues - -Always add the full URL to the issue/pull request you are fixing/referring to. - -Maybe within the Git repository it makes sense, but as soon as you are outside of it, it will not. - -Take into account mr.roboto automatic commits to buildout.coredev for example, if your commit message goes like *Fix for #33*, -which issue/pull request is that fixing? - -The one in buildout.coredev itself? On another issue tracker? Somewhere else? - -It would be far better if the commit goes instead like: - -``` -Brief description - -Further explanation. - -Fixes: https://github.com/plone/plone.app.discussion/issue/999 -``` - -#### Bad examples - -Some bad examples of commit messages: - - -Commit messages goes like *"Make note about how this interface is now for BBB only"*. - -Question: if it's BBB only, where is the new place to look for that interface now? - -The problem is that, in this case Martin, wrote that in 2009, so most probably once a refactor of that package -is done later on 2015, Martin is no longer around, and if he was, most probably he would not remember something from +6 years ago. - -Ask yourself a question: - -If someone comes to you asking details about a random commit done by you +5 years ago, what will you reply? - -Try that, get one project that you worked 5 years ago, get a random commit and: - -See if, just by reading the commit message, you are given enough information of what changes have been made, -when comparing the commit message and the actual code. -Does the commit message match the code changed? - -### Before pushing commits - -Code is reviewed, spread into nice isolated commits, descriptive enough commit messages are written, *what's left?* - -A final overview of what you are about to push. - -To do so, you can get an idea with the following Git alias (to be added on your `~/.gitconfig`): - -``` -[alias] - fulllog = log --graph --decorate --pretty=oneline --abbrev-commit --all -``` - -Now run {command}`git fulllog` on your Git repository, you will see a nice graph showing you the current situation. - -Maybe it makes you realize that commits need to be reordered, commit messages could get some improvements, -that you forgot to add a reference to an issue, ... - -## Pull requests - -Some specific tips and best practices for pull requests. - -### Always rebase - -Always rebase on top of the branch you want your changes to be merged before sending a pull request, -and as your pull request is still pending to be merged and the master branch evolves, keep rebasing it. - -To do so: - -``` -git checkout -git rebase master # or the branch you are targeting to integrate your changes to -# done! -# or if there are conflicts, -# fix them and follow instructions from git itself -``` - -The principle is, if you do merges with master, you are actually spreading your pull request into more commits, -and at the end making it more difficult to track what was changed. - -On top of that, the commit history is more complex to follow. - -See the history example above: {ref}`general-guidelines-label`. - -Unfortunately the flat view from GitHub prevents us from seeing that, -which is a shame. - -### One line one commit - -On a series of commits make sure the same code line is not changed twice, -the worst thing you can do to the one reviewing your changes, -is to make him/her spend time reviewing some code changes that one the next commit are changed again to do something else. - -It will not only make your commits smaller, but it will also make it easy to do atomic commits. - -### No cleanup commits please - -*On the context of a pull request* - -Ask yourself: What relation does a cleanup commit, say pep8 fixes or other code analysis fixes, -have with your pull request? - -Couldn't that pep8 fixes commit or small refactoring go straight into master branch? - -Or even if you send a pull request for it, chances are that it will be merged right away. -As long as it is a cleanup commit, there's not much to argue with it. - -The same goes with commits that improve or actually fix previous commits (within the same pull request). -A series of commits like this: - -``` -* 11ba28c Last fix, finally -* 11ba28c Fix tests, again -* 11ba28c Fix tests -* 11ba28c Do something fancy -* 11ba28c Failing test, we are doing TDD right? -``` - -Only tells you that the author did not take care at all about the one who will review it, -and specially about the person that in +5 years will try to understand that test. -Specially because now the test is not only spread between 4 commits, but most probably during those 5 years -it has already been refactored, maybe a {command}`git blame` will report that within that test method, -there are +5 related current commits to check, not nice right? - -#### Squashing commits - -To fix the previous example, run the following command: - -``` -git rebase ---interactive # which mostly is usually master -``` - -This allows you to rewrite the story of your branch. -See a more [elaborate description with examples](https://www.atlassian.com/git/tutorials/rewriting-history/git-rebase-i/). - -:::{note} -Be careful on not to run that on master itself! -Please take your time to really understand it. - -It's a really powerful tool, -and as [Stan Lee says](http://en.wikiquote.org/wiki/Stan_Lee), -it comes with great responsibility. -::: - -To actually make it easier you can do commits like this: - -``` -git commit --fixup HASH -``` - -Where `HASH` is the commit hash you want the changes you are about to commit be merged with. - -This way, when running {command}`git rebase --interactive`, Git will already reorder the commits as you already want. - -### No side changes - -That's an extension to the previous point. - -Keeping pull requests simple and to the point, without changes not related to the pull request itself, -will make your changes easier to understand and easier to follow. - -Again this applies: - - -### The review-change-push-review cycle - -After you have made a pull request, -you should ask for a review via the GitHub interface. - -After the review you will frequently have to do some changes of your PR, -perhaps add a missing changelog entry, and so on. - -When the changes are done, rebase your branch again -and squash any fixup-commits, all as described above. - -Finally you should force push your feature branch to GitHub. -Only force push on your own feature branches! -Never on branches shared with other people. - -After the update of your branch, -the GitHub PR interface will pick up the changes, -ready for returning to the reviewer, -and hopefully get a final go for the merge. - -## Recipes - -Assorted list of tips and tricks. - -### Change branches with uncommitted changes - -**Situation:** you are working on a pull request and while working on it founds that some cleanups are needed, -how to proceed forward? - -**Solution:** `git stash` or `git commit --amend -m"TMP"`. - -The basic idea here is: store your current changes safely (either on a Git stash commit or directly on a commit on the branch, -whichever you prefer), move to the canonical branch (`master` usually), do the fixes/cleanups/refactorings there, -commit those changes, rebase your branch on top of the changes you made, hack away. - -Command line version: - -``` -git stash # or git commit --amend -m"TMP" -git checkout master # or whatever happens to be the canonical branch name (i.e. 5.0 on buildout.coredev) -# do the cleanups && push them -git checkout your-branch # get back to your branch -git rebase master # again the canonical branch where you made the changes -git stash pop # or git reset HEAD^ if you did a git commit --amend -m"TMP" -# if needed, fix the conflicts, with patience and practise that's a piece of cake once you are used to -``` - -### Git visual applications - -Not everyone is a fan of the command line, for them there is a list of GUI clients on the official Git website: - - - -### Enhanced Git prompt - -Do one (or more) of the following: - -- -- -- - -### Git dotfiles - -Plone developers have dotfiles similar to these: -. - -## Learn more - -What's here is just the tip of the iceberg, there's plenty of Git knowledge on the web. - -A few good further resources are listed here (contributions welcome): - -- official online Git book: [Pro Git](http://git-scm.com/book/en/v2) -- PyCon 2015 talk: [Advanced Git by David Baumgold](https://www.youtube.com/watch?v=4EOZvow1mk4) diff --git a/coredev/guidelines.md b/coredev/guidelines.md deleted file mode 100644 index 6c9ea0236d..0000000000 --- a/coredev/guidelines.md +++ /dev/null @@ -1,57 +0,0 @@ ---- -myst: - html_meta: - "description": "" - "property=og:description": "" - "property=og:title": "" - "keywords": "" ---- - -```todo -This should probably be purged. -It is redundant to the default [CONTRUBITING.md](https://github.com/plone/.github/blob/main/CONTRIBUTING.md) and other files. -``` - -% Note: this page is linked to from CONTRIBUTING.rst in all packages. Keep it short! - -# Guidelines for contributing to Plone Core - -You probably came here by clicking one of the 'guidelines for contributing' links on GitHub. -You probably have an issue to report or you want to create a pull request. -Thanks a lot! -Let's bring you up to speed with the minimum you need to know to start contributing. - -## Create an issue - -- If you know the issue is for a specific package, you can add an issue there. - When in doubt, create one in the [CMFPlone issue tracker](https://github.com/plone/Products.CMFPlone/issues). - -- Please specify a few things: - - - What steps reproduce the problem? - - What do you expect when you do that? - - What happens instead? - - Which Plone version are you using? - -- If it is a visual issue, can you add a screen shot? - -- If there is an error in the Site Setup error log, please include it. - Especially a traceback is helpful. - Click on the 'Display traceback as text' link if you see it in the error log. - - -## Create a pull request - -- Legally, you can NOT contribute code unless you have signed the {doc}`contributor agreement `. - This means that we can NOT accept pull requests from you unless this is done, so please don't put the code reviewers at risk and do it anyways. -- Add a changelog entry as file in the news directory. - For helpful instructions, please see: -- For new features, an addition to README.rst is probably needed. - A package may include other documentation that needs updating. -- All text that can be shown in a browser must be translatable. - Please mark all such strings as translatable. -- Be nice and use code quality checkers like flake8 and jshint. -- See if you can use git to squash multiple commits into one where this makes sense. - If you are not comfortable with git, never mind. -- If after reading this you become hesitant: don't worry. - You can always create a pull request, mark it as WIP (work in progress), and improve the above points later. diff --git a/coredev/index.md b/coredev/index.md deleted file mode 100644 index 80eb9b6130..0000000000 --- a/coredev/index.md +++ /dev/null @@ -1,63 +0,0 @@ ---- -myst: - html_meta: - "description": "Development in Plone" - "property=og:description": "Development in Plone" - "property=og:title": "Development in Plone" - "keywords": "Developing, Plone, Contributing" ---- - -# Development in Plone - -This part describes the process of development in Plone. -It is primarily a technical resource for setting up your development environment, fixing bugs, and writing Plone Improvement Proposals (PLIPs). - - -## Plone Contributor Agreement - -You must sign the [Plone Contributor Agreement](https://plone.org/foundation/contributors-agreement). - -We can **NOT** accept pull requests from you until you have signed and returned the Contributor Agreement, and been approved. -Please don't put the code reviewers at risk by ignoring this requirement. - - -## Contents - -```{toctree} -:maxdepth: 2 - -guidelines -agreement -culture -getting-started-with-development -documentation -plips -issues -release -git -package-dependencies -``` - - -## Additional material - -These are some documents used as reference for this documentation. - -```{toctree} -:maxdepth: 1 - -contributors-agreement-explained -continous-integration -roboto -mrdeveloper -plip-review -``` - -```{todo} -The style guides are ancient and need to be overhauled. -``` - -Documenation's style is guided by Vale and the Microsoft Style Guide. -See [Contributing to Documentation](https://6.docs.plone.org/contributing/index.html). - -Our coding style guides are located at the [Plone Style Guide](https://5.docs.plone.org/develop/styleguide/index.html section. diff --git a/coredev/mrdeveloper.md b/coredev/mrdeveloper.md deleted file mode 100644 index 83d90a553f..0000000000 --- a/coredev/mrdeveloper.md +++ /dev/null @@ -1,36 +0,0 @@ ---- -myst: - html_meta: - "description": "mr.developer" - "property=og:description": "mr.developer" - "property=og:title": "mr.developer" - "keywords": "mr.developer" ---- - -# `mr.developer` - -This buildout uses `mr.developer` to manage package development. -See https://pypi.org/project/mr.developer/ for more information, or run `bin/develop help` for a list of available commands. - -The most common workflow to get all the latest updates is: - -```shell -git pull -bin/develop rb -``` - -This will get you the latest `coredev` configuration, checkout and update all packages via git and Subversion in src, and run buildout to configure the whole thing. - -From time to time you can check if some old cruft has accumulated: - -```shell -bin/develop st -``` - -If this prints any lines with a question mark in front, you can cleanup by: - -```shell -bin/develop purge -``` - -This will remove packages from {file}`src/` which are no longer needed, as they have been replaced by proper egg releases of these packages. diff --git a/coredev/packages-dependencies.md b/coredev/packages-dependencies.md deleted file mode 100644 index d6bcd581a1..0000000000 --- a/coredev/packages-dependencies.md +++ /dev/null @@ -1,354 +0,0 @@ ---- -myst: - html_meta: - "description": "This chapter describes the architecture of Plone's packages and dependencies." - "property=og:description": "This chapter describes the architecture of Plone's packages and dependencies." - "property=og:title": "Architecture: packages and dependecies" - "keywords": "Architecture, packages, dependecies, Plone" ---- - -# Architecture: packages and dependecies - -This chapter describes the architecture of Plone's packages and dependencies. - - -## Motivation - -In the past, lots of indirections were introduced in Plone's packages and dependecies. -Our goal in the long run is to untangle them and get a direct dependency graph. -This document shows the current state as an orientation. - - -## Overview - -There are multiple level of dependencies: - -- package level (`setup.py`/`setup.cfg`) -- Python level (imports) -- ZCML level (includes) -- testing (need for layers, such as functional testing) - -We do not have any circular dependencies at the package level anymore. -This was solved already. - -Nevertheless we have indirection on all other levels. -Since Plone consists of a lot of packages, it is complex to untangle those. - - -## Mental model - -A base mental model for how Plone is organized in Plone 6 since alpha 4 is shown in the following diagram: - -``` -┌────────────────────────────┐ -│ │ -│ On top of Products.CMFPlone│ -│ like: │ -│ - Plone │ -│ - plone.api │ -│ - plone.volto │ -│ - plone.app.iterate │ -│ - plone.app.update │ -│ │ -├────────────────────────────┤ -│ │ -│ Products.CMFPlone │ -│ │ -├────────────────────────────┤ -│ │ -│ The space between │ -│ │ -│ - most of plone.app.* │ -│ - but also some other │ -│ │ -├────────────────────────────┤ -│ │ -│ plone.base │ -│ │ -├────────────────────────────┤ -│ │ -│ The Foundations │ -│ │ -│ - Zope │ -│ - CMFCore │ -│ - PAS/PlonePAS │ -│ - plone.registry │ -│ - plone.dexterity │ -│ - plone.behavior │ -│ - .... │ -│ │ -└────────────────────────────┘ -``` - -As a rough model we have two packages as dividing lines: - -1. `Products.CMFPlone` -2. `plone.base` - - -## Packages in detail - -If we look deeper into those, we have more sub-dividers, but first group all into the three groups: - -Then, based on the 6.0.0.a4 release, these are the packages: - - -### Above `Products.CMFPlone` - -- Plone -- plone.api -- plone.app.iterate -- plone.app.upgrade -- plone.restapi -- plone.volto -- Products.CMFPlacefulWorkflow - - -### Between `Products.CMFPlone` and `plone.base` - -- collective.monkeypatcher -- plone.app.caching -- plone.app.content -- plone.app.contentlisting -- plone.app.contentmenu -- plone.app.contentrules -- plone.app.contenttypes -- plone.app.customerize -- plone.app.dexterity -- plone.app.discussion -- plone.app.event -- plone.app.i18n -- plone.app.intid -- plone.app.layout -- plone.app.linkintegrity -- plone.app.locales -- plone.app.lockingbehavior -- plone.app.multilingual -- plone.app.portlets -- plone.app.querystring -- plone.app.redirector -- plone.app.registry -- plone.app.relationfield -- plone.app.textfield -- plone.app.theming -- plone.app.users -- plone.app.uuid -- plone.app.versioningbehavior -- plone.app.viewletmanager -- plone.app.vocabularies -- plone.app.widgets -- plone.app.workflow -- plone.app.z3cform -- plone.browserlayer -- plone.cachepurging -- plone.contentrules -- plone.formwidget.namedfile -- plone.formwidget.recurrence -- plone.i18n -- plone.namedfile -- plone.outputfilters -- plone.portlet.collection -- plone.portlet.static -- plone.portlets -- plone.protect -- plone.resourceeditor -- plone.rfc822 -- plone.schemaeditor -- plone.session -- plone.staticresources -- plone.stringinterp -- plone.theme -- plonetheme.barceloneta -- Products.isurlinportal - - -### The foundation below `plone.base` - - -#### Plone world - -- borg.localrole -- plone.alterego -- plone.autoform -- plone.autoinclude -- plone.batching -- plone.behavior -- plone.caching -- plone.dexterity -- plone.event -- plone.folder -- plone.indexer -- plone.intelligenttext -- plone.keyring -- plone.locking -- plone.memoize -- plone.registry -- plone.resource -- plone.rest -- plone.scale -- plone.schema -- plone.subrequest -- plone.supermodel -- plone.transformchain -- plone.uuid -- plone.z3cform -- Products.DateRecurringIndex -- Products.ExtendedPathIndex -- Products.MimetypesRegistry -- Products.PlonePAS -- Products.PortalTransforms -- Products.statusmessages - - -#### Zope ecosystem - -- Chameleon -- diazo -- five.customerize -- five.intid -- five.localsitemanager -- icalendar -- Products.CMFCore -- Products.CMFDiffTool -- Products.CMFDynamicViewFTI -- Products.CMFEditions -- Products.CMFUid -- Products.DCWorkflow -- Products.ExternalMethod -- Products.GenericSetup -- Products.MailHost -- Products.PluggableAuthService -- Products.PluginRegistry -- Products.PythonScripts -- Products.Sessions -- Products.SiteErrorLog -- Products.StandardCacheManagers -- Products.ZopeVersionControl -- repoze.xmliter -- webresource -- z3c.caching -- z3c.form -- z3c.formwidget.query -- z3c.objpath -- z3c.pt -- z3c.relationfield -- z3c.zcmlhook -- zc.recipe.egg -- zc.relation -- zodbverify -- zope.copy -- zope.intid -- zope.keyreference - - -#### Zope core - -- AccessControl -- Acquisition -- AuthEncoding -- beautifulsoup4 -- BTrees -- DateTime -- DocumentTemplate -- ExtensionClass -- Missing -- MultiMapping -- Persistence -- persistent -- Products.BTreeFolder2 -- Products.ZCatalog -- Record -- RestrictedPython -- transaction -- zc.lockfile -- ZConfig -- zdaemon -- ZEO -- zExceptions -- ZODB -- ZODB3 -- zodbpickle -- Zope -- zope.annotation -- zope.app.locales -- zope.browser -- zope.browsermenu -- zope.browserpage -- zope.browserresource -- zope.cachedescriptors -- zope.component -- zope.componentvocabulary -- zope.configuration -- zope.container -- zope.contentprovider -- zope.contenttype -- zope.datetime -- zope.deferredimport -- zope.deprecation -- zope.dottedname -- zope.event -- zope.exceptions -- zope.filerepresentation -- zope.globalrequest -- zope.hookable -- zope.i18n -- zope.i18nmessageid -- zope.interface -- zope.lifecycleevent -- zope.location -- zope.pagetemplate -- zope.processlifetime -- zope.proxy -- zope.ptresource -- zope.publisher -- zope.ramcache -- zope.schema -- zope.security -- zope.sendmail -- zope.sequencesort -- zope.site -- zope.size -- zope.structuredtext -- zope.tal -- zope.tales -- zope.testbrowser -- zope.testing -- zope.traversing -- zope.viewlet -- Zope2 - - -#### Libraries - -- attrs -- cffi -- cssselect -- decorator -- docutils -- feedparser -- future -- importlib_metadata -- jsonschema -- Markdown -- multipart -- Paste -- PasteDeploy -- piexif -- Pillow -- pycparser -- PyJWT -- pyrsistent -- python_dotenv -- python_gettext -- requests -- roman -- sgmllib3k -- simplejson -- soupsieve -- Unidecode -- urllib3 -- waitress -- WebOb -- WebTest -- WSGIProxy2 -- zipp diff --git a/coredev/plip-review.md b/coredev/plip-review.md deleted file mode 100644 index 78aed655ad..0000000000 --- a/coredev/plip-review.md +++ /dev/null @@ -1,115 +0,0 @@ ---- -myst: - html_meta: - "description": "PLIP review" - "property=og:description": "PLIP review" - "property=og:title": "PLIP review" - "keywords": "PLIP, review, Plone Improvement Proposal, Plone" ---- - -# PLIP review - -A Plone Improvement Proposal (PLIP) is a formal process to propose a change to improve Plone. - - -## Expectations - -A good PLIP review takes about four hours. -Please plan accordingly. -When you are done, if you have access to core, commit the review to the `plips` folder, and reference the PLIP in your commit message. -If you do not have access, attach your review to the PLIP ticket itself. - - -## Setting up the environment - -Follow the instructions in {doc}`getting-started-with-development`. -You will need to checkout the branch to which the PLIP is assigned. -Instead of running the buildout with the default buildout file, you will run the configuration specific to that PLIP: - -```shell -./bin/buildout -c plips/plipXXXX.cfg -``` - - -## Functionality review - -This section describes the topics that may be addressed in a PLIP review, depending on the nature of the PLIP itself. - - -### General - -- Does the PLIP actually do what the implementers proposed? - Are there incomplete variations? -- Were there any errors running buildout? - Did the migration(s) work? -- Do error and status messages make sense? - Are they properly internationalized? -- Are there any performance considerations? - Has the implementer addressed them, if so? - - -### Bugs - -- Are there any bugs? - Nothing is too big nor small. -- Do fields handle wacky data? - How about strings in date fields, or nulls in required? -- Is validation up to snuff and sensical? - Is it too restrictive or not restrictive enough? - - -### Usability Issues - -- Is the implementation usable? -- How will novice end users respond to the change? -- Does this PLIP need a usability review? - If you think this PLIP needs a usability review, change the state to "please review" and add a note in the comments. -- Is the PLIP consistent with the rest of Plone? - For example, if there is control panel configuration, does the new form fit in with the rest of the panels? -- Does everything flow nicely for novice and advanced users? - Is there any workflow that feels odd? -- Are there any new permissions and do they work properly? - Does their role assignment make sense? - - -### Documentation Issues - -- Is the corresponding documentation for the end user, be it developer or Plone user, sufficient? -- Is the change itself properly documented? - -Report bugs or issues on GitHub as you would for any Plone bug. -Reference the PLIP in the bug, assign to its implementer, and add a tag for the PLIP in the form of `plip-xxx`. -This way the implementer can find help if they need it. -Also set a priority for the ticket. -The PLIP will not be merged until all blockers and critical bugs are fixed. - - -### Code Review - - -#### Python - -- Is this code maintainable? -- Is the code properly documented? -- Does the code adhere to PEP8 standards (more or less)? -- Are they importing deprecated modules? - - -#### JavaScript - -- Does the JavaScript meet our set of JavaScript standards? - See our section about [JavaScript](https://5.docs.plone.org/develop/addons/javascript/index.html) and the [JavaScript Style Guide](https://5.docs.plone.org/develop/styleguide/javascript.html). -- Does the JavaScript work in all currently supported browsers? - Is it performant? - -```{todo} -Update links from Plone 5 Documentation to Plone 6 Documentation, when they exist. -See https://github.com/plone/documentation/issues/1330 -``` - -#### ME/TAL - -- Does the PLIP use views appropriately, avoiding too much logic? -- Is there any code in a loop that could potentially be a performance issue? -- Are there any deprecated or old style ME/TAL lines of code, such as using `DateTime`? -- Is the rendered HTML compliant with standards? Are IDs and classes used appropriately? diff --git a/coredev/plips.md b/coredev/plips.md deleted file mode 100644 index 408793d471..0000000000 --- a/coredev/plips.md +++ /dev/null @@ -1,295 +0,0 @@ ---- -myst: - html_meta: - "description": "Plone Improvement Proposals (PLIPs)" - "property=og:description": "Plone Improvement Proposals (PLIPs)" - "property=og:title": "Plone Improvement Proposals (PLIPs)" - "keywords": "Plone Improvement Proposal, PLIP)" ---- - -# Plone Improvement Proposals (PLIPs) - -A PLIP is a Plone Improvement Proposal. -It is a change to a Plone package that would affect everyone. -PLIPs go through a different process than bug fixes because of their broad reaching effect. -The Plone Framework Team reviews all PLIPs to be sure that it's in the best interest of the broader community to be implemented and that it is of high quality. - - -## Frequently asked questions about PLIPs - -This section provides detailed answers to common questions about PLIPs. - - -### PLIP or bugfix? - -In general, anything that changes the API of Plone in the backend or the user interface (UI) on the front end should be filed as a PLIP. -When in doubt, submit it as a PLIP. -The Framework Team is eager to reduce its own workload and will reclassify it for you. -If the change you are proposing is not in the scope of a PLIP, a GitHub pull request or issue is the right format. -The key point here is that each change must be documented, allowing it to be tracked and understood. - - -### Who can submit PLIPs? - -Anyone who has signed a Plone Contributor Agreement can work on a PLIP. -Don't let the wording freak you out: signing the agreement is easy and you will get access almost immediately. - -You do not have to be the most amazing coder in the entire world to submit a PLIP. -The Framework Team is happy to help you at any point in the process. - -Submitting a PLIP can be a great learning process. -We encourage people of all backgrounds to submit a PLIP. -When the PLIP is accepted, a Framework Team member will "champion" your PLIP and be dedicated to its completion. - -PLIPs are not just for code monkeys. -If you have ideas on new interactions or UI your ideas are more than welcome. - -We will help you pair up with implementers if needed. - - -### What is a PLIP champion? - -When you submit your PLIP and it is approved, a Framework Team member who is especially excited about seeing the PLIP completed will be assigned to your PLIP as a champion. - -They are there to push you through completion, as well as answer any questions and provide guidance. - -A champion fulfill the following tasks. - -- Answer any questions the PLIP implementor has, technical or otherwise. -- Encourage the PLIP author by constantly giving feedback and encouragement. -- Keep the implementer aware of timelines, and push to get things done on time. -- Assist with finding additional help when needed to complete the implementation in a timely matter. - -Keep in mind that champions are in passive mode by default. -If you need help or guidance, please reach out to them as soon as possible to activate help mode. - - -### Can I get involved in other ways? - -If you want to experience the process and how it works, help us review PLIPs as the implementations finish up. -Ask one of the Framework Team members what PLIPs are available for review, or check the status of PLIPs at the [GitHub issues](https://github.com/plone/Products.CMFPlone/issues) page -for [Products.CMFPlone](https://github.com/Plone/Products.CMFPlone) -for [issues tagged with "03 type: feature (plip)"](https://github.com/plone/Products.CMFPlone/labels/03%20type%3A%20feature%20%28plip%29). - -Make sure to let us know you intend to review the PLIP by communicating that to the [Framework Team](https://community.plone.org/c/development/framework-team). - -Then, follow the instructions for {doc}`reviewing a PLIP `. - -Thank you in advance! - - -### When can I submit a PLIP? - -Today, tomorrow, any time! - -After the PLIP is accepted, the Framework Team will try to judge complexity and time to completion, and assign it to a milestone. - -You can begin work immediately, and we encourage submitting fast and furious. - - -### When is the PLIP due? - -**Summary: As soon as you get it done.** - -Technically, we want to see it completed for the release to which it's assigned. -We know that things get busy, and new problems may make PLIPs more complicated, and we will push it to the next release. - -In general, we don't want to track a PLIP for more than a year. - -If your PLIP is accepted and we haven't seen activity in over a year, we will probably ask you to restart the whole process. - - -### What happens if your PLIP is not accepted? - -If a PLIP isn't accepted in core, it doesn't mean it's a bad idea. -It is often the case that there are competing implementations, and we want to see it vetted as an add-on before "blessing" a preferred implementation. - - -## Process Overview - -1. Submit a PLIP at any time. -2. PLIP is approved for inclusion into core for a given release. -3. Developer implements PLIP (code, tests, documentation). -4. PLIP is submitted for review by developer. -5. Framework Team reviews the PLIP and gives feedback. -6. Developer addresses concerns in feedback and re-submits the PLIP, if necessary. -7. This may go back and forth a few times, until both the Framework Team and developer are happy with the result. -8. PLIP is approved for merge. - In rare circumstances, a PLIP will be rejected. - This is usually the result of the developer not responding to feedback or dropping out of the process. - Hang in there! -9. After all other PLIPs are merged, a release is cut. - Standby for bugs! - - -(how-to-submit-a-plip)= - -## How to submit a PLIP - -Whether you want to update the default theme, or rip out a piece of architecture, everyone should go through the PLIP process. -If you need help at any point in this process, please contact a member of the Framework Team personally or ask for help at the [Framework Team Space](https://community.plone.org/c/development/framework-team). - -A PLIP is a [GitHub issue](https://github.com/plone/Products.CMFPlone/issues/new) on [`Products.CMFPlone`](https://github.com/Plone/Products.CMFPlone) with a special template and a specific tag. - -To get started, open a new issue. -The issue will be prefilled with headings and comments for a bug or a PLIP. -Remove the bug part. -Fill in all applicable fields. -After submitting, select the tag `03 type: feature (plip)` for the issues. - -When writing a PLIP, be as specific and to-the-point as you can. -Remember your audience. -To get support for your proposal, people will have to be able to read it! - -A good PLIP is sufficiently clear for a knowledgeable Plone user to understand the proposed changes, and sufficiently detailed for the release manager and other developers to understand the full impact the proposal would have on the code base. - -You don't have to list every line of code that needs to be changed, but you should also give an indication that you have some idea of how the change can be feasibly implemented. - -After your PLIP is written, solicit feedback on your idea on the [Plone Community Forum](https://community.plone.org/). -In this vetting process, you want to make sure that the change won't adversely affect other people on accident. -Others may be able to point out risks or even offer up better or existing solutions. - -Please note a few things: - -- It is very rare that the "Risks" section will be empty or none. -- If you find this is the case, and your PLIP is anything more than trivial, maybe some more vetting should be done. -- The seconder field is REQUIRED. - -We will send the PLIP back to you if it is not filled in. -Currently, this is just someone else who thinks your PLIP is a good idea, a +1. - -In the near future, we will start asking that the seconder is either a coding partner, or someone who is willing and able to finish the PLIP should something happen to the implementer. - - -### Evaluating PLIPs - -After you submit your PLIP, the Framework Team will meet within a couple weeks, and let you know if the PLIP is accepted. -If the PLIP is not accepted, please don't be sad! - -We encourage most PLIPs to go through the add-on process at first, if at all possible, to make sure the majority of the community uses it. - -All communication with you occurs on the PLIP issue itself. -Please keep your eyes and inbox open for changes. - -These are the criteria by which the framework team will review your work: - -- What is size and status of the work needed to be done? -- Is it already an add-on and well established? -- Is this idea well baked and expressed clearly? -- Does the work proposed belong in Plone now, or in the future? -- Is this PLIP more appropriate as a qualified add-on? -- Is this PLIP too risky? - -See the {doc}`plip-review` page for more information. - - -## Implementing your PLIP - -You can start the development at any time, but if you are going to modify Plone itself, it is a good idea to wait to see if your idea is approved. - - -### General Rules - -- Any new packages must be in a branch in the `plone` namespace in GitHub. - You don't have to develop there, but it must be there when submitted. - We recommend using branches off of the repositories under the Plone GitHub organization, and will detail that below. -- Most importantly, the PLIP reviewers must be able run buildout and everything should "just work"™. -- Any new code must: - - - Be {doc}`properly documented `. - - Have clear code. - - [Follow our style guides](https://5.docs.plone.org/develop/styleguide/index.html). - For convenience and better code quality use Python, JavaScript, and other code linting plugins in your editor. - - [Be tested](https://5.docs.plone.org/develop/testing/index.html). - -```{todo} -Update links from Plone 5 to Plone 6 Documentation, once content is migrated. -See https://github.com/plone/documentation/issues/1330 and other issues. -``` - - -### Creating a new PLIP branch - -Create a buildout configuration file for your PLIP in the `plips` folder. -Give it a descriptive name, starting with the PLIP number, for example, {file}`plip-1234-widget-frobbing.cfg`. - -The PLIP number is your PLIP's issue number. - -This file will define the branches you're working with in your PLIP, along with other buildout configuration. - -It should look something like the following, such as in a file {file}`plips/plip-1234-widget-frobbing.cfg`. - -```ini -[buildout] -extends = plipbase.cfg -auto-checkout += - plone.somepackage - plone.app.someotherpackage - -[sources] -plone.somepackage = git https://github.com/plone/plone.somepackage.git branch=plip-1234-widget-frobbing -plone.app.someotherpackage = git https://github.com/plone/plone.app.somepackage.git branch=plip-1234-widget-frobbing - -[instance] -eggs += - plone.somepackage - plone.app.someotherpackage -zcml += - plone.somepackage - plone.app.someotherpackage -``` - -Use the same naming convention when you branch existing packages. -You should always branch packages when working on PLIPs. - - -### Working on a PLIP - -To work on a PLIP, you bootstrap buildout, and then invoke buildout with your PLIP configuration: - -```shell -virtualenv . -./bin/pip install -r requirements.txt -./bin/buildout -c plips/plip-1234-widget-frobbing.cfg -``` - -If you are using a {file}`local.cfg` to extend your PLIP file with some changes that you do not want to commit accidentally, be aware that you need to override some settings from {file}`plipbase.cfg` to avoid some files being created in the {file}`plips` directory or in the directory above the buildout directory. -This is done as shown below. - -```ini -[buildout] -extends = plips/plip-1234-widget-frobbing.cfg -develop-eggs-directory = ./develop-eggs -bin-directory = ./bin -parts-directory = ./parts -sources-dir = ./src -installed = .installed.cfg - -[instance] -var = ./var -``` - - -### Finishing up - -Before marking your PLIP as ready for review, please add a file to give a set of instructions to the PLIP reviewer. -This file should be called {file}`plip__notes.txt`. -This should include, but is not limited to: - -- URLs pointing to all documentation created and updated -- Any concerns and issues still remaining -- Any weird buildout things - -Once you have finished, update your PLIP issue to indicate that it is ready for review. -The Framework Team will assign 2-3 people to review your PLIP. -They will follow the guidelines listed at {doc}`plip-review`. - -After the PLIP has been accepted by the Framework Team and the release manager, you will be asked to merge your work into the main development line. -Merging the PLIP in is not the hardest part, but you must think about it when you develop. - -You'll have to interact with a large number of people to get it all set up. -The merge may cause problems with other PLIPs coming in. -During the merge phase you must be prepared to help out with all the features and bugs that arise. - -If all went as planned, the next Plone release will carry on with your PLIP in it. -You'll be expected to help out with that feature after it's been released (within reason). diff --git a/coredev/roboto.md b/coredev/roboto.md deleted file mode 100644 index 89d42038f0..0000000000 --- a/coredev/roboto.md +++ /dev/null @@ -1,59 +0,0 @@ ---- -myst: - html_meta: - "description": "Mr. Roboto" - "property=og:description": "Mr. Roboto" - "property=og:title": "Mr. Roboto" - "keywords": "Mr. Roboto, mr.roboto, Plone" ---- - -# Mr. Roboto - -```{todo} -Add brief description of what is Mr. Roboto and what it does. -``` - -## GitHub push - -When a push happens on GitHub, `mr.roboto` is triggered and it starts to analyze the push. - -- If it's on `buildout-coredev`, it starts the job of the branch that has been pushed. - In this case, we send to `plone-cvs` the commit to keep track of the commits on that list. -- If it's on a package that's on the {file}`sources.cfg` of a `buildout-coredev`, it starts the coredev jobs that are linked to that package and a kgs job with that package. - This kgs job is a snapshot of the last working version of the `buildout.coredev` with the newest version of the package that is involved on the push. - These jobs are really fast, as we only test the package applied to the kgs Plone and Python version `coredev` buildout. -- If it's on a PLIP specification, it runs the job that is configured Through The Web on the `mr.roboto` interface at http://jenkins.plone.org/roboto/plips. - -```{todo} -`http://jenkins.plone.org/roboto/plips` is obsolete, and returns a 404 not found. -``` - - -## Job finishes - -When Jenkins finishes a job, it makes a callback to `mr.roboto`, which in turn does the following: - -- If it comes from a `coredev` job, when all the `coredev` jobs related to that push are finished, it writes a comment on the GitHub commit with all the information. - It does this one time only, with all the information, so no more empty mails from the GitHub notification system. -- If it comes from a kgs job and all the kgs jobs are finished, (that may take max 10 min) and some have failed, we send an email to the testbot mailing list saying that a commit failed on the kgs job. - We also send an email to [plone-cvs](https://sourceforge.net/projects/plone/lists/plone-cvs) with the information to keep track of all the commits. -- If it comes from a kgs job and all the kgs jobs are finished, and all are working, we send an email to [plone-cvs](https://sourceforge.net/projects/plone/lists/plone-cvs) with the information to keep track of all the commits. - -For all kgs jobs jenkins sends an email to the author with the results when is finished. - -All the notifications have an URL similar to http://jenkins.plone.org/roboto/get_info?push=9a183de85b3f48abb363fa8286928a10. - -```{todo} -http://jenkins.plone.org/roboto/get_info?push=9a183de85b3f48abb363fa8286928a10 is obsolete, and returns a 404 not found. -``` - -On this URL, there is the commit hash, who committed it, the diff, the files, and the result for each Jenkins job. - -- [plone-testbot](https://lists.plone.org/mailman/listinfo/plone-testbot) mailing list receives messages only when a test fails on the kgs environment, and may take up to ten minutes from the push. -- [plone-cvs](https://sourceforge.net/projects/plone/lists/plone-cvs) always has the commit, diff, and the information, and it may take ten minutes to get there after the push. -- The author receives the results of tests failing against kgs after ten minutes after the push. - -```{note} -In case of integration errors with other packages that may fail because of the push, kgs will not be aware of that. -It's important that at the end (and after the fifty minutes that takes the `coredev` jobs to complete), that you also check the latest version of `coredev` with your push. -``` diff --git a/coredev/troubleshooting.md b/coredev/troubleshooting.md deleted file mode 100644 index db636fd806..0000000000 --- a/coredev/troubleshooting.md +++ /dev/null @@ -1,182 +0,0 @@ ---- -myst: - html_meta: - "description": "Troubleshooting development issues in Plone" - "property=og:description": "Troubleshooting development issues in Plone" - "property=og:title": "Troubleshooting development issues in Plone" - "keywords": "Troubleshooting, development issues, Plone" ---- - -# Troubleshooting - -This chapter describes how to troubleshoot development issues in Plone. - - -## Buildout issues - -Buildout can be frustrating for those unfamiliar with parsing through autistic robot language. -These errors are almost always a quick fix, and a little bit of understanding goes a long way. - - -### Errors running `bootstrap.py` - -You may not even get to running buildout, and then you will already have an error. -Let's take this one for example: - -```console - File "/usr/local/lib/python2.6/site-packages/distribute-0.6.13-py2.6.egg/pkg_resources.py", line 556, in resolve - raise VersionConflict(dist,req) # XXX put more info here - pkg_resources.VersionConflict: (zc.buildout 1.5.1 (/usr/local/lib/python2.6/site-packages/zc.buildout-1.5.1-py2.6.egg), Requirement.parse('zc.buildout==1.5.2')) -``` - -Buildout has simply noticed that the version of buildout required by the file `bootstrap.py` you are trying to run does not match the version of buildout in your Python library. -In the error above, your system has buildout 1.5.1 installed and the `bootstrap.py` file wants to run with 1.5.2. - -To fix, you have a couple options. -First, you can force buildout to run with the version you already have installed by invoking the version tag. -This tells your Plone `bootstrap.py` file to play nicely with the version that you already have installed. -In the case of the error pasted above, that would be: - -```shell -python bootstrap.py --version=1.5.1 -``` - -I personally know that versions 1.4.4, 1.5.1, and 1.5.2 all work this way. - -The other option is to delete your current egg and force the upgrade. -In the case of the error above, delete the egg the system currently has, for example: - -```shell -rm -rf /usr/local/lib/python2.6/site-packages/zc.buildout-1.5.1-py2.6.egg -``` - -When you rerun bootstrap, it will look for the buildout of the egg, note that there isn't one, and then go fetch a new egg in the version that it wants for you. - -Do one of those and re-run bootstrap. - -One other thing of note is that running bootstrap effectively ties that Python executable and all of its libraries to your buildout. -If you have several Python installs, and want to switch which Python is tied to your buildout, simply rerun `bootstrap.py` with the new Python (and then rerun buildout). -You may get the same error above again, but now that you know how to fix it, you can spend that time drinking beer instead of smashing your keyboard. - -Hooray! - - -### When `mr.developer` is unhappy - -`mr.developer` is never unhappy, except when it is. -Although this technically isn't a buildout issue, it happens when running buildout, so I'm putting it under buildout issues. - -When working with the dev instance, especially with all the moving back and forth between GitHub and Subversion, you may have an old copy of a `src` package. -The error looks like: - -```console -mr.developer: Can't update package 'Products.CMFPlone' because its URL doesn't match. -``` - -As long as you don't have any pending commits, you just need to remove the package from {file}`src/` and it will recheck it out for you when it updates. - -You can also get such fun errors as: - -```console -Link to http://sphinx.pocoo.org/ ***BLOCKED*** by --allow-hosts -``` - -These are OK to ignore if and only if the lines following it say: - -```console -Getting distribution for 'Sphinx==1.0.7'. -Got Sphinx 1.0.7. -``` - -If buildout ends with warning you that some packages could not be downloaded, then chances are that package wasn't downloaded. -This is bad and could cause all sorts of whack out errors when you start or try to run things because it never actually downloaded the package. - -There are two ways to get this error to go away. - -The first is to delete all instances of host filtering. -Go through all the files and delete any lines which say `allow-hosts =` and `allow-hosts +=`. -In theory, by restricting which hosts you download from, buildout will go faster. -The point is that they are safely deletable. - -The second option is to allow the host that it is pointing to by adding something like this to your `.cfg`: - -```cfg -allow-hosts += sphinx.pocoo.org -``` - -Again, this is only necessary if the package wasn't found in the end. - - -### `mr.developer` path errors - -```console -ERROR: You are not in a path which has mr.developer installed (:file:`.mr.developer.cfg` not found). -``` - -When running any {command}`./bin/develop` command. - -To fix, do: - -```shell -ln -s plips/.mr.developer.cfg -``` - - -## Other random issues - -```{TODO} -These need to be revalidated -``` - - -### Dirty packages - -```console -ERROR: Can't update package 'Some package', because it's dirty. -``` - - -#### Fix - -`mr.developer` is complaining because a file has been changed or added, but not committed. - -Use `bin/develop update --force`. -Adding `*.pyc *~.nib *.egg-info .installed.cfg *.pt.py *.cpt.py *.zpt.py *.html.py *.egg` to your subversion configuration's `global-ignores` has been suggested as a more permanent solution. - - -### No module named zope 2 - -```console -ImportError: No module named Zope2" when building using a PLIP cfg file. -``` - -Appears to not actually be the case. -Delete {file}`mkzopeinstance.py` from {file}`bin/`, and rerun buildout to correct this if you're finding it irksome. - - -### Can't open file '/Startup/run.py' - -Two possible fixes. - -If you use Python 2.4 by mistake, use 2.6 instead. - -Or you may need to make sure you run `bin/buildout …` after `bin/develop …`. -Try removing {file}`parts/*`, {file}`bin/*`, {file}`.installed.cfg`, then re-bootstrap and re-run buildout, develop, buildout. - - -### Missing PIL - -{file}`pil.cfg` is included within this buildout to aid in PIL installation. -Run {command}`bin/buildout -c pil.cfg` to install. -This method does not work on Windows. -We're unable to run it by default. - - -### Modified egg issues - -{command}`bin/develop status` is showing that the `Products.CMFActionIcons` egg has been modified, but I haven't touched it. -And this is preventing `bin/develop up` from updating all the eggs. - -#### Fix - -Edit {file}`~/.subversion/config` and add `eggtest\*.egg` to the list of `global-ignores`. diff --git a/docs/_inc/_continuous-integration.md b/docs/_inc/_continuous-integration.md new file mode 100644 index 0000000000..4b29642242 --- /dev/null +++ b/docs/_inc/_continuous-integration.md @@ -0,0 +1,7 @@ +Plone project repositories use {term}`continuous integration` (CI) to run tests, ensure code quality, or provide previews for every contribution. +Plone uses GitHub workflows, Jenkins, Cypress, Read the Docs, and other services for CI. +All of a project's CI jobs must pass before a contribution may be accepted. + +```{seealso} +{doc}`/contributing/core/continuous-integration` +``` diff --git a/docs/_inc/_create-classic-ui-instance.md b/docs/_inc/_create-classic-ui-instance.md new file mode 100644 index 0000000000..2c768d90e3 --- /dev/null +++ b/docs/_inc/_create-classic-ui-instance.md @@ -0,0 +1,15 @@ + +Your instance starts in foreground mode. +This should be used only for troubleshooting or local demonstration purposes. + +Now you can visit `http://localhost:8080` in your browser. +Click the button {guilabel}`Create Classic UI Plone site`. + +Enter {guilabel}`username` of `admin`, and {guilabel}`password` of `admin`. + +Enter values in the form, and click the button {guilabel}`Create Plone Site`. + +You will be redirected to your new Classic UI Plone site. + +To stop the Plone instance in foreground mode, type {kbd}`ctrl-c`. + diff --git a/docs/_inc/_install-browser-reqs-classic-ui.md b/docs/_inc/_install-browser-reqs-classic-ui.md new file mode 100644 index 0000000000..3c5834310d --- /dev/null +++ b/docs/_inc/_install-browser-reqs-classic-ui.md @@ -0,0 +1,16 @@ +You can view the list of supported browsers for Classic UI at [Browserslist](https://browsersl.ist/#q=%3E%3D+0.5%25%0Alast+2+major+versions%0Anot+dead%0AChrome+%3E%3D+60%0AFirefox+%3E%3D+60%0AFirefox+ESR%0AiOS+%3E%3D+12%0ASafari+%3E%3D+12%0Anot+Explorer+%3C%3D+11). + +The supported web browsers for Classic UI are set according to [Bootstrap](https://getbootstrap.com/docs/5.3/getting-started/browsers-devices/#supported-browsers). +The following code snippet is the [browserslist configuration for Bootstrap 5.3.3](https://github.com/twbs/bootstrap/blob/v5.3.3/.browserslistrc). + +```shell +>= 0.5% +last 2 major versions +not dead +Chrome >= 60 +Firefox >= 60 +Firefox ESR +iOS >= 12 +Safari >= 12 +not Explorer <= 11 +``` diff --git a/docs/_inc/_install-pillow.md b/docs/_inc/_install-pillow.md new file mode 100644 index 0000000000..acd418fdd0 --- /dev/null +++ b/docs/_inc/_install-pillow.md @@ -0,0 +1,24 @@ +``````{note} +After generating a project, then running `make install`, if you see an error message `ERROR: Failed building wheel for Pillow` or `The headers or library files could not be found for jpeg, a required dependency when compiling Pillow from source.`, then you need to install Pillow's dependencies. + +`````{tab-set} + +````{tab-item} macOS +```shell +brew install zlib libjpeg +``` +```` + +````{tab-item} Linux +```shell +apt install zlib1g-dev libjpeg8-dev +``` +```` +````` + +You will then need to run `make install` again. + +```{seealso} +See also the Pillow documentation [External Libraries](https://pillow.readthedocs.io/en/latest/installation/building-from-source.html#external-libraries) for additional libraries that you might need. +``` +`````` diff --git a/docs/_inc/_install-python-plone61.md b/docs/_inc/_install-python-plone61.md new file mode 100644 index 0000000000..b819d58578 --- /dev/null +++ b/docs/_inc/_install-python-plone61.md @@ -0,0 +1,9 @@ +Installing Python is beyond the scope of this documentation. +However, it is recommended to use a Python version manager, {term}`pyenv`, that allows you to install multiple versions of Python on your development environment without destroying your system's Python. + +```{warning} +Do not create or activate a Python virtual environment at this time. +The instructions below will create one. +``` + +Plone 6.1 requires Python version {{SUPPORTED_PYTHON_VERSIONS_PLONE61}}. diff --git a/docs/_static/classic-ui.png b/docs/_static/classic-ui.png new file mode 100644 index 0000000000..595d0b0fe3 Binary files /dev/null and b/docs/_static/classic-ui.png differ diff --git a/docs/_static/conceptual-guides/xkcd-1987-python-environment.png b/docs/_static/conceptual-guides/xkcd-1987-python-environment.png new file mode 100644 index 0000000000..a8e8fd619e Binary files /dev/null and b/docs/_static/conceptual-guides/xkcd-1987-python-environment.png differ diff --git a/docs/_static/contributing/core/icon-build-now.svg b/docs/_static/contributing/core/icon-build-now.svg new file mode 100644 index 0000000000..70b5d54b25 --- /dev/null +++ b/docs/_static/contributing/core/icon-build-now.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/docs/_static/contributing/core/icon-retry.svg b/docs/_static/contributing/core/icon-retry.svg new file mode 100644 index 0000000000..cd349c5073 --- /dev/null +++ b/docs/_static/contributing/core/icon-retry.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/docs/_static/contributing/core/icon-terminal.svg b/docs/_static/contributing/core/icon-terminal.svg new file mode 100644 index 0000000000..9f15c271a8 --- /dev/null +++ b/docs/_static/contributing/core/icon-terminal.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/docs/_static/contributing/git-commit-submodule.jpg b/docs/_static/contributing/git-commit-submodule.jpg new file mode 100644 index 0000000000..f4bd9b45f0 Binary files /dev/null and b/docs/_static/contributing/git-commit-submodule.jpg differ diff --git a/docs/_static/contributing/github-navigation.png b/docs/_static/contributing/github-navigation.png new file mode 100644 index 0000000000..6c3da925ed Binary files /dev/null and b/docs/_static/contributing/github-navigation.png differ diff --git a/docs/_static/custom.css b/docs/_static/custom.css deleted file mode 100644 index 41bdd4361a..0000000000 --- a/docs/_static/custom.css +++ /dev/null @@ -1,468 +0,0 @@ -:root { - /* Add Font Awesome 5 icon and color for todo */ - --pst-icon-clipboard-list: '\f46d'; - --pst-icon-admonition-todo: var(--pst-icon-clipboard-list); - --pst-color-admonition-todo: 161, 46, 233; - --target-color: #b9ee9e; - --codeblock-color: #aad993; -} - -.visuallyhidden { - display: none; -} - -pre { - border-radius: 0; - background-color: white; - box-shadow: none; -} - -a, -a:visited, -main.bd-content #main-content a, -main.bd-content #main-content a:visited { - color: #2980b9; -} - -a:hover, -main.bd-content #main-content a:hover { - color: #1a567e; - text-decoration: none; -} - -ul { - list-style-type: square; -} - -ul li>p { - margin-bottom: 0.3rem; -} - -ol li>p { - margin-bottom: 0.3rem; -} - -img { - margin: 1rem 0; -} - -figure img, -img.figure, -.figure img { - box-shadow: 0 6px 24px 0 rgba(153, 153, 153, 0.3); -} - -.sidebar img.logo { - box-shadow: none; - width: 200px; - margin-bottom: 1rem; -} - -img.inline { - margin: 0; - height: 1em; -} - -span.linenos { - padding-right: 1em; -} - -p.ploneorglink img { - vertical-align: bottom; -} - -dt:target, -span.highlighted, -ul.search li span.highlighted { - background-color: var(--target-color); -} - -.bd-sidebar .nav ul { - padding: 0 0 0 1rem; -} - -.bd-sidebar .nav .toctree-checkbox~label i { - transform: rotate(90deg); -} - -.bd-sidebar .nav .toctree-checkbox:checked~label i { - transform: rotate(0deg); -} - -.toctree-wrapper .caption { - font-weight: bold; - font-size: 1.2em; - margin-top: 3rem; -} - -.toctree-wrapper ul { - list-style: none; -} - -section:not(#glossary) h1~dl { - display: grid; - grid-template-columns: max-content auto; -} - -section:not(#glossary) h1~dl dd { - margin-bottom: unset !important; -} - -div.section { - margin-bottom: 5rem; -} - -div.section div.section { - margin-bottom: 5rem; -} - -div.section div.section div.section { - margin-bottom: 2rem; -} - -/* admonitions */ -.admonition { - border-radius: 0; - border: none; - border-left: .2rem solid; - border-left-color: rgba(var(--pst-color-admonition-default), 1); -} - -.admonition .admonition-title { - margin-bottom: 1.5rem !important; -} - -/* admonition todo */ -.admonition.admonition-todo, -div.admonition.admonition-todo { - border-color: rgba(var(--pst-color-admonition-todo), 1); -} - -.admonition.admonition-todo>.admonition-title, -div.admonition.admonition-todo>.admonition-title { - background-color: rgba(var(--pst-color-admonition-todo), .1); -} - -.admonition.admonition-todo>.admonition-title::before, -div.admonition.admonition-todo>.admonition-title::before { - color: rgba(var(--pst-color-admonition-todo), 1); - content: var(--pst-icon-admonition-todo); -} - -.admonition-github-only.admonition { - display: none; -} - -/* admonition margin */ -.admonition.margin ul, -.admonition.margin ol { - padding-left: 1rem; -} - -.topic { - padding: 1.5em 1em .5em 1em; -} - -.topic-title { - font-weight: bold; -} - - -/* Bootstrap */ -.btn-primary { - color: #fff; - background-color: #2980b9; - border-color: #2980b9; -} - -.btn-primary { - background-color: #1f86ca; - border-color: #2980b9; -} - -/* Search */ - -/* Show search form. It is hidden by default. */ -#search-documentation, -#search-documentation~form, -#search-documentation~p { - display: block; -} - -#search-form:focus-within #shortcut-page, -.bd-search:focus-within #shortcut { - display: none; -} - -#shortcut-page.input-group-text { - padding-top: 0; - padding-bottom: 0; -} - -input#q { - border-radius: .25rem 0 0 .25rem; -} - -.form-control:focus { - box-shadow: none; - border-width: 2px; -} - -ul.search { - margin-left: 0; -} - -p.search-summary { - margin: 1em 0 2rem 0; -} - -#search-results ul { - list-style-type: none; - padding-left: 0; -} - -#search-results ul li, -ul.search li { - margin-bottom: 2rem; - padding: 0; - background-image: none; - border-bottom: none; -} - -#search-results ul li h3 { - margin: 0.4rem 0 .5rem; - font-size: 1.5rem; -} - -#search-results ul li .breadcrumbs { - display: flex; - flex-direction: row; - flex-wrap: wrap; -} - -#search-results ul li .breadcrumbs a { - font-weight: normal; -} - -#search-results ul li .breadcrumbs .lastbreadcrumb { - white-space: nowrap; - display: inline-block; - max-width: 12rem; - overflow: hidden; - /* "overflow"-Wert darf nicht "visible" sein */ - - text-overflow: ellipsis; -} - -ul.search li p.context { - margin-left: 0; -} - -/* Search form sidebar */ - -.bd-search { - font-size: .8rem; -} - -.bd-search:focus-within #search-input { - border-radius: .25rem; -} - -#shortcut.input-group-text { - padding-top: 0; - padding-bottom: 0; -} - -.bd-search input, -.bd-search .input-group-text { - font-size: .8rem; - padding-left: .5em; -} - -input#search-input { - padding-left: 2.1875rem; - border-radius: .25rem 0 0 .25rem; -} - -.search-icon { - position: absolute; - color: #a4a6a7; - left: .625rem; - z-index: 100; - align-self: center; -} - -.input-group-text kbd { - padding: 0rem 0.4rem; - font-size: 135%; -} - -.pathseparator { - padding: 0 0.7rem; -} - -/* header-article */ -div.header-article__label { - display: flex; - align-items: center; - margin: 0 auto 0 1em; - font-size: 80%; - overflow: hidden; - white-space: nowrap; -} - -/* submenu */ -.bd-toc { - box-shadow: 0 .2rem .5rem rgba(0, 0, 0, .05), 0 0 .0625rem rgba(0, 0, 0, .1); -} - -/* extra sidebar */ -div.sidebar:not(.margin) { - width: 40%; - float: right; - clear: right; - margin: .3rem 0 .3rem 0.5em; - padding: 2rem 0 1.5rem 1rem !important; - background-color: rgba(var(--pst-color-admonition-note), .1); - border: none; - border-left: 8px rgba(var(--pst-color-admonition-default), 1) solid; - border-radius: .2rem; - box-shadow: 0 .2rem .5rem rgba(0, 0, 0, .05), 0 0 .0625rem rgba(0, 0, 0, .1); -} - -div.sidebar:not(.margin) .figure { - margin-top: 0; - padding-top: 0; - margin-left: 0; - padding-left: 0; -} - -div.sidebar:not(.margin) img.logo { - margin-top: 0; - margin-bottom: .3rem; -} - -div.sidebar:not(.margin) p { - margin-bottom: 0; -} - -div.sidebar:not(.margin) p.sidebar-title { - display: none; -} - -div.sidebar:not(.margin) div.topic { - padding: .5em 0; - background-color: transparent; - border: none; -} - -div.sidebar:not(.margin) pre { - margin: .5em 0 1.5em 0; -} - -div.sidebar:not(.margin) div[class*="highlight-"] { - margin-right: .5em; -} - -div.sidebar:not(.margin) .admonition { - margin-right: .5em; - background-color: #ffffff; -} - -@media (min-width:768px) { - div.sidebar:not(.margin) { - width: 50%; - margin-left: 1.5em; - margin-right: -28%; - } -} - - -main.bd-content #main-content dl.simple dt { - margin-top: .8em; -} - -main.bd-content #main-content dl.simple dt:nth-of-type(1) { - margin-top: 0; -} - -main.bd-content #main-content dl.simple dd { - margin-top: .8em; -} - -main.bd-content #main-content dl.simple dt+dd { - margin-top: 0; -} - -.prev-next-bottom { - margin: 20px 0 30px 0; -} - -.prev-next-bottom a.left-prev, -.prev-next-bottom a.right-next { - padding: 5px 10px; - border: 1px solid rgba(0, 0, 0, .2); - max-width: 45%; - overflow-x: hidden; - color: rgba(0, 0, 0, .65); - border-radius: 10px; -} - -/* Local navigation */ -li.nav-item.toc-entry { - line-height: 1.25em; - margin-bottom: 0.25em; -} - -span.guilabel, -span.menuselection { - border: none; - background: #e7f2fa; - border-radius: 4px; - padding: 4px 5px; - font-size: 90%; - font-weight: bold; - font-style: italic; - white-space: nowrap; -} - - -/* - * extensions - */ - -/* definitions */ -dl.py.function { - margin-bottom: 5rem; -} - -dl.py.function>dt { - background-color: var(--codeblock-color); - padding: 4px 5px; -} - -dl.py.function>dt:target { - background-color: var(--target-color); -} - -dl.field-list>dt { - padding-left: 0; -} - -/* code blocks */ -div.viewcode-block:target { - padding: 10px 10px; - background-color: var(--codeblock-color); - border-top: 1px solid var(--codeblock-color); - border-bottom: 1px solid var(--codeblock-color); -} - -/* Fix paragraphs in list items. */ -#main-content ol > li > p:nth-child(n+2), -#main-content ul > li > p:nth-child(n+2) { - margin-top: 1em; -} - -video { - width: 100%; -} diff --git a/docs/_static/documentation.css b/docs/_static/documentation.css new file mode 100644 index 0000000000..e4590caa12 --- /dev/null +++ b/docs/_static/documentation.css @@ -0,0 +1,17 @@ +/* + Remove the external link icon from Plone Sphinx Theme for links + in submodules that refer to Plone 6 Documentation via Intersphinx. + Although these links have `external` in their class, they are + actually internal to Plone 6 Documentation. +*/ +.reference.external::after { + all: unset; +} +a:not([title="(in Plone Documentation v6)"]).reference.external::after { + margin-left: .3em; + display: inline-block; + content: var(--pst-icon-external-link); + white-space: nowrap; + font: var(--fa-font-solid); + font-size: .75em; +} diff --git a/docs/_static/github-navigation.png b/docs/_static/github-navigation.png deleted file mode 100644 index ef6f90d1c7..0000000000 Binary files a/docs/_static/github-navigation.png and /dev/null differ diff --git a/docs/_static/images-test/examples.png b/docs/_static/images-test/examples.png new file mode 100644 index 0000000000..d0c9eae883 Binary files /dev/null and b/docs/_static/images-test/examples.png differ diff --git a/docs/_static/images-test/image-srcset.png b/docs/_static/images-test/image-srcset.png new file mode 100644 index 0000000000..f91fe2a1c8 Binary files /dev/null and b/docs/_static/images-test/image-srcset.png differ diff --git a/docs/_static/images-test/images-test.png b/docs/_static/images-test/images-test.png new file mode 100644 index 0000000000..d8cbf912ec Binary files /dev/null and b/docs/_static/images-test/images-test.png differ diff --git a/docs/_static/images-test/picture-tags.png b/docs/_static/images-test/picture-tags.png new file mode 100644 index 0000000000..9b33032484 Binary files /dev/null and b/docs/_static/images-test/picture-tags.png differ diff --git a/docs/_static/patch_scrollToActive.js b/docs/_static/patch_scrollToActive.js deleted file mode 100644 index 6cad65df0b..0000000000 --- a/docs/_static/patch_scrollToActive.js +++ /dev/null @@ -1,41 +0,0 @@ -/** - * Patch of scrollToActive of sphinxbook theme - * Scroll to active navigation item - */ - -/** - * A helper function to load scripts when the DOM is loaded. - * This waits for everything to be on the page first before running, since - * some functionality doesn't behave properly until everything is ready. - */ - var sbRunWhenDOMLoaded = (cb) => { - if (document.readyState != "loading") { - cb(); - } else if (document.addEventListener) { - document.addEventListener("DOMContentLoaded", cb); - } else { - document.attachEvent("onreadystatechange", function () { - if (document.readyState == "complete") cb(); - }); - } -}; - -/** - * Sidebar scroll on load. - * - * Detect the active page in the sidebar, and scroll so that it is centered on - * the screen. - */ - -var scrollToActive = () => { - let navbar_scrollable = $("#site-navigation").children()[0]; - let active_navigation_item = $("#site-navigation .active").last(); - if (active_navigation_item) { - if (active_navigation_item.offset().top > $(window).height() * 0.5) { - navbar_scrollable.scrollTop = active_navigation_item.offset().top - $(window).height() * 0.2; - } - } -}; - - -sbRunWhenDOMLoaded(scrollToActive); diff --git a/docs/_static/plone-classic-ui-home-page.png b/docs/_static/plone-classic-ui-home-page.png new file mode 100644 index 0000000000..5440e9a778 Binary files /dev/null and b/docs/_static/plone-classic-ui-home-page.png differ diff --git a/docs/_static/plone-classic-ui-landing-page.png b/docs/_static/plone-classic-ui-landing-page.png index 018b0af215..a4f101987a 100644 Binary files a/docs/_static/plone-classic-ui-landing-page.png and b/docs/_static/plone-classic-ui-landing-page.png differ diff --git a/docs/_static/plone-classic-ui-login-page.png b/docs/_static/plone-classic-ui-login-page.png new file mode 100644 index 0000000000..60b3e2b5fd Binary files /dev/null and b/docs/_static/plone-classic-ui-login-page.png differ diff --git a/docs/_static/plone-classic-ui-site-page.png b/docs/_static/plone-classic-ui-site-page.png new file mode 100644 index 0000000000..7c27b5ad9e Binary files /dev/null and b/docs/_static/plone-classic-ui-site-page.png differ diff --git a/docs/_static/plone-home-page.png b/docs/_static/plone-home-page.png index c670a93602..b2321e0eaf 100644 Binary files a/docs/_static/plone-home-page.png and b/docs/_static/plone-home-page.png differ diff --git a/docs/_static/plone-login-page.png b/docs/_static/plone-login-page.png index 25a1d0a31f..8a2f90e723 100644 Binary files a/docs/_static/plone-login-page.png and b/docs/_static/plone-login-page.png differ diff --git a/docs/_static/search_shortcut.js b/docs/_static/search_shortcut.js deleted file mode 100644 index 177bf7f1a1..0000000000 --- a/docs/_static/search_shortcut.js +++ /dev/null @@ -1,35 +0,0 @@ -/** - * Add shortcut `ctrl+k` to focus on search field - */ - - $(document).ready(() => { - if (window.location.pathname === '/search.html') { - $('form.bd-search .input-group').hide(); // Hide Sidebar Search field - - $(document).keydown(function(event) { - if ((event.ctrlKey || event.metaKey) && event.key == "k") { - event.preventDefault(); - $('#q').focus(); - } - }); - } else { - $(document).keydown(function(event) { - if ((event.ctrlKey || event.metaKey) && event.key == "k") { - event.preventDefault(); - $('#search-input').focus(); - } - }); - } - - // if OS isn't Mac change visual indication of search field - if (navigator.platform.indexOf('Mac') === -1) { - $('#search-shortcut').html("^"); - $('#search-page-shortcut').html("^"); - } - -}); - -function onReset() { - $('#search-form').trigger('reset'); - $('#search-form').trigger('submit'); -} \ No newline at end of file diff --git a/docs/_static/searchtools.js b/docs/_static/searchtools.js index a9b62c7e9e..e6a1aafb7f 100644 --- a/docs/_static/searchtools.js +++ b/docs/_static/searchtools.js @@ -1,27 +1,45 @@ /* - * searchtools.js - * ~~~~~~~~~~~~~~~~ - * * Sphinx JavaScript utilities for the full-text search. - * - * :copyright: Copyright 2007-2021 by the Sphinx team, see AUTHORS. - * :license: BSD, see LICENSE for details. - * */ +"use strict"; -var title_documentation = 'Plone Documentation'; +var title_repository = 'Plone documentation'; -if (!Scorer) { - /** - * Simple result scoring code. - */ +/** + * Return array with titles of ancestors of file. + * @param {number} idx - The index of the result item in global list of files + * @returns array + */ +function _getParentTitles(idx, docNames, titles) { + let path = docNames[idx] + let parentpathtokens = path.split('/').slice(0, -1); + + let parentTitles = parentpathtokens.map((el, index) => { + let foo = `${parentpathtokens.slice(0, index+1).join('/')}` + let parentId = docNames.indexOf(foo); + if (parentId === -1) { + foo = `${parentpathtokens.slice(0, index+1).join('/')}/index` + parentId = docNames.indexOf(foo); + } + let title = parentId === -1 ? title_repository : titles[parentId]; + return title + }) + + return parentTitles +} + +/** + * Simple result scoring code. + */ +if (typeof Scorer === "undefined") { var Scorer = { // Implement the following function to further tweak the score for each result - // The function takes a result array [filename, title, anchor, descr, score] + // The function takes a result array [docname, title, anchor, descr, score, filename] // and returns the new score. /* - score: function(result) { - return result[4]; + score: result => { + const [docname, title, anchor, descr, score, filename, kind] = result + return score }, */ @@ -30,9 +48,11 @@ if (!Scorer) { // or matches in the last dotted part of the object name objPartialMatch: 6, // Additive scores depending on the priority of the object - objPrio: {0: 15, // used to be importantResults - 1: 5, // used to be objectResults - 2: -5}, // used to be unimportantResults + objPrio: { + 0: 15, // used to be importantResults + 1: 5, // used to be objectResults + 2: -5, // used to be unimportantResults + }, // Used when the priority is not in the mapping. objPrioDefault: 0, @@ -41,522 +61,610 @@ if (!Scorer) { partialTitle: 7, // query found in terms term: 5, - partialTerm: 2 + partialTerm: 2, }; } -if (!splitQuery) { - function splitQuery(query) { - return query.split(/\s+/); +// Global search result kind enum, used by themes to style search results. +class SearchResultKind { + static get index() { return "index"; } + static get object() { return "object"; } + static get text() { return "text"; } + static get title() { return "title"; } +} + +const _removeChildren = (element) => { + while (element && element.lastChild) element.removeChild(element.lastChild); +}; + +/** + * See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions#escaping + */ +const _escapeRegExp = (string) => + string.replace(/[.*+\-?^${}()|[\]\\]/g, "\\$&"); // $& means the whole matched string + +function _getBreadcrumbs(item, linkUrl) { + // No breadcrumbs for top level pages + if (item[0].split('/')[1] == 'index') { + return null } + let parentTitles = item[6]; + + let parentDefaultTitles = [ + "Plone documentation", + "Documentation for Plone developers" + ]; + parentTitles = Array.isArray(parentTitles) ? parentTitles : parentDefaultTitles; + let pathTokens = item[0].split('/') + .slice(0, -1); + let pathArray = pathTokens.map((el, index) => { + return { + "path": pathTokens.slice(0, index+1).join('/'), + "title": parentTitles[index] + } + }) + let markup = pathArray + .map((el, idx) => { + return `${el.title}` + }) + markup.push(`${item[1]}`) + return markup.join(' > '); +} + +const _displayItem = (item, searchTerms, highlightTerms) => { + const docBuilder = DOCUMENTATION_OPTIONS.BUILDER; + const docFileSuffix = DOCUMENTATION_OPTIONS.FILE_SUFFIX; + const docLinkSuffix = DOCUMENTATION_OPTIONS.LINK_SUFFIX; + const showSearchSummary = DOCUMENTATION_OPTIONS.SHOW_SEARCH_SUMMARY; + const contentRoot = document.documentElement.dataset.content_root; + + const [docName, title, anchor, descr, score, _filename, kind] = item; + + let listItem = document.createElement("li"); + // Add a class representing the item's type: + // can be used by a theme's CSS selector for styling + // See SearchResultKind for the class names. + // listItem.classList.add(`kind-${kind}`); + let requestUrl; + let linkUrl; + if (docBuilder === "dirhtml") { + // dirhtml builder + let dirname = docName + "/"; + if (dirname.match(/\/index\/$/)) + dirname = dirname.substring(0, dirname.length - 6); + else if (dirname === "index/") dirname = ""; + requestUrl = contentRoot + dirname; + linkUrl = requestUrl; + } else { + // normal html builders + requestUrl = contentRoot + docName + docFileSuffix; + linkUrl = docName + docLinkSuffix; + } + + let breadcrumbs = _getBreadcrumbs(item, linkUrl); + if (breadcrumbs) { + let breadcrumbsNode = document.createElement("div"); + breadcrumbsNode.innerHTML = breadcrumbs; + breadcrumbsNode.classList.add("breadcrumbs"); + listItem.appendChild(breadcrumbsNode); + } + + // Title links to chapter + let linkEl = listItem.appendChild(document.createElement("a")); + linkEl.href = linkUrl + anchor; + linkEl.dataset.score = score; + linkEl.innerHTML = title; + if (descr) { + listItem.appendChild(document.createElement("span")).innerHTML = + " (" + descr + ")"; + // highlight search terms in the description + if (SPHINX_HIGHLIGHT_ENABLED) // set in sphinx_highlight.js + highlightTerms.forEach((term) => _highlightText(listItem, term, "highlighted")); + } + else if (showSearchSummary) + fetch(requestUrl) + .then((responseData) => responseData.text()) + .then((data) => { + if (data) + listItem.appendChild( + Search.makeSearchSummary(data, searchTerms, anchor) + ); + // highlight search terms in the summary + if (SPHINX_HIGHLIGHT_ENABLED) // set in sphinx_highlight.js + highlightTerms.forEach((term) => _highlightText(listItem, term, "highlighted")); + }); + Search.output.appendChild(listItem); +}; +const _finishSearch = (resultCount) => { + Search.stopPulse(); + Search.title.innerText = _("Search Results"); + if (!resultCount) + Search.status.innerText = Documentation.gettext( + "Your search did not match any documents. Please make sure that all words are spelled correctly and that you've selected enough categories." + ); + else + Search.status.innerText = Documentation.ngettext( + "Search finished, found one page matching the search query.", + "Search finished, found ${resultCount} pages matching the search query.", + resultCount, + ).replace('${resultCount}', resultCount); +}; +const _displayNextItem = ( + results, + resultCount, + searchTerms, + highlightTerms, +) => { + // results left, load the summary and display it + // this is intended to be dynamic (don't sub resultsCount) + if (results.length) { + _displayItem(results.pop(), searchTerms, highlightTerms); + setTimeout( + () => _displayNextItem(results, resultCount, searchTerms, highlightTerms), + 5 + ); + } + // search finished, update title and status message + else _finishSearch(resultCount); +}; +// Helper function used by query() to order search results. +// Each input is an array of [docname, title, anchor, descr, score, filename, kind]. +// Order the results by score (in opposite order of appearance, since the +// `_displayNextItem` function uses pop() to retrieve items) and then alphabetically. +const _orderResultsByScoreThenName = (a, b) => { + const leftScore = a[4]; + const rightScore = b[4]; + if (leftScore === rightScore) { + // same score: sort alphabetically + const leftTitle = a[1].toLowerCase(); + const rightTitle = b[1].toLowerCase(); + if (leftTitle === rightTitle) return 0; + return leftTitle > rightTitle ? -1 : 1; // inverted is intentional + } + return leftScore > rightScore ? 1 : -1; +}; + +/** + * Default splitQuery function. Can be overridden in ``sphinx.search`` with a + * custom function per language. + * + * The regular expression works by splitting the string on consecutive characters + * that are not Unicode letters, numbers, underscores, or emoji characters. + * This is the same as ``\W+`` in Python, preserving the surrogate pair area. + */ +if (typeof splitQuery === "undefined") { + var splitQuery = (query) => query + .split(/[^\p{Letter}\p{Number}_\p{Emoji_Presentation}]+/gu) + .filter(term => term) // remove remaining empty strings } /** * Search Module */ -var Search = { - - _index : null, - _queued_query : null, - _pulse_status : -1, - - htmlToText : function(htmlString) { - var virtualDocument = document.implementation.createHTMLDocument('virtual'); - var htmlElement = $(htmlString, virtualDocument); - htmlElement.find('.headerlink').remove(); - docContent = htmlElement.find('[role=main]')[0]; - if(docContent === undefined) { - console.warn("Content block not found. Sphinx search tries to obtain it " + - "via '[role=main]'. Could you check your theme or template."); - return ""; - } - return docContent.textContent || docContent.innerText; - }, +const Search = { + _index: null, + _queued_query: null, + _pulse_status: -1, + + htmlToText: (htmlString, anchor) => { + const htmlElement = new DOMParser().parseFromString(htmlString, 'text/html'); + for (const removalQuery of [".headerlink", "script", "style"]) { + htmlElement.querySelectorAll(removalQuery).forEach((el) => { el.remove() }); + } + if (anchor) { + const anchorContent = htmlElement.querySelector(`[role="main"] ${anchor}`); + if (anchorContent) return anchorContent.textContent; - init : function() { - var params = $.getQueryParameters(); - let doc_section = params.doc_section ? params.doc_section[0] : 'all'; - $('input[id="doc_section_' + doc_section + '"]').prop("checked", true) - if (params.q) { - var query = params.q[0]; - $('input[name="q"]')[0].value = query; - $('input[name="q"]')[1].value = query; - this.performSearch(query, doc_section); - } + console.warn( + `Anchored content block not found. Sphinx search tries to obtain it via DOM query '[role=main] ${anchor}'. Check your theme or template.` + ); + } + + // if anchor not specified or not found, fall back to main content + const docContent = htmlElement.querySelector('[role="main"]'); + if (docContent) return docContent.textContent; + + console.warn( + "Content block not found. Sphinx search tries to obtain it via DOM query '[role=main]'. Check your theme or template." + ); + return ""; }, - loadIndex : function(url) { - $.ajax({type: "GET", url: url, data: null, - dataType: "script", cache: true, - complete: function(jqxhr, textstatus) { - if (textstatus != "success") { - document.getElementById("searchindexloader").src = url; - } - }}); + init: () => { + const query = new URLSearchParams(window.location.search).get("q"); + document + .querySelectorAll('input[name="q"]') + .forEach((el) => (el.value = query)); + if (query) Search.performSearch(query); }, - setIndex : function(index) { - var q; - this._index = index; - if ((q = this._queued_query) !== null) { - this._queued_query = null; - Search.query(q); + loadIndex: (url) => + (document.body.appendChild(document.createElement("script")).src = url), + + setIndex: (index) => { + Search._index = index; + if (Search._queued_query !== null) { + const query = Search._queued_query; + Search._queued_query = null; + Search.query(query); } }, - hasIndex : function() { - return this._index !== null; - }, + hasIndex: () => Search._index !== null, - deferQuery : function(query) { - this._queued_query = query; - }, + deferQuery: (query) => (Search._queued_query = query), - stopPulse : function() { - this._pulse_status = 0; - }, + stopPulse: () => (Search._pulse_status = -1), - startPulse : function() { - if (this._pulse_status >= 0) - return; - function pulse() { - var i; + startPulse: () => { + if (Search._pulse_status >= 0) return; + + const pulse = () => { Search._pulse_status = (Search._pulse_status + 1) % 4; - var dotString = ''; - for (i = 0; i < Search._pulse_status; i++) - dotString += '.'; - Search.dots.text(dotString); - if (Search._pulse_status > -1) - window.setTimeout(pulse, 500); - } + Search.dots.innerText = ".".repeat(Search._pulse_status); + if (Search._pulse_status >= 0) window.setTimeout(pulse, 500); + }; pulse(); }, /** * perform a search for something (or wait until index is loaded) */ - performSearch : function(query, doc_section) { + performSearch: (query) => { // create the required interface elements - this.out = $('#search-results'); - this.title = $('').appendTo(this.out); - this.dots = $('').appendTo(this.title); - this.status = $('

 

').appendTo(this.out); - this.output = $('