Skip to content

Add YAML Configuration Documentation and Template - #431

Open
e-lo wants to merge 23 commits into
mainfrom
feature/yaml-config-documentation-v2
Open

Add YAML Configuration Documentation and Template#431
e-lo wants to merge 23 commits into
mainfrom
feature/yaml-config-documentation-v2

Conversation

@e-lo

@e-lo e-lo commented Jan 6, 2026

Copy link
Copy Markdown
Collaborator

Summary

This PR adds comprehensive YAML/TOML configuration documentation and a configuration template file to make Network Wrangler more accessible to users less familiar with Python, addressing GitHub issue #428.

Changes

Documentation Improvements

  • Restructured "Change Wrangler Configuration" section in docs/how_to.md:
    • Added prominent warning about using YAML/TOML files instead of modifying Python code
    • Step-by-step guide with 4 clear steps: Get Template → Customize → Load → Use
    • Added collapsible template viewer with copy-to-clipboard functionality
    • Consolidated configuration usage examples
    • Added warning about Python-based configuration editing

New Files

  • examples/wrangler.config.yml.template: Comprehensive configuration template with:
    • All available parameters organized by category
    • Default values documented in comments
    • Guidance on when to change each parameter
    • All parameters commented out by default for easy customization
  • examples/stpaul/wrangler.config.yml: Working example configuration file

Code Updates

  • Updated network_wrangler/configs/wrangler.py docstring to reference template
  • Updated docs/design.md to clarify that params.py is not user-configurable

MkDocs Configuration

  • Added pymdownx.snippets extension to enable file inclusion in documentation
  • Added codeinclude plugin
  • Updated watch configuration to include docs and examples directories

Benefits

  • Better Usability: Users can now configure Network Wrangler without writing Python code
  • Clear Documentation: Step-by-step guide with examples and warnings
  • Easy Discovery: Template file shows all available parameters with guidance
  • Version Control Friendly: Configuration files can be tracked in git
  • Accessibility: More accessible for users less familiar with Python

Related Issues

Closes #428

Testing

  • Documentation builds successfully with mkdocs
  • Template file is included and copyable in documentation
  • All examples in documentation are accurate

e-lo added 19 commits January 6, 2026 12:05
- Fix dataclass mutable default issue in WranglerConfig by using Field(default_factory=...)
- Fix pandera/pandas dtype error in scopes.py by changing DataFrame type annotation
  to pd.DataFrame for _filter_exploded_df_to_scope function parameter
- This prevents pydantic from trying to introspect pandera schemas that contain
  list types, which pandas doesn't support as a dtype

Fixes import errors when loading the network_wrangler package.
…ort time

Change DataFrame[RoadLinksTable] to pd.DataFrame in prop_for_scope function
signature to prevent pydantic from trying to introspect the pandera schema
at import time. The validation still happens inside the function via
validate_df_to_model().
The helper functions _default_*_config() are unnecessary since the classes
themselves are callable and can be used directly in Field(default_factory=...).
This simplifies the code without changing functionality.
Change DataFrame[Model] type annotations to pd.DataFrame in RoadwayNetwork
class fields to prevent pydantic from trying to introspect pandera schemas
at class definition time. Validation is now done in field validators using
validate_df_to_model().

This fixes the 'dtype list not understood' error when importing the package.
- Fix field_validator decorator order (classmethod before field_validator)
- Fix bug in Feed.__init__ where dict iteration was missing .items()
- These changes ensure compatibility with Python 3.10 through 3.12
- Add Python 3.11 and 3.12 to test matrix
- Add explicit import test that would fail before the hotfix
- This ensures the hotfix is validated across all supported Python versions
UP045 suggests using 'X | None' syntax which requires Python 3.10+.
Since the project supports Python 3.9+, we should keep using
Optional[X] for backwards compatibility.
Since the project supports Python 3.9+ (requires-python = '>=3.9'),
we should test Python 3.9 in CI to ensure compatibility.
Test all current stable Python versions to ensure compatibility
across the full range of supported versions.
Python 3.14 is still in development and fiona/GDAL dependencies
don't have wheels available yet, causing build failures. We'll add
it back once it's stable and dependencies are available.
PLC0415 flags imports inside functions, but many of these are
intentional lazy imports to avoid circular dependencies or to
only import heavy dependencies when needed. These are a common
pattern in the codebase and should not be flagged.
Fix 'raises' to 'Raises' in docstring to match Google style convention.
- Fix D405: Capitalize 'returns' to 'Returns' in data.py docstring
- Fix RUF022: Sort __all__ list alphabetically in __init__.py
- Fix PLW1641: Add noqa comment for DBModelMixin (intentionally unhashable
  due to mutable dataframes)
- Add prominent YAML Configuration tip at top of wrangler.py docstring
- Fix typo: EXISTING_VALUE_CONFLIC -> EXISTING_VALUE_CONFLICT
- Update Extended usage section to discourage Python code modifications
- Add comprehensive YAML configuration section to how_to.md with examples
- Add configuration best practices warning
- Update design.md to clarify params.py is not user-configurable
- Create example wrangler.config.yml file with all available parameters

These changes make YAML/TOML configuration the recommended approach,
especially for users less familiar with Python, addressing GitHub issue #428.
- Create wrangler.config.yml.template with all parameters commented out
- Include default values and guidance on when to change each parameter
- Update how_to.md with step-by-step instructions using the template
- Add template details tip explaining what's included in the template
- Improve usability by showing users to start with template and customize
- Move Configuration Best Practices warning to top
- Restructure Step 3 and Step 4 for better clarity
- Add danger box for Python config editing with warning
- Consolidate configuration usage examples
- Add pymdownx.snippets extension for template file inclusion
- Fix typo: 'beetween' -> 'between'
@e-lo
e-lo changed the base branch from main to hotfix/pandera-pandas-compatibility January 8, 2026 20:16
@e-lo
e-lo changed the base branch from hotfix/pandera-pandas-compatibility to main January 8, 2026 20:17
@e-lo e-lo self-assigned this Jan 8, 2026
@e-lo
e-lo changed the base branch from main to hotfix/pandera-pandas-compatibility January 8, 2026 20:20
@e-lo
e-lo requested a review from i-am-sijia January 8, 2026 20:22
Base automatically changed from hotfix/pandera-pandas-compatibility to main January 13, 2026 18:01
@github-actions

github-actions Bot commented Feb 9, 2026

Copy link
Copy Markdown
Contributor

Coverage

Tests Skipped Failures Errors Time
256 4 💤 0 ❌ 0 🔥 9m 21s ⏱️

@github-actions

github-actions Bot commented Feb 9, 2026

Copy link
Copy Markdown
Contributor

📊 Benchmark Comparison

Comparing PR branch to base branch main

No previous benchmark found in base branch. This will serve as the baseline.

@e-lo e-lo added the docs Documentation only changes label Feb 9, 2026
@e-lo

e-lo commented Feb 9, 2026

Copy link
Copy Markdown
Collaborator Author

@i-am-sijia This responds to one of your requests. LMK if it satisfies your questions regarding configging!

@github-actions

Copy link
Copy Markdown
Contributor

📊 Benchmark Comparison

Comparing PR branch to base branch main

No previous benchmark found in base branch. This will serve as the baseline.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Documentation only changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

🧹 Allow users to configure parameters in YAML rather than Python

1 participant