-
Notifications
You must be signed in to change notification settings - Fork 0
docs: 📝 add configuration guide #111
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
Open
joelostblom
wants to merge
8
commits into
main
Choose a base branch
from
docs/config-guide
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
4661f3d
docs: :memo: Add configuration guide
joelostblom 827c279
Apply suggestion from @joelostblom
joelostblom dfff2de
Apply suggestions from code review
joelostblom c2d74ef
Apply suggestion from @lwjohnst86
joelostblom ef858b5
docs: :memo: Make language more instructional
joelostblom 600fd32
Apply suggestions from code review
joelostblom 7873c16
chore(pre-commit): :pencil2: automatic fixes
pre-commit-ci[bot] 2691ddb
docs: :memo: Improve wording and formatting
joelostblom 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
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 @@ | ||
| --- | ||
| title: "Configuration" | ||
| description: "Configuring Flower with different settings and output options." | ||
| order: 3 | ||
| --- | ||
|
|
||
| There are three ways to configure Flower: | ||
|
|
||
| 1. Via the command line interface (CLI), as described in [the CLI | ||
| guide](/docs/guide/cli.qmd). | ||
| 2. Via the Python interface, as described in [the Python | ||
| guide](/docs/guide/python.qmd). | ||
| 3. Via a configuration file, as described below. | ||
| <!-- TODO the python file does not exist yet, make sure link is uptaded | ||
| if name is different --> | ||
|
|
||
| If you use the CLI (or the Python interface) to | ||
| configure Flower's output, Flower **will not** use the settings in the | ||
| configuration file. If there are no configuration settings given in | ||
| either the CLI, the Python interface, or in the configuration file, | ||
| Flower will use it's defaults. | ||
|
|
||
| ::: callout-note | ||
| The URI can only be specified via the CLI or the Python interface, not | ||
| from the configuration file. Similarly, you can only configure the | ||
| `view` command from the CLI or the Python interface, not from the | ||
| configuration file. | ||
| ::: | ||
|
|
||
| ## The configuration file | ||
|
|
||
| Flower will read the configurations from **either** `.flower.toml` or | ||
| `pyproject.toml` (not both) in this order of preference: | ||
|
|
||
| 1. `.flower.toml` | ||
| 2. `pyproject.toml` | ||
|
|
||
| If your Data Package is already a Python package, it might be convenient | ||
| to configure Flower via `pyproject.toml`, since you likely already have | ||
| your configuration settings for other Python tools in this file. | ||
| Ultimately, which file you choose to use depends on if you prefer to | ||
| have a separate configuration file for separate tools or if your prefer | ||
| them the same configuration file. | ||
|
|
||
| ### Configurable settings | ||
|
|
||
| Before diving into editing your configuration, let's see which settings | ||
| can be configured via the configuration file: | ||
|
|
||
| `style` | ||
| : The style decides how the metadata is structured in the output files. | ||
|
|
||
| `output-dir` | ||
| : The directory where Flower will save the output files. | ||
|
|
||
| `template-dir` | ||
| : The directory that contains the templates files to use when `style="custom"`. | ||
|
|
||
| To see examples of which styles are available in flower and how they | ||
| would structure the metadata differently, see [the Outputs | ||
| documentation](/docs/design/interface/outputs.qmd). | ||
| <!-- TODO change to guide link when available --> | ||
| When style is set to `"custom"`, | ||
| the structure of the output is determined by a custom set of templates | ||
| and configurations explained in [the documentation about custom | ||
| styles](custom-styles.qmd). | ||
|
|
||
| ### Configuration file syntax | ||
|
|
||
| To configure settings in Flower, open up `.flower.toml` in your favorite | ||
| text editor. Let's change the output directory to `'my-docs'`. You can | ||
| do this by adding the following line to the configuration: | ||
|
|
||
| ``` {.toml filename=".flower.toml"} | ||
| output-dir = "my-docs/" | ||
| ``` | ||
|
|
||
| When you run `flower build ...`, the configuration file will be read | ||
| and the output directory will be changed to `my-docs`. | ||
|
|
||
| If you would like to change to use a custom style and instruct Flower to | ||
| look for templates in the directory `my-templates`, you can add the | ||
| following lines to `.flower.toml`: | ||
|
|
||
| ``` {.toml filename=".flower.toml"} | ||
| style = "custom" | ||
| template-dir = "my-templates/" | ||
| ``` | ||
|
|
||
| If you prefer to configure Flower via `pyproject.toml` instead, the | ||
| syntax will be the same as we have seen above. The only difference is | ||
| that a heading needs to be included to indicate where in the file Flower | ||
| can find the settings. Open up `pyproject.toml` and add a new table | ||
| header to the end as `[tool.seedcase-flower]`. Then put the same | ||
| configuration settings as you used above in `.flower.toml` below this | ||
| table header. | ||
|
|
||
| ``` {.toml filename="pyproject.toml"} | ||
| [tool.seedcase-flower] | ||
| style = "custom" | ||
| template_dir = "my-templates/" | ||
| output_dir = "my-docs/" | ||
| ``` |
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This reads a bit too much like a reference doc than a how-to. Could you revise it generally to be more instructional?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe the beginning is already written in an instructional (or at least more narrative) style. Commit ef858b5 includes a few updates to make the section "The configuration file" and onward sound more instructional. However, there isn't that much to "instruct" the reader to do since the effect of changing these options to different values is described elsewhere in the docs. The few things for the reader to learn from this page seems to be where Flower reads configuration from and which options can be entered into these files (but not what happens when those option values change).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's parts of the guide that are more declarative/command-tense than instructional, e.g. in line 34-35 or paragraph in line 92-95. They don't require major changes to make them more instructional, just a few words/sentence to change the tone/tense. For example, see my suggested change in line 95.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I accepted your change in 95. I'm unsure how to rewrite 34-35; the current phrasing is from your previous suggestion in dfff2de.