Skip to content

fill documentation with life and style #82

Description

@maxnutz

fill documentation with life and style

Implementation plan. Split into 3 independent, incremental PRs.

1. Clean up API reference — hide non-function members from utils.py docs

Problem: docs/api/utils.md renders ::: pypsa_validation_processing.utils with members: true, which dumps the module's 3 helper functions and its 5 module-level dicts (REGION_MAPPING, UNITS_MAPPING, statistics_kwargs, statistics_kwargs_for_filtering, statistics_kwargs_for_imports) into the API page. Only the functions should show.

Approach: explicit members: allowlist, scoped to docs/api/utils.md only (no code changes in utils.py).

Files:

  • docs/api/utils.md — add local mkdocstrings options block:
    # Utilities API
    
    ::: pypsa_validation_processing.utils
        options:
          members:
            - remap_unit_index
            - get_energy_totals_domestic_share
            - create_location_index_from_copperplate
  • No changes needed to docs/api/class_definitions.md, statistics_functions.md, workflow.md, package.md — verify each of those doesn't have the same dict-leak problem (spot-check class_definitions.py / statistics_functions.py for stray module-level constants) and apply the same allowlist pattern if needed.

Trade-off accepted: the allowlist must be updated by hand whenever a new public helper is added to utils.py. This is intentional (per decision) — flag it in the PR description so reviewers know to update docs/api/utils.md alongside new helpers. Add a short note to the README stating, for documentation of new files in utils, this list has to be manually updated.

Branch: 82-fix-api-docs-helper-functions

Verification: pixi run mkdocs build (or equivalent doc build command) and visually confirm utils.md page shows exactly 3 functions, no dicts.


2. Add a contributing / coding-style docs page

Problem: issue asks for "general information and participation coding styles" — currently this lives only in CLAUDE.md (agent-facing) and partially in README's "Variable's Statistics - Functions" section. There's no human-facing contributor doc on the site.

Approach: new docs/contributing.md, added to mkdocs.yml nav. README stays as-is (no trimming) — the docs page is additive, not a replacement, so existing README readers aren't affected.

Content to consolidate into docs/contributing.md:

  • Project context (short): PyPSA-AT, IAMC variables, links to energy-scenarios-at-workflow.
  • Code style: Python ≥ 3.12, type hints required, NumPy-style docstrings, pixi run black ..
  • Function architecture rules: statistics functions in statistics_functions.py are independent and may only call utils.py helpers; utils.py helpers may call each other but never statistics functions.
  • Statistics-function conventions (mirrors/expands README section): naming convention (|__, spaces → _), fixed signature (n: pypsa.Network, aggregate_per_year: bool), return format rules (Series vs DataFrame, required location/unit index levels), the configs/mapping.default.yaml lookup mechanism.
  • Testing rules: unit tests only in tests/, output-format assertions (pandas.Series with MultiIndex containing at least country/unit), add/update tests only when behavior changes.
  • Contribution workflow: open an issue first (link "New Variable Statistics" issue template), branch-per-issue, PR checklist (pixi run test, pixi run workflow_test, no debug/TODO leftovers), assign @maxnutz as reviewer.

Files:

  • docs/contributing.md (new)
  • mkdocs.yml — add Contributing: contributing.md to nav:

Branch: 82-add-contributing-docs

Verification: pixi run mkdocs build, check nav renders, links resolve (no dead internal links).


3. Document the Scenario Explorer on the docs landing page

Problem: no documentation exists yet on what the Scenario Explorer is or how to use it with this package's output.

Approach: rewrite docs/index.md entirely (not just append) to lead with this information, since it's flagged as important for PyPSA-AT users and should not be buried below the API-reference pointer.

Content (from issue body):

  • Explorer URL: https://pypsa-at-dev.apps.ece.iiasa.ac.at/
  • Requires user registration on the site.
  • Explorer accepts all model names starting with "Pypsa-AT v1.0".
  • The model name must be exactly one of the models set in the mappings file — cross-check against this package's model_name config value and the Network_Processor default (e4c6652 recently set a default model_name matching this mapping — confirm consistency).
  • Large-file submissions can take a while; user is notified by e-mail on success.
  • This package's output is already formatted to fit Scenario Explorer submission requirements — call out relevant config flags (map_country_codes_to_names, convert_units, aggregation_level) that affect submission validity.

Proposed new structure for docs/index.md:

# PyPSA Validation Processing

<short project intro — 1-2 sentences>

## Scenario Explorer

<explorer info as above>

## API Reference

Use the API Reference section (nav) for the automatically rendered module documentation.

## Contributing

See [Contributing](contributing.md) for coding-style and participation guidelines.

Files:

  • docs/index.md (full rewrite)

Branch: 82-add-scenario-explorer-info

Verification: pixi run mkdocs build, manually review rendered landing page.


Suggested execution order

  1. PR 1 (API doc filter) — smallest, no content-writing, quick win.
  2. PR 3 (Scenario Explorer info) — self-contained, high user value, content already given in the issue.
  3. PR 2 (Contributing page) — largest, benefits from PR 1 being merged first (can link to the now-clean API reference).

Each PR closes out one checkbox of this issue; issue #82 stays open until all three are merged, then close manually (the CSS checkbox is already done).

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentation

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions