-
-
Notifications
You must be signed in to change notification settings - Fork 192
Add Create a backend add-on section in the Developer guide with GenericSetup
#1757
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: 6.0
Are you sure you want to change the base?
Changes from 1 commit
091a89a
a766f5a
d8e135c
ed9c4af
13b85f7
0f7a455
7767c8b
9d9994f
3119199
dcc8b32
67b1ee7
0cad2b0
042ff32
aad7b71
df7340f
6af80fc
8579a16
2675e11
6e92377
0a4cace
132f1be
2fe88be
bb795bc
3db83f5
a7b0d43
096109d
a0358f1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -12,10 +12,220 @@ myst: | |
| # Create a backend add-on | ||
|
|
||
| This section explains how a developer can create an {term}`add-on` for the Plone backend. | ||
| You will use a framework called {term}`GenericSetup` and a tool called {term}`Buildout`. | ||
|
|
||
| ```{note} | ||
| This section for Plone 6 is in the process of being written. | ||
| Until it is complete, Plone 5 documentation is the authoritative source. | ||
| {doc}`plone5:develop/addons/components/genericsetup` (Plone 5) | ||
| ## System requirements | ||
|
|
||
| Follow the section {ref}`create-project-cookieplone-system-requirements` to set up your system. | ||
|
|
||
| ## Generate the add-on project with `cookieplone` | ||
|
|
||
| To develop an add-on for backend and/or Classic-UI, run the following command to generate your add-on project using the `backend_addon` Cookieplone template. | ||
| See {doc}`plone:install/create-project-cookieplone` for details of the latter scenario. | ||
| The following output assumes the former scenario. | ||
|
|
||
| ```shell | ||
| uvx cookieplone backend_addon | ||
| ``` | ||
|
|
||
| ```console | ||
| > uvx cookieplone backend_addon | ||
| ╭──────────────────────────────── cookieplone ─────────────────────────────────╮ | ||
| │ │ | ||
| │ ******* │ | ||
| │ *************** │ | ||
| │ *** *** │ | ||
| │ *** *** *** │ | ||
| │ *** ***** *** │ | ||
| │ *** *** *** │ | ||
| │ *** *** *** │ | ||
| │ *** ***** *** │ | ||
| │ *** *** *** *** │ | ||
| │ *** ***** *** │ | ||
| │ *** *** *** │ | ||
| │ *** *** │ | ||
| │ *************** │ | ||
| │ ******* │ | ||
| │ │ | ||
| ╰──────────────────────────────────────────────────────────────────────────────╯ | ||
| You've downloaded /Users/<username>/.cookiecutters/cookieplone-templates before. Is | ||
| it okay to delete and re-download it? [y/n] (y): | ||
| ╭──────────────────────────────── Plone Addon ─────────────────────────────────╮ | ||
| │ │ | ||
| │ Creating a new Plone Addon │ | ||
| │ │ | ||
| │ Sanity check results: │ | ||
| │ │ | ||
| │ - Cookieplone: ✓ │ | ||
| │ - uv: ✓ │ | ||
| │ - git: ✓ │ | ||
| │ │ | ||
| ╰──────────────────────────────────────────────────────────────────────────────╯ | ||
| [1/10] Addon Title (Addon): | ||
| [2/10] A short description of your addon (A new addon for Plone): | ||
| [3/10] Author (Plone Community): | ||
| [4/10] Author E-mail (collective@plone.org): | ||
| [5/10] GitHub Username or Organization (collective): | ||
| [6/10] Should we use prerelease versions? (No): | ||
| [7/10] Plone Version (6.1.3): | ||
| [8/10] Python package name (collective.addon): | ||
| [9/10] Support headless Plone? | ||
| 1 - Yes | ||
| 2 - No | ||
| Choose from [1/2] (1): | ||
| [10/10] Would you like to add a documentation scaffold to your project? | ||
| 1 - Yes | ||
| 2 - No | ||
| Choose from [1/2] (1): | ||
| -> Remove files used in classic UI setup | ||
| -> Create namespace packages | ||
| -> Format code | ||
| -> Initialize Git repository | ||
| -> Generate documentation scaffold | ||
| ╭────────────────────────── New addon was generated ───────────────────────────╮ | ||
| │ │ | ||
| │ Addon │ | ||
| │ │ | ||
| │ Now, enter the repository, start coding, and push to your organization. │ | ||
| │ │ | ||
| │ Sorry for the convenience, │ | ||
| │ The Plone Community. │ | ||
| │ │ | ||
| │ https://plone.org/ │ | ||
| ╰──────────────────────────────────────────────────────────────────────────────╯ | ||
| ``` | ||
|
|
||
| Cookieplone creates a folder with the name of the add-on, in this example, `collective.addon`. | ||
|
|
||
| You can now continue to add subtemplates to your addon {ref}`create-a-backend-add-on-add-subtemplate-label` | ||
|
|
||
|
|
||
| ## Generate the add-on project with `plonecli` | ||
|
|
||
| Run the following command to create an addon project with `plonecli` | ||
|
|
||
| ```shell | ||
| uvx plonecli create addon <addon namespace package> | ||
| ``` | ||
|
|
||
| ```console | ||
| > uvx plonecli create addon collective.addon | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I tried this and here's what happened:
It looks like @erral already fixed the latter in plone/plonecli@a00e960 ... could that be released?
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes sorry, I didn't find time to request releases of all of them (mrbob, plonecli, bobtemplates.plone). I'll do it later today. |
||
| RUN: bobtemplates.plone:addon -O collective.addon | ||
|
|
||
| Welcome to mr.bob interactive mode. Before we generate directory structure, | ||
| some questions need to be answered. | ||
|
|
||
| Answer with a question mark to display help. | ||
| Values in square brackets at the end of the questions show the default value if | ||
| there is no answer. | ||
|
|
||
|
|
||
| --> Package description [An add-on for Plone]: | ||
|
|
||
| --> Plone version [6.0.0]: | ||
|
|
||
| --> Python version for virtualenv [python3]: | ||
|
|
||
| --> Do you want me to activate VS Code support? (y/n) [y]: | ||
|
|
||
|
|
||
|
|
||
| isort-apply: successful: | ||
| isort-apply: install_deps> python -I -m pip install isort -c constraints.txt | ||
| isort-apply: commands[0]> isort /Users/<username>/Development/collective.addon/src | ||
| /Users/<username>/Development/collective.addon/setup.py | ||
| Fixing /Users/<username>/Development/collective.addon/src/collective/addon/testing.py | ||
| Fixing /Users/<username>/Development/collective.addon/src/collective/addon/tests/test_setup.py | ||
| isort-apply: OK (2.57=setup[1.94]+cmd[0.63] seconds) | ||
| congratulations :) (2.59 seconds) | ||
|
|
||
|
|
||
| Identified `/` as project root containing a file system root. | ||
| Sources to be formatted: "Users/<username>/Development/collective.addon/src", | ||
| "Users/<username>/Development/collective.addon/setup.py" | ||
| src/collective/__init__.py wasn't modified on disk since last run. | ||
| src/collective/addon/browser/__init__.py wasn't modified on disk since last run. | ||
| src/collective/addon/locales/__init__.py wasn't modified on disk since last run. | ||
| src/collective/addon/tests/__init__.py wasn't modified on disk since last run. | ||
| src/collective/addon/interfaces.py already well formatted, good job. | ||
| reformatted src/collective/addon/__init__.py | ||
| reformatted src/collective/addon/setuphandlers.py | ||
| reformatted src/collective/addon/testing.py | ||
| reformatted setup.py | ||
| reformatted src/collective/addon/locales/update.py | ||
| reformatted src/collective/addon/tests/test_setup.py | ||
|
|
||
| All done! ✨ 🍰 ✨ | ||
| 6 files reformatted, 5 files left unchanged. | ||
|
|
||
| black-enforce: successful: | ||
| black-enforce: install_deps> python -I -m pip install black -c constraints.txt | ||
| black-enforce: commands[0]> black -v src setup.py | ||
| black-enforce: OK (2.60=setup[2.12]+cmd[0.48] seconds) | ||
| congratulations :) (2.61 seconds) | ||
|
|
||
|
|
||
| git init is disabled! | ||
| Generated file structure at /Users/<username>/Development/collective.addon/collective.addon | ||
| ``` | ||
|
|
||
| Plonecli creates a folder with the name of the add-on, in this example, `collective.addon`. | ||
|
|
||
| You can now continue to add subtemplates to your addon {ref}`create-a-backend-add-on-add-subtemplate-label` | ||
|
|
||
|
|
||
| (create-a-backend-add-on-add-subtemplate-label)= | ||
|
|
||
| ## Add `plonecli` subtemplate to an addon | ||
|
|
||
| The generated addon contains a {file}`bobtemplates.cfg` file which lets you add several subtemplates with `plonecli`. | ||
petschki marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| Run the following command to list the available subtemplates. | ||
|
|
||
| ```shell | ||
| uvx plonecli -l | ||
| ``` | ||
|
|
||
| ```shell | ||
| > uvx plonecli -l | ||
| Available mr.bob templates: | ||
| - addon | ||
| - behavior | ||
| - content_type | ||
| - controlpanel | ||
| - form | ||
| - indexer | ||
| - mockup_pattern | ||
| - portlet | ||
| - restapi_service | ||
| - site_initialization | ||
| - subscriber | ||
| - svelte_app | ||
| - theme | ||
| - theme_barceloneta | ||
| - theme_basic | ||
| - upgrade_step | ||
| - view | ||
| - viewlet | ||
| - vocabulary | ||
| - buildout | ||
| ``` | ||
|
|
||
| All templates below `addon` can be added to your newly created addon with: | ||
|
|
||
| ```shell | ||
| uvx ploncli add <subtemplate> | ||
petschki marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| ``` | ||
|
|
||
petschki marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| Currently documented subtemplates: | ||
|
|
||
| - behavior: {ref}`backend-behaviors-label` | ||
| - content_type: {ref}`creating-content-types-label` | ||
| - controlpanel: {ref}`control-panels-label` | ||
| - form: {reg}`forms-label` | ||
| - mockup_pattern: {ref}`mockup-and-patternslib-label` | ||
| - theme_barceloneta: {ref}`create-a-theme-add-on-label` | ||
|
|
||
|
|
||
| The addon also contains a {term}`GenericSetup` default install/uninstall profile. | ||
|
|
||
| See {ref}`genericsetup-label` for more information. | ||
Uh oh!
There was an error while loading. Please reload this page.