-
-
Notifications
You must be signed in to change notification settings - Fork 196
Add Standardize Python project configuration developer guide #1830
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
Merged
Merged
Changes from 8 commits
Commits
Show all changes
27 commits
Select commit
Hold shift + click to select a range
64d0136
Add Standardize project configuration
stevepiercy ad84220
Add Standardize Python project configuration developer guide
stevepiercy 6d99cd2
Merge branch '6.0' into meta
stevepiercy 80e5ce0
Merge branch '6.0' into meta
stevepiercy 969c2e2
Merge branch '6.0' into meta
stevepiercy 7181d9c
Merge branch '6.0' into meta
stevepiercy 1657f29
- s/`meta`/`plone/meta`
stevepiercy 302d6e2
Remove activate step, adjust commands to include path to binaries
stevepiercy a27eaa2
Reword monorepo definition
stevepiercy 3fe5f57
Update docs/developer-guide/standardize-python-project-configuration.md
stevepiercy 467dc36
Merge branch '6.0' into meta
stevepiercy b9a33f6
Update tips submodules/plone.restapi submodules/volto
stevepiercy a26c7a7
Merge branch '6.0' into meta
stevepiercy 7f11f1f
Merge branch '6.0' into meta
stevepiercy fe66f6e
Merge branch '6.0' into meta
stevepiercy 22f5865
Merge branch '6.0' into meta
stevepiercy 34a5b3f
- Remove basic usage
stevepiercy 7bd0f0a
Merge remote-tracking branch 'origin/meta' into meta
stevepiercy acd5224
Merge branch '6.0' into meta
stevepiercy 981969b
Merge branch '6.0' into meta
stevepiercy 122c4e6
Remove duplicate content
stevepiercy 4e8659a
Merge branch '6.0' into meta
stevepiercy 547279d
Fix see also
stevepiercy f10856c
Merge remote-tracking branch 'origin/meta' into meta
stevepiercy 0b392fd
Merge branch '6.0' into meta
stevepiercy ed0c2de
Merge branch '6.0' into meta
stevepiercy c6e8a7c
Merge branch '6.0' into meta
stevepiercy File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
103 changes: 103 additions & 0 deletions
103
docs/developer-guide/standardize-python-project-configuration.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,103 @@ | ||
| --- | ||
| myst: | ||
| html_meta: | ||
| "description": "Standardize project configuration in Plone with plone/meta" | ||
| "property=og:description": "Standardize project configuration in Plone with plone/meta" | ||
| "property=og:title": "Standardize project configuration in Plone with plone/meta" | ||
| "keywords": "Plone 6, standardize, project, configuration, development, plone/meta" | ||
| --- | ||
|
|
||
| # Standardize Python project configuration | ||
|
|
||
| This part of the documentation describes how to standardize Python project configuration in Plone. | ||
| It does not cover the following. | ||
|
|
||
| - Volto or any other JavaScript-based project, which has its own ecosystem. | ||
| - Monorepos, such as [Cookieplone](https://github.com/plone/cookieplone). | ||
| Repositories must have a single Python package at the top level. | ||
| - Project that support multiple versions of Plone in the same branch. | ||
stevepiercy marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| Plone consists of hundreds of projects. | ||
| To lessen the effort of configuring a new project in the Plone GitHub organization, and to keep these projects current with latest configuration practices, the Plone community agreed upon a trusted set of configuration items. | ||
| The Plone community manages these configuration items using the [`plone/meta`](https://github.com/plone/meta) project. | ||
|
|
||
| You can follow these practices in your own projects, or suggest new or alternative configuration items through the `plone/meta` repository, sharing them with the rest of the Plone community. | ||
|
|
||
|
|
||
| ## `plone/meta` basic usage | ||
|
|
||
| `plone/meta` has a rich set of features. | ||
| This section describes the most common use cases. | ||
|
|
||
| ```{seealso} | ||
| See a description of all of [`plone/meta`'s features](https://github.com/plone/meta/blob/main/config/README.md#quick-start). | ||
| ``` | ||
|
|
||
|
|
||
| ### Setup | ||
|
|
||
| Clone `plone/meta` to any machine, then change your current working directory into `meta/config`, create a Python virtual environment, and install `plone/meta`'s requirements. | ||
|
|
||
| ```shell | ||
| git clone https://github.com/plone/meta.git | ||
| cd meta/config | ||
| python3 -m venv venv | ||
| venv/bin/pip install -r requirements.txt | ||
| ``` | ||
|
|
||
|
|
||
| ### `config-package.py` script | ||
|
|
||
| The {file}`config-package.py` Python script from `plone/meta` creates or overwrites configuration files for your project. | ||
| See a current list of [configuration files](https://github.com/plone/meta/blob/main/config/README.md#configuration-files) that it will create or overwrite. | ||
|
|
||
| This script has several [command line options](https://github.com/plone/meta/blob/main/config/README.md#cli-arguments) that you can use to override the default options. | ||
|
|
||
| When you run this script, it automatically goes through the following steps. | ||
|
|
||
| 1. It creates a new git branch from the current branch in your project. | ||
| 1. If the file {file}`.meta.toml` is not present in the project, then it creates this and the other new configuration files from `plone/meta`'s Jinja2 templates. | ||
| Otherwise, it reads the file {file}`.meta.toml` for regenerating the configuration files. | ||
| 1. It writes the configuration files. | ||
| 1. It creates a change log entry. | ||
| 1. By default, it commits changes. | ||
| 1. It optionally adds packages, pushes commits, or runs tox from the configuration files. | ||
|
|
||
| ```{tip} | ||
| If you prefer to name the new git branch instead of letting the script name it using its default naming scheme, then either create a new branch `my-new-branch`, switch to it, and use the `--branch current` option, or do all that in one step with the `--branch my-new-branch` option. | ||
| ``` | ||
|
|
||
| ```{tip} | ||
| If you prefer to review changes before committing them, then use the `--no-commit` option. | ||
| ``` | ||
|
|
||
| For help for the script, use the following command. | ||
|
|
||
| ```shell | ||
| venv/bin/python config-package.py --help | ||
| ``` | ||
|
|
||
|
|
||
| ### Generate configuration files | ||
|
|
||
| Now you can run the Python script {file}`config-package.py` to generate configuration files from Jinja2 template files to manage your project. | ||
|
|
||
| ```shell | ||
| venv/bin/python config-package.py [OPTIONS] PATH/TO/PACKAGE | ||
| ``` | ||
|
|
||
|
|
||
| ### Manage configuration files | ||
|
|
||
| For each of the configuration files, you should edit its [corresponding stanza](https://github.com/plone/meta/blob/main/config/README.md#applying-a-customized-configuration) in the file {file}`.meta.toml`. | ||
|
|
||
| ```{warning} | ||
| Do not directly edit the configuration files that `plone/meta` manages. | ||
| Anytime someone runs the Python script {file}`config-package.py`, any changes made in these files will get clobbered. | ||
| ``` | ||
|
|
||
| Then run the Python script {file}`config-package.py` to regenerate configuration files from your project's {file}`.meta.toml`. | ||
|
|
||
| ```shell | ||
| venv/bin/python config-package.py [OPTIONS] PATH/TO/PACKAGE | ||
| ``` | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.