Skip to content

docs: explain how to pass nested config via CLI#3885

Merged
johanneskoester merged 1 commit intosnakemake:mainfrom
kjohnsen:main
Dec 19, 2025
Merged

docs: explain how to pass nested config via CLI#3885
johanneskoester merged 1 commit intosnakemake:mainfrom
kjohnsen:main

Conversation

@kjohnsen
Copy link
Copy Markdown
Contributor

@kjohnsen kjohnsen commented Dec 15, 2025

I struggled to pass in nested config (the first thing I tried was dot format, like foo.bar=42) until I found this SO post.

QC

  • N/A The PR contains a test case for the changes or the changes are already covered by an existing test case.
  • The documentation (docs/) is updated to reflect the changes or this is not necessary (e.g. if the change does neither modify the language nor the behavior or functionalities of Snakemake).

Summary by CodeRabbit

  • Documentation
    • Enhanced help text for the --config option with improved guidance on nested value formatting and practical usage examples to assist users in proper configuration definition.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Dec 15, 2025

📝 Walkthrough

Walkthrough

The help text for the --config command-line option in Snakemake's CLI module is updated to clarify that nested values must be defined in Python dict format and includes an example. This is a documentation-only change with no functional impact.

Changes

Cohort / File(s) Summary
CLI help text documentation
src/snakemake/cli.py
Enhanced help text for --config option to document nested value syntax and provide example usage

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly describes the main change - adding documentation about passing nested config values via CLI, which aligns with the summary of updating help text for the --config option.
Description check ✅ Passed The description includes the required QC checklist with both items checked off, provides context for the change (nested config difficulty), and references a relevant SO post. All required sections are present.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 005c92d and a158770.

📒 Files selected for processing (1)
  • src/snakemake/cli.py (1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
**/*.py

⚙️ CodeRabbit configuration file

**/*.py: Do not try to improve formatting.
Do not suggest type annotations for functions that are defined inside of functions or methods.
Do not suggest type annotation of the self argument of methods.
Do not suggest type annotation of the cls argument of classmethods.
Do not suggest return type annotation if a function or method does not contain a return statement.

Files:

  • src/snakemake/cli.py
🧠 Learnings (2)
📓 Common learnings
Learnt from: johanneskoester
Repo: snakemake/snakemake PR: 3117
File: tests/test_wrapper/Snakefile:11-11
Timestamp: 2024-10-06T14:09:54.370Z
Learning: Changes made within test cases, such as in `tests/test_wrapper/Snakefile`, are for testing purposes and do not require updates to the project documentation.
📚 Learning: 2024-10-06T14:09:54.370Z
Learnt from: johanneskoester
Repo: snakemake/snakemake PR: 3117
File: tests/test_wrapper/Snakefile:11-11
Timestamp: 2024-10-06T14:09:54.370Z
Learning: Changes made within test cases, such as in `tests/test_wrapper/Snakefile`, are for testing purposes and do not require updates to the project documentation.

Applied to files:

  • src/snakemake/cli.py
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (46)
  • GitHub Check: tests (5, ubuntu-latest, py313)
  • GitHub Check: tests (9, windows-2022, py313)
  • GitHub Check: tests (9, ubuntu-latest, py312)
  • GitHub Check: tests (9, ubuntu-latest, py311)
  • GitHub Check: tests (7, ubuntu-latest, py312)
  • GitHub Check: tests (4, windows-2022, py313)
  • GitHub Check: tests (8, ubuntu-latest, py311)
  • GitHub Check: tests (8, ubuntu-latest, py312)
  • GitHub Check: tests (8, ubuntu-latest, py313)
  • GitHub Check: tests (10, ubuntu-latest, py313)
  • GitHub Check: tests (10, macos-latest, py313)
  • GitHub Check: tests (10, windows-2022, py313)
  • GitHub Check: tests (5, windows-2022, py313)
  • GitHub Check: tests (4, ubuntu-latest, py313)
  • GitHub Check: tests (9, ubuntu-latest, py313)
  • GitHub Check: tests (4, ubuntu-latest, py312)
  • GitHub Check: tests (5, ubuntu-latest, py312)
  • GitHub Check: tests (3, windows-2022, py313)
  • GitHub Check: tests (4, ubuntu-latest, py311)
  • GitHub Check: tests (7, ubuntu-latest, py311)
  • GitHub Check: apidocs
  • GitHub Check: tests (7, windows-2022, py313)
  • GitHub Check: tests (5, ubuntu-latest, py311)
  • GitHub Check: tests (6, macos-latest, py313)
  • GitHub Check: tests (8, windows-2022, py313)
  • GitHub Check: tests (5, macos-latest, py313)
  • GitHub Check: tests (6, ubuntu-latest, py313)
  • GitHub Check: tests (10, ubuntu-latest, py312)
  • GitHub Check: tests (6, ubuntu-latest, py312)
  • GitHub Check: tests (3, ubuntu-latest, py313)
  • GitHub Check: tests (10, ubuntu-latest, py311)
  • GitHub Check: tests (6, windows-2022, py313)
  • GitHub Check: tests (7, ubuntu-latest, py313)
  • GitHub Check: tests (6, ubuntu-latest, py311)
  • GitHub Check: tests (4, macos-latest, py313)
  • GitHub Check: tests (1, macos-latest, py313)
  • GitHub Check: tests (1, ubuntu-latest, py313)
  • GitHub Check: tests (3, ubuntu-latest, py311)
  • GitHub Check: tests (2, ubuntu-latest, py311)
  • GitHub Check: tests (1, ubuntu-latest, py312)
  • GitHub Check: tests (1, windows-2022, py313)
  • GitHub Check: tests (2, windows-2022, py313)
  • GitHub Check: tests (2, ubuntu-latest, py312)
  • GitHub Check: tests (3, ubuntu-latest, py312)
  • GitHub Check: tests (1, ubuntu-latest, py311)
  • GitHub Check: tests (2, ubuntu-latest, py313)
🔇 Additional comments (1)
src/snakemake/cli.py (1)

673-675: Helpful documentation improvement—but note the type preservation limitation.

This addition clearly explains how to pass nested config values via the CLI. However, the example --config "foo={'bar': 42}" will result in the integer 42 being parsed as the string "42" because the parser chain attempts int, float, _bool_parser first, which all fail on the dict syntax, then falls back to yaml_base_load (which uses yaml.loader.BaseLoader). The BaseLoader loads all scalar values as strings by default.

If users need to preserve numeric types in nested values, consider documenting this type coercion behavior or suggesting an alternative approach (e.g., using a separate config file with proper YAML/JSON typing).


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@johanneskoester johanneskoester merged commit 9d8c539 into snakemake:main Dec 19, 2025
61 checks passed
johanneskoester pushed a commit that referenced this pull request Jan 8, 2026
🤖 I have created a release *beep* *boop*
---


##
[9.14.6](v9.14.5...v9.14.6)
(2026-01-08)


### Bug Fixes

* create local clone of git repos for source files from hosting
providers ([#3643](#3643))
([d2f8aba](d2f8aba))
* create potentially missing .snakemake folder in case of very long
command lines for spawned jobs
([#3894](#3894))
([4b431dd](4b431dd))
* make ilp solver enumeration lazy
([#3900](#3900))
([30e1509](30e1509))
* Prevent broken report_href links by using deterministic report IDs
with fixed prefix length
([#3889](#3889))
([6d8f4d8](6d8f4d8))
* refactor LoggerManager setup and scope
([#3851](#3851))
([f46d904](f46d904))
* yield proper error message in case a local git source file is not
retrievable
([#3892](#3892))
([ed79cae](ed79cae))


### Documentation

* explain how to pass nested config via CLI
([#3885](#3885))
([9d8c539](9d8c539))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants